4 Channel Relay Module using Arduino Uno

4 Channel Relay Module with Arduino UNO – Full Tutorial | MakeMindz
Home Automation Arduino UNO Relay Module Beginner Friendly

4-Channel Relay Module with Arduino UNO

Control four independent AC or DC appliances using a microcontroller. Learn relay interfacing, digital output control, and safe high-voltage switching — with complete code, wiring, and simulation.

What You'll Build

An Arduino-controlled switching system that lets you independently turn ON and OFF four high-voltage loads — bulbs, fans, motors, or any AC/DC appliance — using low-power 5V digital signals. The circuit was designed and simulated using Cirkit Designer.

Difficulty

Beginner

⏱️

Build Time

30–60 Minutes

💡

Loads Controlled

4 Channels

🔌

Supply Voltage

5V (Arduino)

What You'll Learn

01
Control four devices independently

Each relay channel is wired to a separate Arduino digital pin, giving you full individual control over every load.

02
Understand relay interfacing with a microcontroller

Learn how a LOW or HIGH signal from an Arduino pin energises a relay coil to switch the mechanical contact.

03
Master digital output control in Arduino

Use pinMode(), digitalWrite(), and delay() to sequence relay switching with precise timing.

How a Relay Works

A relay is an electromechanical switch that lets a low-voltage circuit (Arduino 5V) safely control high-voltage appliances (up to 230V AC or 12V DC). Most 4-channel modules include an optocoupler for electrical isolation between the Arduino and the high-voltage side.

The 5-Step Switching Sequence

1
Arduino outputs HIGH or LOW

A digital write to pins 2–5 sends a 5V or 0V signal to the relay module's IN terminals.

2
Relay module receives the signal

The optocoupler isolates the Arduino from the relay coil driver transistor.

3
Relay coil energises

Current flows through the coil, generating a magnetic field strong enough to pull the internal armature.

4
Internal switch changes position

The armature moves, shifting the COM contact away from NC (Normally Closed) to NO (Normally Open).

5
Appliance turns ON or OFF

The connected load is either energised (COM→NO) or de-energised depending on your wiring choice.

Relay Terminal Reference

COM — Common

Always connected to your power supply line. This is the shared terminal for both NO and NC contacts.

NO — Normally Open

Open (disconnected) when relay is OFF. Closes when the coil is energised. Use for devices you want ON when triggered.

NC — Normally Closed

Closed (connected) when relay is OFF. Opens when coil energises. Use for fail-safe circuits that must stay ON by default.

⚠️
High Voltage Warning: The COM/NO/NC terminals handle mains AC voltage (230V). Never touch these terminals while powered. Always wire the high-voltage side before connecting to mains, and use a properly insulated enclosure.

Components Required

ComponentQtyNotes
Arduino UNO (R3)×1Main controller — runs all switching logic
4-Channel Relay Module (5V)×1Optocoupler-isolated, active-LOW or active-HIGH (check your module)
Jumper Wires (M-M, M-F)×15+For all signal and power connections
5V USB / DC Power Supply×1Powers Arduino (and relay module via Arduino 5V pin)
AC/DC Loads×4Bulb, fan, motor, LED strip — one per channel
Insulated wire (for AC side)Rated for mains voltage if using 230V AC loads
💡
Active-LOW vs Active-HIGH: Most blue 4-channel relay modules are active-LOW — the relay triggers when the IN pin receives LOW (0V), not HIGH. In the code below, sending HIGH turns the relay OFF and LOW turns it ON. Check your module's datasheet and swap logic if needed.


 

Wiring Diagram

relay_arduino_uno.json — Circuit Overview
4-Channel Relay Module + Arduino UNO — Wiring Overview ARDUINO UNO 5V → Relay VCC GND → Relay GND D2 → IN1 D3 → IN2 D4 → IN3 D5 → IN4 4-CHANNEL RELAY Input Side (Low Voltage) VCC — 5V from Arduino GND — Ground IN1 — Arduino D2 IN2 — Arduino D3 IN3 — Arduino D4 IN4 — Arduino D5 Output Side (High Voltage) COM / NO / NC ×4 → AC 230V or DC 12V loads CH1 — Bulb / Fan COM → Live | NO → Load Neutral → Load return CH2 — Motor / Pump COM → Live | NO → Load Neutral → Load return CH3 — Heater / Valve COM → Live | NO → Load Neutral → Load return CH4 — LED / Strip COM → Live | NO → Load Neutral → Load return 5V USB / DC POWER Powers Arduino → Arduino powers relay VCC Max relay coil draw ≈ 70mA × 4 = 280mA LEGEND 5V Power (red) IN1–IN4 Signal Lines High-Voltage Output GND (black)

Pin Connection Table

Power Connections

5V→ Relay module VCC
GND→ Relay module GND

Signal Connections

D2→ IN1 (Channel 1)
D3→ IN2 (Channel 2)
D4→ IN3 (Channel 3)
D5→ IN4 (Channel 4)

Load Wiring (per channel)

COM→ Live / Supply positive
NO→ One terminal of load
Neutral→ Other terminal of load

Step-by-Step Instructions

1

Gather All Components

Collect your Arduino UNO, 4-channel relay module, jumper wires, power supply, and test loads (LEDs or light bulbs). Ensure your relay module is rated for 5V coil voltage and matches your load's voltage and current requirements.

2

Connect Power to the Relay Module

  • Relay module VCC → Arduino 5V pin
  • Relay module GND → Arduino GND pin
⚠️
If using all 4 relays simultaneously, the total coil current can reach ~280mA. For reliable operation, power the relay module from an external 5V supply and share a common GND with the Arduino.
3

Connect Signal (Control) Wires

  • Relay IN1 → Arduino D2
  • Relay IN2 → Arduino D3
  • Relay IN3 → Arduino D4
  • Relay IN4 → Arduino D5

Use male-to-female jumper wires. Ensure no bare wire ends are exposed.

4

Wire Your Loads (High-Voltage Side)

For each channel, connect your load between the COM and NO terminals. The other end of the load goes to Neutral (for AC) or Ground (for DC).

🔴
AC Mains Safety: Always wire the AC side with the mains power disconnected. Use properly insulated cables. Never work on live wires. If unsure, use a 12V DC load for testing first.
5

Install Arduino IDE & Open Sketch

Download the Arduino IDE from arduino.cc. No additional libraries are needed — this project uses only built-in Arduino functions.

6

Upload the Code

Copy the full sketch from the Code section below. Connect Arduino via USB, select Board → Arduino UNO and the correct Port, then click Upload (→ arrow icon).

7

Power On and Test

After uploading, power on the system. You should hear each relay click in sequence every 1 second — Relay 1 → Relay 2 → Relay 3 → Relay 4 → repeat. Each connected load should turn ON then OFF in turn.

  • If no click: check VCC/GND wiring and verify 5V at the module
  • If all relays trigger at once: you may have an active-LOW module — invert your HIGH/LOW logic
  • If load doesn't switch: verify COM/NO wiring on the output side

Full Source Code

relay_4channel.ino
// ─────────────────────────────────────────────────────
// 4-Channel Relay Module with Arduino UNO
// MakeMindz.com | Controls 4 loads independently
// Simulated with Cirkit Designer
// ─────────────────────────────────────────────────────

// Define relay control pins
const int relay1 = 2;   // IN1 → Channel 1
const int relay2 = 3;   // IN2 → Channel 2
const int relay3 = 4;   // IN3 → Channel 3
const int relay4 = 5;   // IN4 → Channel 4

// ── setup() ──────────────────────────────────────────
// Runs once on power-up or reset
void setup() {
  // Configure all relay pins as digital outputs
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  pinMode(relay3, OUTPUT);
  pinMode(relay4, OUTPUT);

  // Ensure all relays start in the OFF state
  // (HIGH = OFF for active-LOW modules)
  digitalWrite(relay1, HIGH);
  digitalWrite(relay2, HIGH);
  digitalWrite(relay3, HIGH);
  digitalWrite(relay4, HIGH);
}

// ── loop() ───────────────────────────────────────────
// Repeats forever: toggles each relay ON for 1s, then OFF
void loop() {

  // ── Relay 1 (Channel 1) ──────────────────────────
  digitalWrite(relay1, HIGH);   // Turn ON  (LOW for active-LOW modules)
  delay(1000);                   // Wait 1 second
  digitalWrite(relay1, LOW);    // Turn OFF
  delay(1000);                   // Wait 1 second

  // ── Relay 2 (Channel 2) ──────────────────────────
  digitalWrite(relay2, HIGH);
  delay(1000);
  digitalWrite(relay2, LOW);
  delay(1000);

  // ── Relay 3 (Channel 3) ──────────────────────────
  digitalWrite(relay3, HIGH);
  delay(1000);
  digitalWrite(relay3, LOW);
  delay(1000);

  // ── Relay 4 (Channel 4) ──────────────────────────
  digitalWrite(relay4, HIGH);
  delay(1000);
  digitalWrite(relay4, LOW);
  delay(1000);

  // After all 4 cycles, the loop restarts from Relay 1
}
💡
Active-LOW modules: If your relay module triggers on LOW signal (most blue modules), swap HIGH and LOW in the loop() function. Set pins HIGH in setup() to keep relays off at startup.

Test Without Hardware

🧪

Simulate in your browser — no relay or Arduino required

Use Wokwi or Cirkit Designer to visualise the circuit. Load the diagram.json above into Wokwi, paste the code, and press Run to see the relay logic execute with LED indicators for each channel.

🔵
Wokwi tip: After importing diagram.json, create a new file sketch.ino and paste the code. The relay module is available as wokwi-relay-module. LEDs replace real loads since Wokwi doesn't simulate AC mains for safety.

Key Features

🔀

4 Independent Channels

Each relay is fully independent — different loads, different timings, full control.

🛡️

Electrical Isolation

Built-in optocoupler separates the Arduino signal side from the high-voltage load side.

Safe High-Voltage Switching

Switch 230V AC or 12V DC loads safely using just 5V Arduino digital signals.

🏠

Home Automation Ready

Foundation for smart home projects — add Bluetooth, WiFi, or RFID for remote control.

Applications

🏠

Home Automation

Control lights, fans, and appliances from a central Arduino system.

🌱

Smart Irrigation

Schedule water pumps based on soil moisture sensor readings.

🏭

Industrial Automation

Sequence solenoids, motors, and actuators in production lines.

📡

IoT Smart Switches

Combine with ESP8266/ESP32 for Wi-Fi controlled switching from any device.

Related Projects

© 2026 MakeMindz — Arduino, IoT & Robotics Tutorials

Built with ❤️ for makers, students, and engineers.

Comments

try for free