4 Channel 5V Relay Module

Aus Aptofun WIKI
Version vom 4. Juni 2019, 23:55 Uhr von Webmasters (Diskussion | Beiträge) (Resource)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche


This is a 5V 4-channel relay interface board, and each channel needs a 15-20mA driver current. It can be used to control various appliances and equipment with large current. It is equiped with high-current relays that work under AC250V 10A or DC30V 10A. It has a standard interface that can be controlled directly by microcontroller.


From the picture below, you can see that when the signal port is at low level, the signal light will light up and the optocoupler 817c (it transforms electrical signals by light and can isolate input and output electrical signals) will conduct, and then the transistor will conduct, the relay coil will be electrified, and the normally open contact of the relay will be closed. When the signal port is at high level, the normally closed contact of the relay will be closed. So you can connect and disconnect the load by controlling the level of the control signal port.
4 channel relay schematic.png

4 channel relay PCB.png

Pin Description


VCC: Positive supply voltage
GND: Ground
IN1--IN4: Relay control port


Connect a load, DC 30V/10A,AC 250V/10A


  • Size: 75mm (Length) * 55mm (Width) * 19.3mm (Height)
  • Weight: 61g
  • PCB Color: Blue
  • There are four fixed screw holes at each corner of the board, easy for install and fix. The diameter of the hole is 3.1mm
  • High quality Songle relay is used with single pole double throw, a common terminal, a normally open terminal, and a normally closed terminal
  • Optical coupling isolation, good anti-interference.
  • Closed at low level with indicator on, released at high level with indicator off
  • VCC is system power source, and JD_VCC is relay power source. Ship 5V relay by default. Plug jumper cap to use
  • The maximum output of the relay: DC 30V/10A, AC 250V/10A

Testing Experiment

Experiment Principle

When the input terminals (IN1, IN2, IN3, IN4) are supplied with low level signals, you can see relay K1, K2, K3, K4 closed successively and repeat this cycle. In order to show its the ability of driving load more intuitively, two LEDs are connected to relay K1 and K2.

Experiment Steps

Build the circuit

4 Channel relay shield SunFounder uno R3
IN1 3
IN2 4
IN3 5
IN4 6

Then upload the code. You should see the relays close one by one and the LED on the board and the LEDs connected to K1 and K2 light up or go out with the relays opened or closed.
4 Channels relay0201.png

 1 //the relays connect to
 2 int IN1 = 3;
 3 int IN2 = 4;
 4 int IN3 = 5;
 5 int IN4 = 6;
 6 #define ON   0
 7 #define OFF  1
 8 void setup() 
 9 {
10   relay_init();//initialize the relay
11 }
13 void loop() {
15   relay_SetStatus(ON, OFF, OFF,OFF);//turn on RELAY_1 
16   delay(2000);//delay 2s
17   relay_SetStatus(OFF, ON, OFF,OFF);//turn on RELAY_2
18   delay(2000);//delay 2s
19   relay_SetStatus(OFF, OFF, ON,OFF);//turn on RELAY_3
20   delay(2000);//delay 2s
21   relay_SetStatus(OFF, OFF, OFF,ON);//turn on RELAY_3
22   delay(2000);//delay 2s
23 }
24 void relay_init(void)//initialize the relay
25 {  
26   //set all the relays OUTPUT
27   pinMode(IN1, OUTPUT);
28   pinMode(IN2, OUTPUT);
29   pinMode(IN3, OUTPUT);
30   pinMode(IN4, OUTPUT);
31   relay_SetStatus(OFF,OFF,OFF,OFF);//turn off all the relay
32 }
33 //set the status of relays
34 void relay_SetStatus( unsigned char status_1,  unsigned char status_2, unsigned char status_3,unsigned char status_4)
35 {
36   digitalWrite(IN1, status_1);
37   digitalWrite(IN2, status_2);
38   digitalWrite(IN3, status_3);
39   digitalWrite(IN4, status_4);
41 }


You can use this 4-channel relay to drive some household appliances, such as table lamp, fan, etc.