Skip to main content

Interfacing RELAY with Arduino UNO

 
Interfacing RELAY with Arduino UNO


What is Relay?

Relay is an automatic switch that detects conditions in circuits and causes the contacts to change their positions to close or open the circuit as required. Relays are used in many applications. When the coil of the relay is energized or de-energized, its contacts are ON or Off.         In a relay, we have to consider two important parameters i.e. once is the Trigger Voltage, this is the voltage required to turn on the relay that is to change the contact from Common->NC to Common->NO. Our relay here has a 5V trigger voltage.

 




Let’s understand the interfacing of relay with Arduino


I amusing online simulation software (Tinker cad). Tinker cad helps to interface, code, and simulate online. All the components I have used are present in the software. You can also build your own circuit. All the components have been labeled in the above Figure.
The push-button is connected to pin2 which is a digital pin and the relay is connected to pin4. The pin is used as the input pin whereas pin 4 is the output pin. When we press the push button a digital high signal is given to the Arduino. As the Arduino gets HIGH signal from pin2, it provides a Digital HIGH signal to pin4(Relay). The relay is been closed and the Bulb glows.

Fig1: Image when Push Button is not pressed

Fig2: Image when Push Button is pressed

CODE:

/*
Harshal Sawant
05/02/2021
*/
void setup()
{
  pinMode(4, OUTPUT); // pin4 defined as output pin
  pinMode(2, INPUT);  // pin2 defined as input pin
}

void loop()
{
  if(digitalRead(2)== HIGH) //checking if there is high slg on pin2
  {
    digitalWrite(4, HIGH); //Digital Write high if pin 2 is high
  }
  else
  {
    digitalWrite(4, LOW); //Digital Write low if pin 2 is low
  }
  delay(100);
}
 
If  you are interested to see the working go to the link below



Comments

Popular posts from this blog

PASSWORD PROTECTED DOOR LOCK

    In this blog, we will learn about how to make password-protected door locking mechanisms. The password with by given by the serial monitor. If the password is right door will open and if it's wrong door will not open. The movement of the door is controlled by a servo motor and the status of the password is displayed on the LCD display. If the password is correct it will let the person know id is correct and if the password is wrong invalid message is displayed.  You can use Bluetooth for serial communication in real-life scenarios and feed the password to the system through Bluetooth. The application of this can be anywhere you need to use a protected Door. From the below link you can see the working of the project. The below link is of an online circuit simulation software called tinker cad. You need to just log in to the software, tinker cad is free of cost. If  you are interested to see the working go to the link below: https://www.tinkercad.com/things/cDqHb0Nnye2-harshal-sa