How to control 240V /120V light bulb from 5V arduino using relay module

Arduino Tutorial 28# How to control 240V /120V light bulb from 5V arduino using relay module

Posted Posted in Arduino

In this tutorial we will see how to control 240V/120V light bulb from 5V Arduino using Relay module. And we will turn on and off light by using blinking code. So, let’s get started.


Before starting this tutorial, I want to give you a warning. Since we are using 240V/ 120V line voltage you should take necessary precaution when dealing with high voltage. Doing this incorrectly can cause you serious injuries or death. Or damage your Arduino/Relay. For any action I am not responsible for that.

For doing this project you will need

  1. Arduino,
  2. Relay module,
  3. Diode (1N4007), for extra protection.
  4. Breadboard & Jumper wires,
  5. 240V/120V light bulb ,
  6. Bulb holder, wire and plug.

I am using 2 channel relay module. you can use single or 2 channel relay it doesn’t matter.


Circuit diagram for 5V Relay module
Circuit diagram for 5V Relay module

I have putted diode between Arduino and relay. It will give Arduino extra protection by allowing current to flow only in one direction. One wire is cut between holder and plug. One end is connected to common pin (COM) and other end is connected to normally closed pin (NC). Do connection as shown in diagram. Use extension board if something could go wrong, you can switch it off directly.

Now open sketch of blink.


// the setup function runs once when you press reset or power the board
void setup() {
 // initialize digital pin LED_BUILTIN as an output.

// the loop function runs over and over again forever
void loop() {
 digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
 delay(2000); // wait for a second
 digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
 delay(2000); // wait for a second

Change delay time to 2000 millisecond for on and off. Upload the sketch. After uploading the sketch, turn on extension board. Now we can see our 240v light is turn on for 2 second and off for 2 second.

Components list to buy online:   (Arduino) (Relay Module) (Diode 1N4007)  (Breadboard)   (Jumper wire)

For more videos subscribe the channel

Till than keep learning keep making. 🙂