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.
Video walkthrough
Prefer to watch? These cover the same steps.
Community videos. Tishvi is not affiliated with creators.
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.
×4, one per channel
~70-80mA per relay
10A @ 30V DC
One per channel
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.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.
Control-Side Wiring to Arduino UNO R3
6 wires: GND, IN1-IN4, and VCC. Digital pins D2-D5 drive the four channels.
| Relay Module Pin | Connect to Arduino | Wire Colour | Notes |
|---|---|---|---|
| VCC | 5V | ■ Red | Powers the opto-isolator side, and JD-VCC while the jumper is installed |
| GND | GND | ■ Black | Common ground — required for the IN signals to register correctly |
| IN1 | Pin D2 | ■ Blue | Controls relay K1 — typically LOW = ON (verify in Step 6) |
| IN2 | Pin D3 | ■ Blue | Controls relay K2 |
| IN3 | Pin D4 | ■ Blue | Controls relay K3 |
| IN4 | Pin D5 | ■ Blue | Controls relay K4 |
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:
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.
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.
Wiring the Output: NO / COM / NC
Each channel has 3 screw terminals — this is the side that actually switches your appliance.
| Terminal | Meaning | Behaviour |
|---|---|---|
| COM | Common | Connect one wire from your power source (or one leg of your AC supply) here |
| NO | Normally Open | Disconnected from COM by default; connects to COM only while the relay is energised. Used by most projects — "on when triggered." |
| NC | Normally Closed | Connected 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.
Test Each Relay — Cycle Sketch
Confirms wiring and trigger polarity before you build anything on top of it.
// 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); } }
RELAY_ACTIVE_LOW = false and re-upload.Project: Serial Command Relay Controller
Toggle any channel individually by typing a digit into Serial Monitor.
// 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"); } } }
Serial commands for an HC-05 Bluetooth link (see the HC-05 guide) to control relays wirelessly instead.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.
.ino file. No external libraries are needed — only built-in Arduino functions are used.Next Steps
What to build with switching control next.
HC-05 + Relay Module
Send "1", "2", "3", "4" over Bluetooth from your phone instead of Serial Monitor — a wireless appliance switch.
ESP32 + Relay Module
Control relays over Wi-Fi from anywhere on your network — a simple starting point for home automation.
Motion-Triggered Relay
Wire an HC-SR04 distance sensor alongside the relay module — switch a load automatically when something gets close.