INTERFACING 4 CHANNEL RELAY MODULE WITH ARDUINO UNO

INTERFACING 4 CHANNEL RELAY MODULE WITH ARDUINO UNO

Introduction

A relay is an electrically operated or electromechanical switch composed of an electromagnet, an armature, a spring and a set of electrical contacts. The electromagnetic switch is operated by a small electric current that turns a larger current on or off by either releasing or retracting the armature contact, thereby cutting or completing the circuit. Relays are necessary when there must be electrical isolation between controlled and control circuits, or when multiple circuits need to be controlled by a single signal.

 

 

 

 

 

 

 

4CH Relay Module

 

 

 

 

 

 

 

Components Required

·        Arduino UNO

·        4CH Relay Module

·        Bread Board

·        Jumper Wires

 

Input

 VCC: Connected to a positive supply voltage (supply power according to relay voltage)

GND: Connected to supply ground.

 IN1: Signal triggering terminal 1 of the relay module.

 IN2: Signal triggering terminal 2 of the relay module.

 IN3: Signal triggering terminal 3 of the relay module.

 IN4: Signal triggering terminal 4 of the relay module.                                     

 

 

 

 

Circuit Diagram:

                            

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Connections

·        The Vcc pin of the Arduino board is connected with the VCC of 4ch module.

·        Pin 5 of Arduino board is connected with IN1 of Relay Module.

·        Pin 4 of the Arduino board is connected with IN2 of the Relay Module.

·        Pin 3 of the Arduino Board is connected with IN3 of the Relay Module.

·        Pin 2 of the Arduino Board is connected with IN4 of the Relay Module.

·        The GND pin of the Arduino board is connected with the Ground of 4ch module.

 

 

Arduino Code

// Interfacing 4Channel Relay Module With Arduino UNO

int relay1= 5; //initialize relay1

int relay2= 4; //initialize relay2

int relay3= 3; //initialize relay3

int relay4= 2; //initialize relay4

void setup() {

  pinMode (relay1, OUTPUT); //defining relay1 as output

  pinMode (relay2, OUTPUT); //defining relay1 as output

  pinMode (relay3, OUTPUT); //defining relay1 as output

  pinMode (relay4, OUTPUT); //defining relay1 as output

 }

void loop() {

   digitalWrite(relay1,HIGH);       //turn on relay1

   delay (500);                             //Waite for half second

   digitalWrite(relay1,LOW);       //turn off relay1

   delay (500);                            //wait for half second

   digitalWrite(relay2,HIGH);     //turn on relay1

   delay (500);                           //Waite for half second

   digitalWrite(relay2,LOW);      //turn off relay1

   delay (500);                           //waiter for half second

   digitalWrite(relay3,HIGH);    //turn on relay1

   delay (500);                          //Waite for half second

   digitalWrite(relay3,LOW);       //turn off relay1

   delay (500);                            //wait for half second

   digitalWrite(relay4,HIGH);      //turn on relay1

   delay (500);                            //wait for half second

   digitalWrite(relay4,LOW);      //turn off relay1

   delay (500);                           //wait for half second

}

 

The result of the project: