Blog

5V 4-Channel Relay Module – Complete Guide

4-Channel Relay Module

5V 4-Channel Relay Module

Microcontroller-Controlled Switching for AC & DC Loads

A microcontroller's GPIO pins can only switch small, low-voltage, low-current logic-level loads - directly driving something like a household lamp, a water pump, or a large DC motor is simply not something a 3.3V/5V pin can do safely. A relay module bridges that gap: each of the four onboard electromechanical relays is really a small electromagnet that, when energized by a low-current signal from your microcontroller, physically pulls a set of separate, electrically isolated high-current contacts closed - meaning the switched circuit is fully separated from your control circuit, sharing no direct electrical connection at all, which is what makes it safe to switch mains AC voltage from a 5V logic signal in the first place. Most breakout boards also include an onboard opto-isolator stage between the input pin and the relay driver transistor, adding a second layer of electrical isolation and protecting your microcontroller from voltage spikes generated when the relay coil switches off.

4 Independent
Channels
up to 250V AC / 30V DC
Max Switched Load
Opto-Isolated
Isolation

Key features

Four Independent Channels

Control four separate high-power loads from four GPIO pins.

Opto-Isolated Inputs

An extra isolation stage protects your microcontroller from relay coil spikes.

Switches AC or DC

Rated for both household AC mains loads and DC loads within spec.

Active-LOW Trigger (common design)

Most boards trigger the relay when the input is pulled LOW.

Status LEDs per Channel

Visual confirmation of each relay's current switching state.

Screw Terminal Outputs

Secure, solder-free wiring for the high-current switched side.

Technical specifications

Logic Supply Voltage 5V DC
Channels 4 independent relays
Max Switched AC Load 250V AC @ 10A (per channel, typical)
Max Switched DC Load 30V DC @ 10A (per channel, typical)
Trigger Type Active-LOW (common; some boards active-HIGH)
Isolation Opto-isolator between input and relay driver
Coil Current per Relay ~70–80mA when energized
Indicator Onboard LED per channel
Package Breakout board with screw terminals (NO/COM/NC per channel)

Pinout

PinFunction
VCC / GND Logic power supply
IN1–IN4 Control inputs, one per relay channel
NO / COM / NC (per channel) Switched high-current screw terminals

Applications

Home automation light and appliance switching Automated irrigation valve and pump control Industrial equipment on/off control prototypes Multi-zone heating and cooling control Workshop tool power control Aquarium and greenhouse equipment scheduling

What's in the box

1x 5V 4-channel relay module

Downloads

Datasheet (PDF) Arduino Multi-Relay Example Sketch
🔌
Pin Connections
1 Table
Pin Connections Table 1
BoardSensor PinConnection
RelayIN1-IN44 board digital pins
📟
5V 4 Channel Relay Module
7 Examples • C/C++ | Boards: Arduino Uno, Arduino Nano, Arduino Mega, ESP32, ESP8266, STM32, Raspberry Pi Pico
5V 4 Channel Relay Module - Arduino Uno
5V 4 Channel Relay Module - Arduino Nano
5V 4 Channel Relay Module - Arduino Mega
5V 4 Channel Relay Module - ESP32
5V 4 Channel Relay Module - ESP8266
5V 4 Channel Relay Module - STM32
5V 4 Channel Relay Module - Raspberry Pi Pico
📄 File: 5v_4_channel_relay_module_-_arduino_uno.inoArduino Uno
645 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Relay IN pins on Arduino Uno: 2, 3, 4, 5. Most cheap relay boards are ACTIVE-LOW (LOW = relay energized) - check yours.
6const int NUM_RELAYS = 4;
7int relayPins[NUM_RELAYS] = {2, 3, 4, 5};
8
9void setup() {
10 for (int i = 0; i < NUM_RELAYS; i++) {
11 pinMode(relayPins[i], OUTPUT);
12 digitalWrite(relayPins[i], HIGH); // start OFF (active-low boards: HIGH = off)
13 }
14}
15
16void loop() {
17 for (int i = 0; i < NUM_RELAYS; i++) {
18 digitalWrite(relayPins[i], LOW); // turn ON
19 delay(500);
20 digitalWrite(relayPins[i], HIGH); // turn OFF
21 delay(200);
22 }
23 delay(1000);
24}
📄 File: 5v_4_channel_relay_module_-_arduino_nano.inoArduino Nano
646 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Relay IN pins on Arduino Nano: 2, 3, 4, 5. Most cheap relay boards are ACTIVE-LOW (LOW = relay energized) - check yours.
6const int NUM_RELAYS = 4;
7int relayPins[NUM_RELAYS] = {2, 3, 4, 5};
8
9void setup() {
10 for (int i = 0; i < NUM_RELAYS; i++) {
11 pinMode(relayPins[i], OUTPUT);
12 digitalWrite(relayPins[i], HIGH); // start OFF (active-low boards: HIGH = off)
13 }
14}
15
16void loop() {
17 for (int i = 0; i < NUM_RELAYS; i++) {
18 digitalWrite(relayPins[i], LOW); // turn ON
19 delay(500);
20 digitalWrite(relayPins[i], HIGH); // turn OFF
21 delay(200);
22 }
23 delay(1000);
24}
📄 File: 5v_4_channel_relay_module_-_arduino_mega.inoArduino Mega
654 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Relay IN pins on Arduino Mega: 22, 23, 24, 25. Most cheap relay boards are ACTIVE-LOW (LOW = relay energized) - check yours.
6const int NUM_RELAYS = 4;
7int relayPins[NUM_RELAYS] = {22, 23, 24, 25};
8
9void setup() {
10 for (int i = 0; i < NUM_RELAYS; i++) {
11 pinMode(relayPins[i], OUTPUT);
12 digitalWrite(relayPins[i], HIGH); // start OFF (active-low boards: HIGH = off)
13 }
14}
15
16void loop() {
17 for (int i = 0; i < NUM_RELAYS; i++) {
18 digitalWrite(relayPins[i], LOW); // turn ON
19 delay(500);
20 digitalWrite(relayPins[i], HIGH); // turn OFF
21 delay(200);
22 }
23 delay(1000);
24}
📄 File: 5v_4_channel_relay_module_-_esp32.inoESP32
647 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Relay IN pins on ESP32: 13, 14, 27, 26. Most cheap relay boards are ACTIVE-LOW (LOW = relay energized) - check yours.
6const int NUM_RELAYS = 4;
7int relayPins[NUM_RELAYS] = {13, 14, 27, 26};
8
9void setup() {
10 for (int i = 0; i < NUM_RELAYS; i++) {
11 pinMode(relayPins[i], OUTPUT);
12 digitalWrite(relayPins[i], HIGH); // start OFF (active-low boards: HIGH = off)
13 }
14}
15
16void loop() {
17 for (int i = 0; i < NUM_RELAYS; i++) {
18 digitalWrite(relayPins[i], LOW); // turn ON
19 delay(500);
20 digitalWrite(relayPins[i], HIGH); // turn OFF
21 delay(200);
22 }
23 delay(1000);
24}
📄 File: 5v_4_channel_relay_module_-_esp8266.inoESP8266
649 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Relay IN pins on ESP8266: D0, D3, D4, D5. Most cheap relay boards are ACTIVE-LOW (LOW = relay energized) - check yours.
6const int NUM_RELAYS = 4;
7int relayPins[NUM_RELAYS] = {D0, D3, D4, D5};
8
9void setup() {
10 for (int i = 0; i < NUM_RELAYS; i++) {
11 pinMode(relayPins[i], OUTPUT);
12 digitalWrite(relayPins[i], HIGH); // start OFF (active-low boards: HIGH = off)
13 }
14}
15
16void loop() {
17 for (int i = 0; i < NUM_RELAYS; i++) {
18 digitalWrite(relayPins[i], LOW); // turn ON
19 delay(500);
20 digitalWrite(relayPins[i], HIGH); // turn OFF
21 delay(200);
22 }
23 delay(1000);
24}
📄 File: 5v_4_channel_relay_module_-_stm32.inoSTM32
655 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Relay IN pins on STM32: PA0, PA1, PA2, PA3. Most cheap relay boards are ACTIVE-LOW (LOW = relay energized) - check yours.
6const int NUM_RELAYS = 4;
7int relayPins[NUM_RELAYS] = {PA0, PA1, PA2, PA3};
8
9void setup() {
10 for (int i = 0; i < NUM_RELAYS; i++) {
11 pinMode(relayPins[i], OUTPUT);
12 digitalWrite(relayPins[i], HIGH); // start OFF (active-low boards: HIGH = off)
13 }
14}
15
16void loop() {
17 for (int i = 0; i < NUM_RELAYS; i++) {
18 digitalWrite(relayPins[i], LOW); // turn ON
19 delay(500);
20 digitalWrite(relayPins[i], HIGH); // turn OFF
21 delay(200);
22 }
23 delay(1000);
24}
📄 File: 5v_4_channel_relay_module_-_raspberry_pi_pico.inoRaspberry Pi Pico
659 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// Relay IN pins on Raspberry Pi Pico: 10, 11, 12, 13. Most cheap relay boards are ACTIVE-LOW (LOW = relay energized) - check yours.
6const int NUM_RELAYS = 4;
7int relayPins[NUM_RELAYS] = {10, 11, 12, 13};
8
9void setup() {
10 for (int i = 0; i < NUM_RELAYS; i++) {
11 pinMode(relayPins[i], OUTPUT);
12 digitalWrite(relayPins[i], HIGH); // start OFF (active-low boards: HIGH = off)
13 }
14}
15
16void loop() {
17 for (int i = 0; i < NUM_RELAYS; i++) {
18 digitalWrite(relayPins[i], LOW); // turn ON
19 delay(500);
20 digitalWrite(relayPins[i], HIGH); // turn OFF
21 delay(200);
22 }
23 delay(1000);
24}
4-channel relay module.
Anything wired to the NO/COM/NC screw terminals when switching household AC mains voltage is genuinely dangerous if done incorrectly - use properly rated, insulated wire, make all mains-side connections with the power disconnected, and if you are not confident working with mains wiring, have someone qualified handle that portion. Many of these boards trigger the relay when the input pin is pulled LOW, not HIGH, which surprises people expecting a normal digitalWrite(pin, HIGH) to turn a channel on, so check your specific board's behavior before wiring logic around it. Relays audibly click and can produce brief electrical noise when switching, especially with inductive loads like motors or pumps, so keep relay wiring away from sensitive analog sensor wiring where possible to avoid interference.