Microcontrollers Lab: Relay Module Interfacing With Arduino
Microcontrollers Lab: Relay Module Interfacing With Arduino
Microcontrollers Lab
COURSES CONTACT ADVERTISE
arduino
Microcontrollers Lab 2 Years Ago 1 Comment
JOIN 32,112
SUBSCRIBERS
Relay module for Arduino is one of the most powerful application for
Arduino as it can be used to control both A.C and D.C devices by simply
controlling the relay by giving 5V. A relay is basically a switch which is
operated electrically by electromagnet. A relay can be used to control high
voltage electronic devices such as motors and as well as low voltage SUBSCRIBE TO
electronic devices such as a light bulb or a fan. BLOG VIA EMAIL
Relays works on the principle of electromagnetism. When the electricity is
Enter your email address to
provided to the relay coil then it acts like a magnet and changes the state of
subscribe to this blog and
the switch. The part which powers the relay module is completely isolated receive notifications of new
posts by email.
from the part which turns ON or OFF. This is why we can control a 220V Email Address
CATEGORIES
8051 microcontroller
(18)
Arduino (90)
Arm microcontroller (4)
AVR microcontroller
(16)
electronics (19)
Electronics components
(12)
electronics projects (12)
Page Contents [hide]
embedded systems (28)
ESP8266 (16)
1 Relay Module
FGPA (5)
2 Relay Module Pin out
General Articles (43)
3 Input Connections of relay module
GPS based projects (5)
4 Output Connections of relay module
gsm (23)
5 relay module interfacing with arduino
ICs (5)
6 Video lecture on Arduino with relay module
Inverters (17)
7 Code of relay module interfacing with microcontroller
IOT projects (3)
Labview project (42)
Relay Module MIPS assembly language
(6)
There many types of relay modules available like 1 relay, 2 relay, 5 relay and
PCB designing (10)
8 relay but we are using the 4 relay Arduino module. Once you will
PIC microcontroller
understand this then you can use all other types. projects (137)
pic microcontroller
tutorials (84)
Power (11)
Power electronics (57)
Input 4 (IN 4): This will be connected to the digital pin on your Arduino, or
leave it unconnected if you do not want to use this channel.
Logic VCC: This will be connected to the 5v pin of the Arduino o power the
4 relay module.
You can also power the 4 relay module using the external power by giving
Output Connections of relay module
you may also like to read Xbee interfacing with arduino
Before getting into the output connections of the relay, we have to
understand the NO, COM and NC connections.
COM (Common connection): The COM is the center terminal of the relay
and it is used in both (Normally open and normally closed) connections.
NO (Normally open): This act like a switch. In normally open connection,
there will be no contact between COM and NO, since it is normally open.
But when we will activate the relay module, then it will get connected to the
COM and will supply power to the load, which will power up the light. Thus
the circuit will initially be in open state until we trigger the state.
NC (Normally closed): its behavior is opposite to the normally open
connection. It always remains in contact with COM, even when relay
module is not powered. When we will trigger the relay module then it will
open the circuit, so the connection is lost.
We will use the normally open connection. When you will use the relays in
NO (Normally Open) connection and you set the corresponding IN pin to
LOW, then the power will flow from the COM connector and out of the
normally open connector powering your device.
Relay 1 (K1): Connect one end of the load to the COM and the other end to
the NO.
Connections for the K2, K3 and K4 are the same.
relay module interfacing with arduino
The connection of 4 relay module to an Arduino is very easy and allows you
to control many devices through Arduino (both A.C and D.C). In this
example we will connect a simple load such as a led at the output of the
relay and will control it by using the Arduino. First connect the 5v of the
Arduino to the VCC of the 4 relay module and the ground of the Arduino to
the ground of the 4 relay module. Then we will have to connect the
communication pins IN1, IN2, IN3, and IN4 to the Arduino data pins 7, 6, 5,
and 4.
We will use a 3v battery to power the Led’s. So we have connected the
positive of the battery to the positive side of the led’s and then we have
connected the negative side to the com of each relay and the NO to the
negative side of the led’s.
Components Required for relay module
• Arduino Uno (You can use any other type)
• 4 Relay module
• 3v Battery
• Led’s
• 220 ohm resistors
• Breadboard
Video lecture on Arduino with relay
module
#define RELAY1 7 //Defining the pin 7 of the Arduino f
#define RELAY2 6 //Defining the pin 6 of the Arduino f
#define RELAY3 5 //Defining the pin 5 of the Arduino f
#define RELAY4 4 //Defining the pin 4 of the Arduino f
void setup()
{
pinMode(RELAY1, OUTPUT); //Defining the pin 7 of the A
pinMode(RELAY2, OUTPUT); //Defining the pin 6 of the A
pinMode(RELAY3, OUTPUT); //Defining the pin 5 of the A
pinMode(RELAY4, OUTPUT); //Defining the pin 4 of the A
}
void loop()
{
digitalWrite(RELAY1,LOW); // This will Turn ON the rel
delay(5000); // Wait for 5 seconds
digitalWrite(RELAY1,HIGH); // This will Turn the Relay
digitalWrite(RELAY2,LOW); // This will Turn ON the rela
delay(5000); // Wait for 5 seconds
digitalWrite(RELAY2,HIGH); // This will Turn the Relay
RELATED POSTS
piezoelectric PICK AND Introduction to
sensor PLACE Arduino
interfacing MULTI-AXIS programming
with Arduino Robotic ARM
Microcontrollers
Uno R3
Microcontrollers Lab November
Microcontrollers Lab July 27, 26, 2018
Lab December 2016
13, 2014
RF Transmitter Servo motor thermistor
and Receiver control and interfacing
Module interfacing with arduino
Interfacing with Arduino temperature
with Arduino meter
Microcontrollers
Microcontrollers Lab March 15, Microcontrollers
Contact me if you want to hire me for your projects Send me your project
details at my email address: [email protected]
ONE RESPONSE
Thanks sir
Good jobe
Reply
ADD COMMENT
Comment Text*
Name*
Email*
Website
SUBMIT COMMENT