Relays are widely used in electronics and automation to control electrical circuits using electrical signals. They are useful when a controller needs to switch a separate circuit without directly carrying its load current through a microcontroller pin.
![]() |
| 4-channel relay module. |
A 4-channel relay module combines four relay channels on one board. Each channel can be controlled independently by a compatible microcontroller, such as an Arduino, subject to the module's electrical requirements.
In this tutorial, we will explore how a relay module works, understand its terminals, connect a compatible module to an Arduino Uno, and write a simple program to operate a relay.
- What a 4-channel relay module does
- How electromechanical relays operate
- The difference between COM, NO and NC
- How to connect a compatible module to Arduino
- How to write a basic relay control program
- Common applications and troubleshooting techniques
- Important power supply and electrical safety considerations
1. What Is a 4-Channel Relay Module?
A relay is an electrically operated switch. In an electromechanical relay, current flowing through a coil creates a magnetic field that moves an internal contact mechanism.
A 4-channel relay module contains four separate relay channels, allowing a controller to operate several outputs from one board.
Many modules also include driver transistors, protection components and indicator LEDs. Some designs include optocouplers, but not every relay module provides optical isolation.
Key Characteristics
Four channels: Four separately controlled relay outputs.
Electrical switching: Relay contacts switch the connected circuit.
Controller interface: Control inputs accept signals compatible with the module design.
Flexible applications: Suitable for compatible automation and control projects.
2. How Does a Relay Work?
An electromechanical relay uses a coil to move a set of contacts.
The basic operating sequence is:
- The controller sends a compatible signal to the relay module.
- The module's driver circuit operates the relay coil.
- The coil's magnetic field moves the internal mechanism.
- The contacts change position and switch the connected circuit.
- When the coil is deactivated, the contacts return to their normal position.
The control input and relay contacts serve different purposes. The control side operates the relay, while the contacts switch the external circuit within their specified ratings.
A relay module allows a controller to command a separate electrical circuit, but the relay's contact rating, PCB design, insulation and complete installation determine whether a particular application is suitable.
3. Understanding COM, NO and NC
Each relay channel commonly provides three contact terminals: COM, NO and NC.
| Terminal | Meaning | Function |
|---|---|---|
| COM | Common | The moving contact's common connection. |
| NO | Normally Open | Connected to COM when the relay is energised. |
| NC | Normally Closed | Connected to COM when the relay is not energised. |
The word "normally" refers to the relay's unenergised state. When the coil is activated, COM moves from NC to NO in a conventional changeover relay.
Always check the markings on the actual relay module because terminal arrangements and contact configurations can vary.
4. Understanding the Control Pins
A typical 4-channel module may provide the following control-side connections.
| Pin | Typical Function |
|---|---|
| IN1 | Controls relay channel 1. |
| IN2 | Controls relay channel 2. |
| IN3 | Controls relay channel 3. |
| IN4 | Controls relay channel 4. |
| VCC | Supply connection according to the board design. |
| GND | Ground reference for the applicable circuit. |
Some modules also have a JD-VCC terminal or jumper that separates the relay coil supply from the input-side supply. Follow the manufacturer's documentation when these connections are present.
5. Active-LOW and Active-HIGH Operation
Relay modules do not all use the same input logic.
An active-LOW module typically activates its relay when the control input is LOW. A HIGH input deactivates the relay.
An active-HIGH module instead activates its relay when the control input is HIGH.
| Input Logic | Typical Activation |
|---|---|
| Active-LOW | LOW activates the relay. |
| Active-HIGH | HIGH activates the relay. |
6. Connecting a Relay Module to Arduino Uno
The following example assumes a compatible 5 V relay module with four active-LOW inputs and a suitable supply arrangement.
| Arduino Uno | Relay Module |
|---|---|
| Digital pin D2 | IN1 |
| Digital pin D3 | IN2 |
| Digital pin D4 | IN3 |
| Digital pin D5 | IN4 |
| 5 V | VCC, if specified for this supply |
| GND | GND, when required by the wiring arrangement |
Before connecting the module, verify its operating voltage and current requirements. Four relay coils can draw considerably more current than a microcontroller's I/O pins can supply.
If the board requires a separate relay power supply, use a suitably rated regulated supply and follow the manufacturer's wiring instructions. Do not assume that every module can power all four relays directly from the Arduino's 5 V pin.
7. Arduino Code Example
The following program activates relay channel 1 for two seconds and then deactivates it for two seconds. The sequence repeats continuously.
This example assumes an active-LOW module. It is intended for low-voltage educational testing.
const byte relayPins[] = {2, 3, 4, 5};
const byte RELAY_ON = LOW;
const byte RELAY_OFF = HIGH;
void setup() {
// Set the inactive level before enabling outputs.
for (byte i = 0; i < 4; i++) {
digitalWrite(relayPins[i], RELAY_OFF);
pinMode(relayPins[i], OUTPUT);
}
}
void loop() {
// Activate relay channel 1.
digitalWrite(relayPins[0], RELAY_ON);
delay(2000);
// Deactivate relay channel 1.
digitalWrite(relayPins[0], RELAY_OFF);
delay(2000);
}
How to Test the Program
- Confirm that the relay module is compatible with your Arduino board.
- Check the control logic and supply requirements.
- Make the low-voltage control connections with the power switched off.
- Upload the program to the Arduino.
- Apply power and observe the first relay's operation.
- Listen for the relay switching and check its indicator LED, if provided.
The relay should activate for approximately two seconds and deactivate for approximately two seconds. The example does not switch an external load.
To control another channel, use the corresponding element in the relayPins array. For an active-HIGH module, change the RELAY_ON and RELAY_OFF constants after verifying the board's requirements.
8. Common Applications
Home Automation
A relay module can be used in a properly designed controller for compatible lighting or other electrical equipment. Any mains-powered installation must use appropriate protection, enclosure and installation practices.
Industrial Control
Relay outputs can be used to interface a control system with compatible external circuits. Industrial applications require careful consideration of contact ratings, electrical noise, switching frequency and protection requirements.
Robotics Projects
Relays may be useful when a robot needs to switch a suitable external circuit. They are not always the best choice for high-speed switching or motor speed control.
Electronics Testing
Relay modules can automate low-voltage test sequences and switch compatible test circuits under microcontroller control.
9. Troubleshooting Guide
| Problem | Possible Cause or Check |
|---|---|
| Relay does not activate | Check the supply, control pin, input logic and wiring. |
| Relay activates unexpectedly | Check the active-LOW or active-HIGH logic and controller startup behaviour. |
| Arduino resets when relays switch | Check supply capacity, voltage drop, grounding and electrical interference. |
| Relay clicks but load does not operate | Check the COM/NO/NC wiring, load supply and contact ratings with power isolated. |
| Contacts become damaged | Check load current, inrush current, inductive switching and the need for suitable suppression. |
10. Important Electrical Safety Considerations
- Verify the relay's rated contact voltage and current.
- Check whether the rating applies to AC, DC or both.
- Account for motor starting current and other inductive or capacitive loads.
- Use a suitable supply for the relay coils and control circuitry.
- Follow the manufacturer's instructions for VCC, JD-VCC, jumpers and isolation.
- Keep control-side and switched-circuit wiring appropriately separated.
- Use appropriate fusing, insulation, strain relief and an enclosure for the application.
- Disconnect power before changing wiring or inspecting the contacts.
- Do not exceed the contact or PCB ratings printed on the actual module.
Do not handle exposed live mains wiring or use a bare relay board for an improvised mains installation. Mains-powered projects require properly rated components, suitable enclosures, protective devices and qualified installation. A relay module alone does not make an electrical installation safe.
11. Frequently Asked Questions
Can Arduino control four relays at once?
It can control four compatible relay inputs using separate digital output pins. However, the relay coils must receive adequate power from a suitable supply. Do not draw relay coil current from Arduino I/O pins.
Why does my relay activate when the input is LOW?
Your module may use active-LOW control. This is common in Arduino-compatible relay boards, but the exact logic depends on the design.
What is the difference between a relay module and a bare relay?
A bare relay is the switching component itself. A relay module typically adds a circuit board and may include driver components, protection components, connectors and indicator LEDs.
Does every relay module provide electrical isolation?
No. The relay contacts provide a mechanical switching interface, but the module's complete isolation arrangement depends on its design and construction. Some boards include optocouplers; others do not. Verify the datasheet, circuit design and PCB layout.
Can a relay control a DC motor?
A relay may switch a compatible motor circuit if the contact ratings account for its starting and inductive currents. A relay is generally not suitable for continuously controlling motor speed. Use an appropriate motor driver for speed control.
Conclusion
A 4-channel relay module is a useful component for learning about electronic switching, Arduino programming and automation.
Understanding COM, NO and NC, checking the module's input logic, and providing an adequate power supply are essential steps towards reliable operation.
Always verify the specifications of the actual relay module and connected load before building or deploying a project.
MY CREATIVE ENGINEERING
Your Electronics Parts & Projects Partner
Follow MY CREATIVE ENGINEERING for practical electronics tutorials, component guides, PCB repair tips, automation solutions and project ideas.

