Menu Close

Arduino – 220V AC switching by 12V Relay

This tutorial explain the switching concept for 220V AC devices. It uses Arduino platform and RoboIndia’s 12V DC relay breakout board. Disclaimer: You have to be careful with 220V AC supply, Robo India is not responsible for any mishappening. 

1. Introduction: 

This tutorial explains switching 220V AC device with a 12V DC relay. This tutorial also explains how does a relay works. You need to be very careful with 220V AC power supply. We recommend to use proper bulb holder and cord with plug. Don’t touch any wire or AC supply.

1.1 Relay:

Following Video of Robo India explains working and concept of relay-

2. Required Hardware

Following Hardware will be required to perform the example of this tutorials.

S.No.ItemQuantity
1.R-Board with FTDI or Arduino Board1
2.12V Relay Breakout Board1
3.Male to female Jumpers 5
4.220 Volt AC Bulb1
5Power cord for 220 Volt supply1
6.12V Power source1

3. Circuit:

You will need to make following circuit to run this sketch.

3.1 You may go with Robo India R-Board (Arduino UNO based)-

NOTE: You need to be very careful with 220V AC power supply. We recommend to use proper bulb holder and cord with plug. Don’t touch any wire or AC supply. 

here is the schematic of above circuit:

 3.1 You may go with original Arduino UNO Board –  

 here is the schematic of above circuit:

 4. Programming:

We don’t need any special programming to operate Relay, Simple Digital output programming is required. So the programme we have added here is as same as in our other tutorial of Digital Output – LED Blinking. The same codding is used throughout the tutorial. This code will blink 220V AC bulb for at an interval of 1 second.

You may download code (Arduino Sketch) from here.

// Digital output tutorial by ROBO INDIA
// www.roboindia.com
// Digital output is taken on a LED that remains ON for one second and 
// OFF for another.

// Defining Pin 2 as LED.
const int LED = 2;  // from the circuit we can see that we have connected LED on Pin 2


void setup() {                
    pinMode(LED, OUTPUT); // Defining LED pin as OUTPUT Pin.   
}

// Below mentioned code runs for ever(infinite loop)
void loop() {
  digitalWrite(LED, HIGH); // LED gets turned ON (1/HIGH/+5V)
  delay(1000);             // Waiting for one second. 
  digitalWrite(LED, LOW);  // LED gets OFF (0/LOW/0V/GND)
  delay(1000);        // here and above Delay is in mili second (1000 = 1 second)
}

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
http://roboindia.com

Leave a Reply