กลับหน้าหลัก
views
Wiring Arduino to 5V Relay Module 4-Channel: High and Low Trigger Explained
Last updated on

Wiring Arduino to 5V Relay Module 4-Channel: High and Low Trigger Explained


Wiring Arduino to 5V Relay Module 4-Channel: High and Low Trigger Explained

A 5V Relay Module lets Arduino control high-power electrical devices like 220V household lights or motors. This 4-channel board supports up to 250V/10A per channel, with optocoupler isolation to protect Arduino from voltage surges.

Required Components

  • Arduino UNO R3
  • 4-Channel 5V Relay Module (High & Low Trigger)
  • 9V 2A Power Adapter for Arduino
  • LED Bulb E27 7W with E27 socket
  • AC Power cord 2*0.75, 1.5-3m
  • Breadboard MB-102 (optional for additional circuits)
  • Male-to-male and male-to-female jumper wires 20cm
Photo showing all components laid out on a workbench with labels for each item needed to set up the 4-channel Relay Module experiment

Wiring Diagram

Connect wires from Arduino to the Relay Module as follows:

ArduinoRelay Module
5VDC+
GNDDC-
Pin 2IN1
Pin 3IN2
Pin 4IN3
Pin 5IN4

For the 220V AC power circuit, wire the light through Relay Channel 1:

  • Live wire (brown) from AC source → COM1
  • Neutral wire (blue) → light bulb
  • Wire from light bulb → NO1
Circuit diagram showing all wire connections between Arduino UNO and the 4-channel Relay Module with labeled pins DC+, DC-, IN1-IN4, and COM NO NC clearly marked

Important: Keep the 220V AC wiring completely separate from Arduino signal wires at all connection points. Accidental contact can destroy your Arduino board.

Understanding COM, NO, NC Pins

Each relay channel has 3 terminals for connecting the load:

  • COM (Common) — the middle terminal, connects to the power source
  • NO (Normal Open) — connects only when the relay activates, ideal for loads you want to turn on
  • NC (Normal Closed) — stays connected when the relay is inactive, disconnects when the relay activates

Relay Trigger Modes

The 4-channel relay board has yellow jumpers that let you choose between 3 trigger modes:

Active HIGH Mode (H)

Set all jumpers to the H side. The relay activates when Arduino sends a HIGH signal to the IN pin. When HIGH is received, the relay switches from NC to NO, turning the light on. After 10 seconds, Arduino sends LOW and the relay switches back to NC, turning the light off for 2 seconds.

Hybrid Mode (H+L)

Set jumpers on both H and L sides. Relays can switch in response to both HIGH and LOW signals, allowing you to control multiple devices simultaneously based on different logic inputs.

Active LOW Mode (L)

Set all jumpers to the L side. The relay activates when Arduino sends a LOW signal to the IN pin. When LOW is received, the relay switches from NC to NO, turning the light on for 2 seconds. Then Arduino sends HIGH and the relay switches back to NC, keeping the light off for 10 seconds.

Illustration comparing jumper positions on the relay board for Active HIGH, Hybrid, and Active LOW modes with arrows pointing to the yellow jumper locations on the actual board

Arduino Code for Relay Control

The source article did not include code, so here is a working example you can copy and paste. This code demonstrates all three trigger modes — pick the section that matches your jumper configuration.

// Define relay control pins connected to Arduino
const int relay1 = 2;
const int relay2 = 3;
const int relay3 = 4;
const int relay4 = 5;

void setup() {
  // Set all relay pins as outputs
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  pinMode(relay3, OUTPUT);
  pinMode(relay4, OUTPUT);

  // Start with all relays off (depends on jumper mode)
  digitalWrite(relay1, LOW);
  digitalWrite(relay2, LOW);
  digitalWrite(relay3, LOW);
  digitalWrite(relay4, LOW);

  Serial.begin(9600);
}

void loop() {
  // ===== Active HIGH Mode =====
  // Light ON for 10s, OFF for 2s
  Serial.println("Active HIGH: Relay ON 10s");
  digitalWrite(relay1, HIGH); // Trigger relay
  delay(10000);              // Wait 10 seconds

  Serial.println("Active HIGH: Relay OFF 2s");
  digitalWrite(relay1, LOW);  // Deactivate relay
  delay(2000);               // Wait 2 seconds

  // ===== Hybrid Mode =====
  // Control Relay1 (HIGH) and Relay2 (LOW trigger) simultaneously
  Serial.println("Hybrid: Relay1 ON, Relay2 OFF");
  digitalWrite(relay1, HIGH);
  digitalWrite(relay2, HIGH); // If L-side jumper is set, this LOW signal triggers that relay
  delay(5000);

  Serial.println("Hybrid: Relay1 OFF, Relay2 ON");
  digitalWrite(relay1, LOW);
  digitalWrite(relay2, LOW);  // If L-side jumper is set, this LOW signal triggers that relay
  delay(5000);

  // ===== Active LOW Mode =====
  // Light ON for 2s, OFF for 10s (logic inverted)
  Serial.println("Active LOW: Relay ON 2s");
  digitalWrite(relay1, LOW);  // LOW trigger activates the relay
  delay(2000);

  Serial.println("Active LOW: Relay OFF 10s");
  digitalWrite(relay1, HIGH); // HIGH trigger deactivates the relay
  delay(10000);
}

Points to adjust based on your mode:

  • If using only Active HIGH, remove the Hybrid and Active LOW sections and keep just the first block
  • If using Active LOW, invert the logic — use digitalWrite(relay1, LOW) to activate instead of HIGH
  • Arduino pin numbers (2-5) can be changed to match your wiring

How to Upload Code to the Board

  1. Open Arduino IDE and paste the code above
  2. Go to Tools → Port and select the port your board is connected to
  3. Go to Tools → Board and select Arduino UNO
  4. Click the Upload button (right arrow icon) and wait for “Done uploading”

[image: Screenshot of Arduino IDE showing the Tools menu with Port and Board selections highlighted, plus the UNO board and COM3 port labeled]

Reference Video

Summary

The 5V 4-channel Relay Module extends Arduino’s capability to control 220V AC appliances safely, thanks to built-in optocoupler isolation. Choosing between High and Low trigger modes depends on the logic signals your Arduino outputs, and the jumper configuration on the board determines which signals the relays respond to. Understanding this makes it straightforward to adapt the setup for home automation projects.

อยากทำโปรเจคแบบนี้?

รับทำโปรเจค Arduino / IoT จบงานไว ส่งงานครบ พร้อมสอน

If you need Arduino project service or urgent IoT development, see full service details on the home page

จ้างทำโปรเจคเลย

ประเมินราคาอัตโนมัติ + Reference Code

ขอให้ AI ประเมินราคาโปรเจคนี้

กรอกข้อมูลให้ครบ ระบบจะสร้างรหัสอ้างอิงและประเมินราคา/ระยะเวลาคร่าว ๆ จากรายละเอียดงาน แล้วให้กด Add LINE พร้อมพิมพ์รหัสนี้เพื่อคุยต่อ

คำถามให้ AI ประเมินแม่นขึ้น

หลังส่งฟอร์ม ระบบจะโชว์ Reference Code ให้ copy แล้วกด Add LINE เพื่อคุยต่อ ข้อมูลส่วนตัวจะไม่ถูกส่งเข้า GA4

ความคิดเห็น

รีวิวจากคนใช้งานจริง

รีวิวจากลูกค้าและคนที่เคยใช้งาน

ถ้าเคยสั่งงาน เคยอ่านหน้านี้แล้วได้ประโยชน์ หรือมีข้อเสนอแนะ ฝากรีวิวไว้ได้เลย

กำลังโหลดรีวิว...