Relay Interface With Arduino

Hey, Do you want to know how to Relay interface with Arduino? Do you want to control your electrical appliances just sitting in your room? Do you feel lazy to turn the lights on and off? Are you working on a project that requires the use of controlling A.C. devices? well, you are at the right place. In this article, we’ll go over how to function, use, and interface the Relay module With Arduino in a step-by-step detailed guide. Hence, I hope you find this useful. We at Techatronic have already uploaded several Arduino Tutorials and detailed project guides related to Arduino which will be useful to learn the basics and programming of Arduino.

Relay interface with arduino

What is Relay Module?

A relay is basically a switch, which needs electrical energy to work. This can be used to control devices which can be anything from A.C. to D.C. These switches are gaining popularity in devices related to home automation. we can also make our own DIY projects related to Home Automation using IoT. you can also use this module to make a voice-controlled switch that can work with both Google Assistant and Alexa, using NODEMCU as its brain.

This can work much spontaneously which makes it a great addition to any project. the coil requires 5V to operate which is a very common voltage on which many microcontrollers work. this makes it easy to use in projects which use them. Relay modules are available in many channels as per need ranging from single-channel all the way up to sixteen-channel.

Relay module

How Does the Relay Module Work?

Relay Module Works on the basis of Electromagnetism. A coil inside a relay is used for the functioning of the relay. When an electric current passes through the coil, it forms an electromagnetic field. An iron core inside the coil moves and it helps the contacts to touch, helping the circuit to close. when no current passes through the coil, the contacts are normally open.

There are two types of relay configuration available. they vary in their throw and pole. The pole is the control terminal of the coil, whereas the throw is the possible connection as output. a Single pole-Single throw relay can control only one switch at a time whereas a single pole-Double throw relay can work as two Switches.

Relay module

Components Required

  • Arduino UNO
  • Relay Module
  • AC Bulb
  • AC power  supply
  • Jumper Wires
  • Breadboard
  • USB cable to connect Arduino UNO with computer
Relay interface with arduino component

Relay Interface With Arduino Circuit Diagram

Relay Interface With Arduino Circuit Diagram
Arduino UNORelay Module
D4 PinIN1 OUT Pin
( +5V )VCC ,  ( + 5V )
GND GND
AC Bulb220 V AC SupplyRelay Module
  Normally Open
 PhaseCommon
Terminal 1 Normally Closed
Terminal 2Neutral 
  • VCC of the module to 5V of Arduino UNO
  • GND of the module to GND of Arduino UNO
  • Trigger Pin of the module to D8 of Arduino UNO

Relay Interface With Arduino Code

 // TECHATRONIC.COM  
 void setup()  
 {  
  pinMode(8,OUTPUT); // RELAY PIN  
  digitalWrite(8,HIGH); // Normally ON Only For Chanies Relay Module  
 }  
 void loop()   
 {  
  digitalWrite(8,LOW); // RELAY ON  
  delay(1000);  
  digitalWrite(8,HIGH);  // RELAY OFF  
  delay(1000);  
 }  
Relay interface with arduino

Before uploading the code, check all the connections properly as you are working with live 220 Volt A.C. The bulb will turn on for 1 second and turn off for another 1 second. I hope you will find this tutorial helpful. If you have any queries, you can ask us in the comment section below.

1 thought on “Relay Interface With Arduino”

Leave a Comment