In this blog, we will be discussing interfacing relay module with Arduino Uno.
# Module Data Sheet:
This datasheet is of 5V Single Channel Relay...
Working DC Voltage: 5V
Working AC Voltage: 240-250V
Working AC Current: 7-15A
# Pin-Out:
Vcc = 5V ... Power Supply Pin (to Arduino)
Gnd ... Power Supply Pin (to Arduino )
Signal: Through this pin, the control signal is provided from Arduino
(In case of Isolated Relay Vcc pin = Signal Pin)
NC Pin: Generally left open (NC = Normally Closed Pin)
C Pin: Connected with -ve terminal of ac supply
NO pin: Connected to -ve the terminals of the load (NO = Normally Open)
# Arduino Connection:
# Working:
First of all, let us understand how the connections are done.
The ac power supply is connected in series with the load and the other terminal of it is connected to "COM".
The other terminal of the load is connected to the "NO".
When the i/p signal is sent to the module, the coil energizes and it attracts the switch and makes the connection between "NO" and "COM" as shown in the figure.
Note: If you are using the relay module then an additional pin is provided to control the switch.
But if you are using an isolated relay the energizing and de-energizing of the coil is controlled using its Vcc pin.
In this blog, we will be dealing with the relay module and code for both will remain the same.
# Arduino Code:
//This Code will switch on and off the supply with the delay of one second
//we have defined digital pin 10 for the control signal of relay
int relay = 10;
void setup()
{
pinMode(relay, OUTPUT);
//pinMode()...is used to define the pin as input pin or output pin
}
void loop()
{
//digitalWrite()...is used for making the digital pin HIGH = 5V or LOW = 0v
digitalWrite(relay, HIGH);
//delay()...is used for creating delay in milliseconds
delay(1000);
digitalWrite(relay, LOW);
delay(1000);
}
//we have defined digital pin 10 for the control signal of relay
int relay = 10;
void setup()
{
pinMode(relay, OUTPUT);
//pinMode()...is used to define the pin as input pin or output pin
}
void loop()
{
//digitalWrite()...is used for making the digital pin HIGH = 5V or LOW = 0v
digitalWrite(relay, HIGH);
//delay()...is used for creating delay in milliseconds
delay(1000);
digitalWrite(relay, LOW);
delay(1000);
}
# Applications:
1. Switching Applications
To download the code click here
Fabulous explanations
ReplyDeleteAwesome
ReplyDelete