Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.

Why Join?

  • Expert Support: Solve post-sale issues and technical challenges with help from our community and team.

  • Learn & Share: Exchange tips and tutorials to enhance your skills.

  • Exclusive Previews: Get early access to new product announcements and sneak peeks.

  • Special Discounts: Enjoy exclusive discounts on our newest products.

  • Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.

👉 Ready to explore and create with us? Click [here] and join today!

2.21 Relay Module


In this lesson, you will learn about Relay Module.

Components Required


Fritzing Circuit

In this example, we use Power Supply Module to power the load,use LED as an example.


Schematic Diagram




  • You can open the file 2.21_relayModule.ino under the path of sunfounder_vincent_kit_for_arduino\code\2.21_relayModule directly.

  • Or copy this code into Arduino IDE.

Once the codes are uploaded to the Mega2560 board, you can see that the Relay Module controls the closing and breaking of the external circuit, which will change its working state a second. For detailed code explanation, refer to 1.2 Digital Write.

Phenomenon Picture