Relay modules are one of the most common hardware interfaces used in Arduino and IoT projects. They allow a low-voltage microcontroller to safely control high-voltage or high-current devices such as lights, fans, pumps, and home appliances.
However, many beginners encounter a frustrating problem:
Some relay modules are low-level trigger, while many microcontrollers and IoT boards expect a high-level trigger.
In this tutorial, you will learn:
The relay module logic did not match the control signal logic of the microcontroller.
Instead of replacing the modules, we can convert the trigger circuitry.
To make the module respond to a HIGH signal, we replace it with an NPN transistor (BC547) and rebuild the driver circuit.
This modification converts the relay board into a high-level trigger relay module.
Therefore, we use a transistor as a switch.
This helps debugging and testing.
If everything is correct:
This modification improves compatibility with Arduino and IoT boards and helps you understand how relay modules work internally. Instead of treating modules as black boxes, you now know how to repair, modify, and even build your own relay boards.
However, many beginners encounter a frustrating problem:
Some relay modules are low-level trigger, while many microcontrollers and IoT boards expect a high-level trigger.
In this tutorial, you will learn:
- The difference between low-level and high-level trigger relay modules
- Why some relay modules fail to work with certain boards
- How to modify (reassemble) a relay module to make it compatible
- How to build your own 2-channel high-level trigger relay module
Why This Modification Is Needed
I originally purchased two low-level trigger relay modules for an IoT project. Unfortunately, they did not work reliably with my system. After testing and researching, the root cause was:The relay module logic did not match the control signal logic of the microcontroller.
Instead of replacing the modules, we can convert the trigger circuitry.
The Key Idea
Low-level trigger modules typically use a PNP transistor configuration.To make the module respond to a HIGH signal, we replace it with an NPN transistor (BC547) and rebuild the driver circuit.
This modification converts the relay board into a high-level trigger relay module.
Understanding Relay Trigger Types
Low-Level Trigger Relay
The relay activates when the input pin goes LOW (0V).- Signal LOW → Relay ON
- Signal HIGH → Relay OFF
- ESP8266 / ESP32 boot pins
- Mixed-logic systems
- Some IoT platforms
High-Level Trigger Relay
The relay activates when the input pin goes HIGH (5V/3.3V).- Signal HIGH → Relay ON
- Signal LOW → Relay OFF
Project Overview
We will build a two-channel 5V relay module with:- Common VCC and GND
- Two independent signal pins
- LED indicators for each relay
- NPN transistor driver stage
Required Components
Electronic Components
- 5V Relay (x2)
- BC547 NPN Transistor (x2)
- 1 kΩ Resistor (x4)
- Red LED (x2)
- Terminal Block (x2)
- 4-Pin Male Header
- PCB Prototype Board
Tools
- Soldering iron
- Solder wire
- Desoldering pump (if modifying an existing board)
How Relay Driver Circuits Work
A relay coil requires more current than a microcontroller pin can supply.Therefore, we use a transistor as a switch.
Role of the BC547 Transistor
The BC547 works as a current amplifier:- Arduino sends a small current to transistor base
- Transistor allows larger current to flow through relay coil
- Relay switches ON safely
Why NPN Works Better Here
Using an NPN transistor creates a high-level trigger configuration, which is easier to control using Arduino digital outputs.Circuit Diagram Explanation (Conceptual)
Each relay channel contains:- Arduino Signal → Base resistor → BC547 base
- Emitter → Ground
- Collector → Relay coil
- Relay coil → VCC
- LED indicator connected to show relay status
- Transistor turns ON
- Current flows through relay coil
- Relay activates
- LED lights up
Pin Configuration of the Module
Your completed relay module will have 4 pins:
- VCC - 5V power supply
- GND - Ground
- IN1 - Relay Channel 1 control
- IN2 - Relay Channel 2 control
Both relays share the same power supply but operate independently.
Step-by-Step Assembly
Step 01: Prepare the PCB
Place the following on the prototyping board:- Two relays
- Two BC547 transistors
- Two LEDs
- Resistors and terminal blocks
Step 02: Build the Transistor Driver Stage
For each channel:- Connect transistor emitter to GND
- Connect collector to one side of relay coil
- Connect other side of relay coil to VCC
- Add 1kΩ resistor between Arduino signal pin and transistor base
Step 03: Add LED Indicators
Connect LED and resistor in parallel with relay coil so the LED lights when relay is active.This helps debugging and testing.
Step 04: Add Header Pins
Install the 4-pin header:- VCC
- GND
- IN1
- IN2
Testing with Arduino
Example Arduino code:
int relay1 = 7;
int relay2 = 8;
void setup() {
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
}
void loop() {
digitalWrite(relay1, HIGH);
delay(2000);
digitalWrite(relay1, LOW);
delay(2000);
digitalWrite(relay2, HIGH);
delay(2000);
digitalWrite(relay2, LOW);
delay(2000);
}
- Relay clicks when pin goes HIGH
- LED lights when relay is active
Applications of This Module
This high-level trigger relay module can be used for:- Home automation
- IoT switching systems
- Smart lighting
- Motor and pump control
- Remote appliance control
Safety Tips When Using Relays
Relays often control high-voltage AC loads. Always follow safety rules:- Never touch exposed AC wiring
- Use proper insulation
- Test using low-voltage loads first
- Keep high-voltage side physically separated
Troubleshooting Guide
Relay Not Clicking
Check transistor orientation
LED Works But Relay Doesn't
Insufficient coil current
Relay Always ON
Base resistor missing
Arduino Resets When Relay Activates
Use separate power supply
Conclusion
In this tutorial, you learned how to convert a low-level trigger relay module into a high-level trigger relay module by redesigning the transistor driver stage using BC547 NPN transistors.This modification improves compatibility with Arduino and IoT boards and helps you understand how relay modules work internally. Instead of treating modules as black boxes, you now know how to repair, modify, and even build your own relay boards.



Comments
Post a Comment