
Using a 5V Relay Module (Low-Trigger) with Arduino
This tutorial explains how to use a low-trigger single-channel 5V relay module with Arduino. A relay allows you to control high-voltage or high-current devices using the low voltage logic of a microcontroller like the Arduino.
The tutorial walks through relay working principles, pinouts, wiring connections, and a demonstration using an actual electrical load. The provided code and wiring diagram are available below this article
🔍 What Is a Relay?
A relay is an electrically controlled switch. In this tutorial, we are working with a low-trigger relay, which activates when the signal pin receives 0V (LOW).
This module contains:
A magnetic coil (controlled by Arduino)
A switching mechanism (which connects or disconnects AC/DC loads)
A transistor for driving the coil
Three terminal screws: COM (common), NO (normally open), and NC (normally closed)
When the signal pin goes LOW, the coil is energized and the relay switches from its default state to its active state, allowing current to pass to the load.
⚙️ Wiring the Relay to Arduino
Connect the relay to the Arduino as follows:
VCC → 5V
GND → GND
IN (Signal) → Digital pin (e.g., D2)
For the load:
Connect one end of your light, fan, or device to the NO or NC terminal
💻 Code Explanation – Low-Trigger Relay Control
This simple Arduino sketch toggles a low-trigger 5V relay module ON and OFF in 500ms intervals. A low-trigger relay is activated when the input pin receives a LOW signal (0V), and deactivated with a HIGH signal (5V).
1. Define Relay Pin
cppCopyEditint relayPin = 8; // define output pin for relay
Pin D8 on the Arduino is designated as the output control for the relay module.
2. Setup Function
cppCopyEditvoid setup() {
pinMode(relayPin, OUTPUT); // define pin 8 as output
}
The
pinMode()
function configuresrelayPin
as an output to allow the Arduino to control it.
3. Loop Function
cppCopyEditvoid loop() {
digitalWrite(relayPin, LOW); // turn the relay ON (active LOW)
delay(500); // wait for 500 milliseconds
digitalWrite(relayPin, HIGH); // turn the relay OFF
delay(500); // wait for 500 milliseconds
}
digitalWrite(relayPin, LOW)
: Sends a LOW signal to the relay, which activates it. This closes the internal switch, powering the connected device (lamp, motor, etc.).delay(500)
: Holds the relay in its current state for 500 milliseconds.digitalWrite(relayPin, HIGH)
: Sends a HIGH signal to the relay, deactivating it (switch opens).The loop continuously repeats this ON/OFF toggling every 1 second.
🔧 Note: If you're using a high-trigger relay, reverse the logic—use
HIGH
to turn ON andLOW
to turn OFF.
This sketch is ideal for testing relays, blinking lamps, or triggering any AC/DC load in timed intervals.
🎬 Video Chapters
00:00 – Introduction
00:52 – Relay Hardware Explained
03:33 – Wiring Explained
04:42 – Code Explained
06:10 – Demonstration
📥 Download Section
You’ll find the Arduino code and wiring diagrams available for download below. This project is a building block for controlling home appliances or implementing safety shut-off mechanisms in DIY electronics.
Comments will be displayed here.