Control 4-Channel Relay Module

By Emir

Connect and control 4-Channel relay module using Arduino board.

Step 1

Bill of materials

  • Arduino board with USB cable (we use Arduino Uno)
  • 4-Channel relay module
  • 6 pcs male to female wires
Step 2

Connect wires on relay module

Connect six female pins of wires with relay module male pins as shown on the picture.

Gnd - yellow; In1 - orange; In2 - red; In3 - brown; In4 - black; Vcc - white

show more
Step 3

Connect wires with Arduino

Connect wires from relay module to Arduino pins.

Gnd - yellow - Gnd; In1 - orange - pin 13; In2 - red - pin 12; In3 - brown - pin 11; In4 - black - pin 10; Vcc - white - 5V

show more
Step 4

Open Arduino IDE and write code

To control each relay channel we have to send LOW signal from Arduino pin.

int a = 13;
int b = 12;
int c = 11;
int d = 10;

void setup(){

pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);

}

void loop(){
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
}
show more
Step 5

Upload code to Arduino

Connect Arduino with computer using USB cable.

Select "Tools"->"Board"->[Arduino board]. In our case it is Arduino Uno.

Then select "Tools"->"Serial port"->[Your serial port used for communication with Arduino]. In our case it is /dev/tty.usbmodem1411.

Click on "File"->"Upload" to upload code to Arduino.

Tutorial Forum

There are no posts here yet. Add the first post