Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

Interfacing Arduino with Relay

Interfacing Arduino with Relay

 

Fig: Relay

In this tutorial, i will be discussing how we can interface Arduino with a Relay. You can also check out my previous post on Interfacing Arduino with LCD.
Relays are the switches used in closing and opening  circuits electronically as well as electromechanically. A Relay can be used to control high-voltage and high-current appliances  from lower voltage levels.
Some Relays are Alternating Current (AC) controlled while others are Direct Current (DC) Controlled.

There are different kinds of Relays some includes:
  • Single Pole Single Throw      (SPST)
  • Single Pole Double Throw    (SPDT)
  • Double Pole Single Throw    (DPST)
  • Double Pole Double Throw   (DPDT)


Fig: Schematic of SPDT Relay

The above image shows the schematic of  SPDT Relay, it is a very common kind of relay. SPDT relays have five(5) terminals. L1 and L2 are the coil terminals, other terminals are the common (COM) , normally-closed (NC) and normally-opened (NO). whenever a considerable amount of current is passed through the coils of the Relay at rated voltage, the coil gets energized and the lever inside it changes state. 
By default, the lever connects the COM and NC terminals but when the coil gets energized, the lever changes state and connects COM and NO as shown in Fig a. and Fig b. below.

Fig a. 

Fig b.

A low power supply on the coil can be used to control a high power load. When  switch SW in Fig a. is open, the lever connects COM and NC making the Lamp OFF, but When switch SW in Fig b. is closed, the lever changes state hence the Lamp comes ON as a result of the Closed circuit formed .

Circuit Diagram:


CODE:


/*

  Name     : Interface  ARDUINO with Relay

  Author   : DANIEL OLUWOLE

           : (C) 2020 DANITRONICS.

           : danitronics7@gmail.com, danieloluwole51@yahoo.com

           : Mobile: +234 8188508765.
    Aim : This program demonstrates how signals sent through pin8 of the Arduino                  can affect the load connected on the relay.  
              Here, the 12v lamp will turn ON and OFF every second.
*/

// The setup function runs when you press reset or power the board

int RELAY_CNTRL_PIN = 8;     //variable to hold status of pin 8  of Arduino

void setup()

{

pinMode(RELAY_CNTRL_PIN, OUTPUT);     // initialize digital pin 8 as an output.

 }

// the loop function runs over and over again forever

void loop()

{

digitalWrite(RELAY_CNTRL_PIN, HIGH);   // turn the LED ON (HIGH is the voltage level)

delay(1000);              // wait for a second

digitalWrite(RELAY_CNTRL_PIN, LOW);    // turn the LED OFF by making the voltage LOW

delay(1000);              // wait for a second



Next Post



Post a Comment

0 Comments

Ad Code

Responsive Advertisement