Relay Module Guide: Wiring, Pinout & Arduino Projects
Relay modules are one of the most widely used interface boards in embedded systems. They allow low-voltage microcontrollers like Arduino, ESP32, Raspberry Pi, and STM32 to safely control AC and DC electrical loads.
In this guide, you'll learn how relay modules work, understand COM, NO, and NC terminals, wire them correctly, and discover where they are commonly used.
What Is a Relay Module?
A relay module is an electrically operated switch that allows a microcontroller to control another circuit while keeping the two circuits electrically isolated.
Typical applications include:
- Home automation
- Smart lighting
- Water pump control
- Industrial automation
- Robotics
- IoT projects
How a Relay Module Works
When the relay input receives a signal from the controller, the internal coil becomes energized.
The electromagnetic field moves the relay contacts between their normal positions.
This allows the controller to switch an external circuit without directly supplying the required voltage or current.
Relay Module Pinout
Most relay modules include:
Control Side
- VCC
- GND
- IN
Load Side
- COM
- NO
- NC
Some modules use High-Level Trigger, while others use Low-Level Trigger, so always verify your module before wiring.
Wiring with Arduino or ESP32
Typical connections:
| Relay Module | Arduino |
|---|---|
| VCC | 5V |
| GND | GND |
| IN | Digital Pin |
After wiring, the controller only needs to change one GPIO pin to switch the relay.
Example Arduino Code
const int relayPin = 7;
void setup() {
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH);
delay(1000);
digitalWrite(relayPin, LOW);
delay(1000);
}
If your relay module is Low-Level Trigger, simply reverse the HIGH and LOW logic.
Common Applications
Relay modules are commonly used for:
- Smart home systems
- Water pump automation
- Industrial control
- Lighting control
- Security systems
- Robotics
- IoT projects
Safety Tips
Always remember:
- Disconnect power before wiring.
- Never exceed the relay's rated current or voltage.
- Keep AC wiring isolated from low-voltage electronics.
- Double-check connections before powering the circuit.
Conclusion
Relay modules are one of the first hardware interfaces every embedded developer should learn.
Once you understand their wiring and operation, you'll be able to safely control external devices from your Arduino, ESP32, Raspberry Pi, or other microcontrollers.
Learn More
📖 GitHub Documentation
🌐 Chip.pk Knowledge Hub
https://www.chip.pk/blogs/chip-pk-knowledge-hub
🛒 Official Website





Top comments (0)