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.

HTML Image as link

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.

HTML Image as link
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 )
AC Bulb220 V AC SupplyRelay Module
  Normally Open
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

 void setup()  
  pinMode(8,OUTPUT); // RELAY PIN  
  digitalWrite(8,HIGH); // Normally ON Only For Chanies Relay Module  
 void loop()   
  digitalWrite(8,LOW); // RELAY ON  
  digitalWrite(8,HIGH);  // RELAY OFF  
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.

Spread the love

6 thoughts on “Relay Interface With Arduino”

  1. Pingback: automatic street light Project using Arduino | Arduino street light

  2. Pingback: home security system using arduino | pir motion sensor security system

  3. Pingback: Solenoid Lock Interfacing with Arduino | Arduino Tutorial

  4. Pingback: Automatic light microwave motion sensor | microwave motion detector light

  5. Pingback: Solenoid valve with Arduino | Arduino interface with Solenoid Valve | Arduino tutorial

  6. Pingback: Touch sensor with Arduino | arduino touch switch | Techatronic

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top