/ 4-Channel Relay Module Guide
← All Guides
🌐 Translate:
⏱ 25 min 🔌 6 wires ✅ Beginner (DC loads)

4-Channel Relay
Module Setup Guide

Switch lamps, motors, pumps, and mains-powered appliances on and off from your Arduino. Covers control-side wiring, the JD-VCC isolation jumper, output terminal wiring, and the safety practices you need before touching anything mains-powered.

🚫
Mains voltage warning. This module's contacts are rated up to 250V AC / 10A — enough to be lethal if handled carelessly. If you're not experienced with mains wiring, practise first with a low-voltage DC load (e.g. a 12V lamp or motor on its own supply) before connecting anything to household AC. Always disconnect mains power before wiring or rewiring the output terminals, and never touch the screw terminals while the module is live.
📺

Video walkthrough

Prefer to watch? These cover the same steps.

How to Use a 4-Channel Relay to Control an AC Load with Arduino
Robojax · YouTube
▶ YouTube
How to Interface a 5V 4-Channel Relay Module with Arduino
MYTECTUTOR · YouTube
▶ YouTube

Community videos. Tishvi is not affiliated with creators.

1

How the Relay Module Works

An Arduino-safe control signal switching a completely separate, higher-power circuit.

Each channel is an electromechanical relay — a small electromagnet that pulls a physical switch contact closed when energised. Your Arduino never touches the switched circuit directly. Instead, a logic signal on an INx pin passes through a PC817 optocoupler (an LED shining onto a phototransistor, with no electrical connection between the two sides) before reaching a transistor driver that energises the relay coil. This keeps your Arduino's 5V logic completely isolated from whatever voltage the relay is switching on the output side.

🔧
Relay Model
Songle SRD-05VDC-SL-C
×4, one per channel
⚡
Coil Voltage
5V DC
~70-80mA per relay
🔌
Switching Capacity
10A @ 250V AC
10A @ 30V DC
🛡️
Isolation
4× PC817 optocouplers
One per channel
💡
Trigger polarity: Boards built this way (opto-isolator + transistor driver, status LEDs D1-D4) are almost always LOW-level triggered — sending LOW to an IN pin turns that relay ON, and HIGH turns it OFF. A small number of boards are wired the opposite way. Step 6 gives you a safe way to check which kind you have.
2

What You Need

Start with a low-voltage load — save mains wiring for once you're confident.

✓

Tishvi Arduino UNO R3

Any variant (DIP or SMD). Must have Arduino IDE installed. See the UNO R3 Setup Guide first if needed.

✓

4-Channel Relay Module (Songle SRD-05VDC-SL-C)

6-pin control header (GND, IN1-IN4, VCC), a 3-pin JD-VCC jumper block, and 4× 3-pin screw terminals (NO/COM/NC) for the outputs.

✓

6× Male-to-Male Jumper Wires

For the control header connection to the Arduino.

○

Recommended for testing: a low-voltage DC load

A 12V DC lamp, small motor, or LED strip with its own external power supply. Wire this to a relay's NO/COM terminals first, before attempting any mains-voltage load.

○

Optional: separate 5V supply for the relay coils

Needed only if you remove the JD-VCC jumper — see Step 4. Not required for basic use.

3

Control-Side Wiring to Arduino UNO R3

6 wires: GND, IN1-IN4, and VCC. Digital pins D2-D5 drive the four channels.

ARDUINO UNO R3 5V GND D2 D3 D4 D5 4-CH RELAY MODULE GND IN1 IN2 IN3 IN4 VCC K1 (D1) K2 (D2) K3 (D3) K4 (D4) IN1 = LOW → K1 energised (red LED lit) VCC JD-VCC GND JUMPER (installed) Bridges VCC+JD-VCC — see Step 4 K1 OUTPUT NO COM NC K2-K4 identical LAMP 12V DC SUPPLY + − Example: 12V DC load via COM+NO — see Step 5 VCC (Red) GND (Black) D2 → IN1 (Blue) D3 → IN2 (Blue) D4 → IN3 (Blue) D5 → IN4 (Blue)
Relay Module PinConnect to ArduinoWire ColourNotes
VCC5V■ RedPowers the opto-isolator side, and JD-VCC while the jumper is installed
GNDGND■ BlackCommon ground — required for the IN signals to register correctly
IN1Pin D2■ BlueControls relay K1 — typically LOW = ON (verify in Step 6)
IN2Pin D3■ BlueControls relay K2
IN3Pin D4■ BlueControls relay K3
IN4Pin D5■ BlueControls relay K4
⚠️
Set IN pins HIGH before pinMode(OUTPUT). Digital pins can briefly float LOW while the Arduino boots, which can flash relays on for a moment if your board is LOW-triggered. The sample sketches in this guide set every IN pin to its OFF state first, before anything else runs.
4

Understanding the JD-VCC Jumper

Decides whether the relay coils share power with your Arduino, or get their own supply.

The 3-pin block (VCC, JD-VCC, GND) has a small removable shorting jumper cap. It controls where the relay coils get their power from, separately from the logic/optocoupler side:

1

Jumper installed (factory default)

VCC and JD-VCC are bridged together, so a single 5V supply — the Arduino's 5V pin — powers both the optocoupler LEDs (control side) and the relay coils. Simplest setup, and what this guide uses by default. Fine for occasional single-relay switching.

2

Jumper removed

VCC (control side) and JD-VCC (relay coil side) become independent. Feed JD-VCC from a separate 5V supply rated for the total coil current — 4 relays draw roughly 300mA combined when all energised. Keep the external supply's GND tied to the Arduino's GND, since the IN signals still need a shared ground reference to switch correctly.

💡
When to remove the jumper: if your Arduino resets or the USB port complains when relays switch (a sign the onboard 5V regulator is being asked for more current than it can supply), or if you want to keep electrically noisy relay-coil switching away from your logic-level 5V rail.
5

Wiring the Output: NO / COM / NC

Each channel has 3 screw terminals — this is the side that actually switches your appliance.

TerminalMeaningBehaviour
COMCommonConnect one wire from your power source (or one leg of your AC supply) here
NONormally OpenDisconnected from COM by default; connects to COM only while the relay is energised. Used by most projects — "on when triggered."
NCNormally ClosedConnected to COM by default; disconnects when the relay is energised. Used for fail-safe logic — "on until triggered."

For a simple "switch a load on when triggered" project, wire your load in series between the power supply and COM + NO — exactly as shown for K1 in the Step 3 diagram, using a low-voltage DC lamp or motor. Channels K2-K4 have identical NO/COM/NC terminals.

🚫
Working with AC mains (230V in India): Disconnect the wall socket before wiring anything. Never touch the screw terminals, wires, or relay body while the module is connected to mains — the output side of an energised relay carries full mains voltage. Use an enclosure so nothing is exposed to accidental touch. Stay within the 10A / 250V AC rating; for higher-current appliances, use the relay to switch a contactor instead of the appliance directly. If you have any doubt about your wiring, have it checked by someone experienced with mains electrics before switching it on.
⚠️
DC loads have their own limit: 10A at 30V DC. Inductive DC loads (motors, solenoids, relay coils) generate a voltage spike when switched off — for anything beyond a small motor, add a flyback diode across the load to protect the relay contacts.
6

Test Each Relay — Cycle Sketch

Confirms wiring and trigger polarity before you build anything on top of it.

relay4ch_cycle_test.ino
// 4-Channel Relay Module — Cycle Test
// Tishvi Docs · Wiring: VCC→5V | GND→GND | IN1..IN4→D2..D5
// Turns on relay K1, then K2, then K3, then K4, one at a time.

const int relayPins[4] = {2, 3, 4, 5}; // IN1..IN4

// Most boards in this family are LOW-level triggered.
// If your relays behave backwards, change this to false.
const bool RELAY_ACTIVE_LOW = true;

void relayWrite(int pin, bool on) {
  bool level = RELAY_ACTIVE_LOW ? !on : on;
  digitalWrite(pin, level ? HIGH : LOW);
}

void setup() {
  Serial.begin(9600);
  for (int i = 0; i < 4; i++) {
    pinMode(relayPins[i], OUTPUT);
    relayWrite(relayPins[i], false); // start OFF, before anything else
  }
  Serial.println("Cycling K1 -> K2 -> K3 -> K4...");
}

void loop() {
  for (int i = 0; i < 4; i++) {
    Serial.print("K");
    Serial.print(i + 1);
    Serial.println(" ON");
    relayWrite(relayPins[i], true);
    delay(1000);
    relayWrite(relayPins[i], false);
    delay(300);
  }
}
✅
Upload this and watch the status LEDs (D1-D4) light up in sequence, one relay clicking at a time. If a relay energises when you expected it OFF (or vice versa), set RELAY_ACTIVE_LOW = false and re-upload.
7

Project: Serial Command Relay Controller

Toggle any channel individually by typing a digit into Serial Monitor.

relay4ch_serial_control.ino
// 4-Channel Relay Module — Serial Command Control
// Type 1, 2, 3, or 4 in Serial Monitor to toggle that relay.
// Wiring: VCC→5V | GND→GND | IN1..IN4→D2..D5

const int relayPins[4] = {2, 3, 4, 5};
bool relayState[4] = {false, false, false, false};
const bool RELAY_ACTIVE_LOW = true; // flip if your board triggers HIGH

void relayWrite(int pin, bool on) {
  bool level = RELAY_ACTIVE_LOW ? !on : on;
  digitalWrite(pin, level ? HIGH : LOW);
}

void setup() {
  Serial.begin(9600);
  for (int i = 0; i < 4; i++) {
    pinMode(relayPins[i], OUTPUT);
    relayWrite(relayPins[i], false);
  }
  Serial.println("Send 1, 2, 3, or 4 to toggle that relay.");
}

void loop() {
  if (Serial.available()) {
    char c = Serial.read();
    if (c >= '1' && c <= '4') {
      int idx = c - '1';
      relayState[idx] = !relayState[idx];
      relayWrite(relayPins[idx], relayState[idx]);

      Serial.print("K");
      Serial.print(idx + 1);
      Serial.println(relayState[idx] ? " -> ON" : " -> OFF");
    }
  }
}
💡
Open Serial Monitor at 9600 baud, set line ending to "No line ending", and type a single digit to send it instantly. Swap the Serial commands for an HC-05 Bluetooth link (see the HC-05 guide) to control relays wirelessly instead.
8

Troubleshooting

Common problems and fixes.

?

Relay clicks but the connected load doesn't switch

The relay itself is working — the issue is almost always output wiring. Confirm the load is wired to COM + NO (not NC), and that the load's own power source is actually connected.

?

Relays trigger backwards from what you expect

Your board may be HIGH-level triggered rather than the more common LOW-level. Set RELAY_ACTIVE_LOW = false in the sketch and re-upload.

?

All relays click briefly when the Arduino powers on

IN pins can float LOW for a moment before setup() runs on a LOW-triggered board. Both sample sketches set every pin to its OFF state immediately in setup() — make sure you haven't reordered that code.

?

Arduino resets or the USB port misbehaves when a relay switches

The relay coils can briefly pull more current than the Arduino's onboard 5V regulator likes supplying, especially with multiple relays. Remove the JD-VCC jumper and power the coil side from a separate 5V supply — see Step 4.

?

Status LED lights up but the output still doesn't switch

Check for a loose screw terminal, a broken load wire, or the load exceeding the relay's 10A rating (which can weld or damage the contacts over time).

?

Relay buzzes loudly, smells hot, or trips a breaker

Stop immediately and disconnect from mains. This usually means the load's current or voltage exceeds the relay's 10A / 250V AC rating, or there's a wiring fault on the output side. Re-check against the load's own rated specifications before reconnecting.

⬇

Download Sample Sketch

Get a ready-to-upload .ino file for the 4-channel relay module.

Download the complete sample sketch below — it includes wiring comments, the trigger-polarity safeguard, the cycle test, and the Serial Monitor command controller, all in one file. Ready to upload without any changes.

📄
relay4ch_sample.ino
Cycle test · Serial command control · Trigger-polarity safeguard · No libraries needed
⬇ Download .ino
💡
How to open: In Arduino IDE go to File → Open and select the downloaded .ino file. No external libraries are needed — only built-in Arduino functions are used.