top of page

Lesson-09 : Introduction to the interfacing of Relay with Arduino Uno

Let us now understand basics of Relay and then will move on to the interfacing part of Relay with Arduino Uno.


A relay is an electrically operated switch. It consists of a set of input terminals for a single or multiple control signals, and a set of operating contact terminals. The switch may have any number of contacts in multiple contact forms, such as make contacts, break contacts, or combinations thereof.

Interfacing Relay with Arduino

 Interfacing Relay with Arduino
Interfacing Relay with Arduino

Components Required:

  1. Arduino Uno with usb cable

  2. Relay module and dc pump

  3. Jumper wires (Male to Male (3))

  4. Extension wire

  5. 9V battery

  6. Breadboard (optional)

Step by step Connections

  • Connect the Signal pin of relay to the Digital pin 2 of the Arduino uno

  • Connect the VCC pin to the +5v of Arduino

  • Connect the GND pin to the GND of Arduino

  • Connect the +ve line from the battery to the Normally OPEN or NO port

  • Connect one terminal of the motor or pump to the relays COM port

  • Connect the other terminal of the motor to the –ve line of the battery

Code for Interfacing the Relay

  1. Define the Pin Mode in the void Setup

  2. Define the logic in the void Loop

Functions used in this example:

  1. pinMode(Pin_Number, IN/OUT); to set the mode i.e. input or output for example pinMode(3,OUTPUT);

  2. digitalWrite(Pin_Number,LOW/HIGH); to set the pin as High or low for example digitalWrite(3,LOW);

  3. delay(microseconds) to put a time delay between two instructions. For example delay(1000) i.e. 1 sec delay

Register for the IoT course provided by Nation Innovation.

12 views0 comments


Mit 0 von 5 Sternen bewertet.
Noch keine Ratings

Rating hinzufügen
bottom of page