Pendahuluan: Klik yang Tidak Pernah Datang
PUKUL 2:47 PAGI. Anda sudah melakukan ini selama tiga jam.
Proyek Arduino Anda terlihat sempurna. Modul relai ada di papan tempat memotong roti Anda, disambungkan persis seperti yang ditunjukkan tutorial. Anda telah memeriksa tiga kali: VCC ke 5V, GND ke GND, IN1 ke pin digital 7. Kode dikompilasi. Anda mengunggahnya. Pin 7 menjadi TINGGI.
Tidak ada.
Tidak ada klik. Tidak ada LED. Relai hanya ... duduk di sana. Mengejekmu.
Anda menukar modul relai. Masih belum ada. Anda mencoba pin Arduino yang berbeda. Tidak. Anda menulis ulang kode untuk memastikan Anda menyetel pin dengan benar. Ini menegaskan: TINGGI. 5 volt. Multimeter setuju.
Dan relay masih tidak akan memicu.
Kemudian, karena putus asa atau rasa ingin tahu yang disebabkan oleh kafein, Anda mengubah satu baris kode:
digitalWrite(relayPin, LOW); / / Berubah dari TINGGI
Klik.
Relai aktif. LED menyala. Pompa Anda mulai bekerja. Semuanya bekerja.
Tunggu ... apa? Relai terpicu saat Anda menyetel pin RENDAH, bukan TINGGI? Itu mundur. Itu salah. Itu dia—
Sebenarnya, begitulah cara kerja relai pemicu tingkat rendah. Dan begitu Anda memahami alasannya, Anda akan menyadari bahwa itu tidak aneh—sebenarnya itu adalah desain yang lebih cerdas.
Biar kujelaskan.
Apa arti sebenarnya dari "Pemicu Tingkat Rendah" (dalam bahasa Inggris sederhana)
Relai pemicu tingkat rendah aktif ketika pin kontrolnya menerima sinyal RENDAH (0V/GND) alih-alih sinyal TINGGI (5V).
Dalam istilah logika digital:
- Sinyal RENDAH (0V) = Relai HIDUP
- Sinyal TINGGI (5V) = Relai MATI
Ini juga disebut logika aktif-rendah atau logika terbalik.
Bandingkan ini dengan relai pemicu tingkat tinggi:
- Sinyal TINGGI (5V) = Relay MENYALA
- Sinyal RENDAH (0V) = Relai MATI
Itu saja. Itulah perbedaan intinya. Tapi di sinilah hal itu menjadi menarik: mengapa modul relai menggunakan pendekatan yang tampaknya terbelakang ini?
Mengapa Modul Relai Menggunakan Pemicu Tingkat Rendah (Rahasianya Adalah optocoupler)
Sebagian besar modul relai tidak hanya memiliki relai—mereka memiliki rangkaian driver lengkap yang terpasang. Inti dari rangkaian ini adalah optocoupler (juga disebut opto-isolator), biasanya PC817 atau sejenisnya.
Desain Sirkuit Optocoupler
Inilah yang sebenarnya ada di dalam modul relai Anda:
Sisi Input (Sinyal Kontrol):
- Pin digital Arduino Anda terhubung ke "DALAM"
- IN terhubung ke LED di dalam optocoupler (melalui resistor)
- Katoda LED terhubung ke GND
Sisi Keluaran (Kumparan Relai):
- Sebuah fototransistor (di dalam optocoupler) mendeteksi cahaya LED
- Transistor ini menggerakkan transistor NPN (seperti 2N3904)
- Transistor NPN memberi energi pada koil relai
Detail Penting: LED optocoupler disambungkan antara VCC dan pin IN. Ini adalah kunci untuk memahami pemicu tingkat rendah.
Cara Kerja Pemicu Tingkat Rendah
Saat DALAM pin = TINGGI (5V):
- Perbedaan tegangan pada LED = 5V-5V = 0V
- Tidak ada arus yang mengalir melalui LED
- LED tetap MATI
- Fototransistor tetap MATI
- Relay coil tidak mendapat daya
- Relai tetap MATI
Saat DALAM pin = RENDAH (0V / GND):
- Perbedaan tegangan pada LED = 5V-0V = 5V
- Arus mengalir melalui LED (dibatasi oleh resistor)
- Lampu LED menyala
- Phototransistor turns ON
- NPN transistor conducts
- Kumparan relai memberi energi
- Relay clicks ON
The “Aha Moment”: The circuit pulls current from VCC to GND through the IN pin. When your Arduino pin is LOW, it provides a path to ground, completing the circuit. When HIGH, there’s no voltage difference, so no current flows.
Why This Design Is Actually Brilliant
- Fail-Safe Behavior: If your control wire breaks or disconnects, the IN pin effectively floats HIGH (pulled up internally by the resistor network). This keeps the relay OFF by default—safer than accidentally turning ON.
- Protection Against Floating Pins: During Arduino boot-up, pins are in an undefined state for a few milliseconds. With a low-level trigger, this typically results in relay OFF (safe) rather than relay ON (potentially dangerous for high-power loads).
- Lower Current Draw from Microcontroller: When the relay is OFF (your most common state for many applications), the microcontroller pin is HIGH and sourcing almost zero current. When you need to activate the relay, the pin goes LOW and sinks current—which microcontroller pins are typically better at handling than sourcing.
- 3.3V Compatibility: ESP32 and similar 3.3V devices struggle to reliably drive 5V relay modules in high-level configuration. But in low-level mode, the 3.3V pin can sink current to ground just fine, even when VCC is 5V. This makes low-level trigger modules more universally compatible.
Pro Tip: This is why most commercial relay modules default to low-level trigger—it’s the more robust, compatible, and fail-safe design.
How to Wire a Low Level Trigger Relay (Step by Step)
Basic Wiring for Arduino Uno (5V Logic)
Power Connections:
- Relay VCC → Arduino 5V
- Relay GND → Arduino GND
Sinyal Kontrol:
- Relay IN → Arduino Digital Pin (e.g., Pin 7)
Code Example:
const int relayPin = 7;
void setup() {
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Relay OFF initially
}
void loop() {
digitalWrite(relayPin, LOW); // Relay ON
delay(2000); // Wait 2 seconds
digitalWrite(relayPin, HIGH); // Relay OFF
delay(2000); // Wait 2 seconds
}
What’s Happening:
- HIGH (5V) keeps relay OFF
- LOW (0V) turns relay ON
Wiring for ESP32 (3.3V Logic)
ESP32 outputs 3.3V on HIGH, which can cause issues with some 5V relay modules. Here’s the reliable approach:
Power Connections:
- Relay VCC → External 5V supply (or ESP32’s 5V pin if using USB power)
- Relay GND → Common ground with ESP32
Sinyal Kontrol:
- Relay IN → ESP32 GPIO Pin (e.g., GPIO 23)
Code Example:
const int relayPin = 23; // ESP32 GPIO23
void setup() {
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Relay OFF initially
}
void loop() {
digitalWrite(relayPin, LOW); // Relay ON
delay(2000);
digitalWrite(relayPin, HIGH); // Relay OFF
delay(2000);
}
Why This Works with 3.3V:
When the ESP32 pin goes LOW (0V), it provides a ground path. The optocoupler’s LED is powered by the 5V VCC supply, so the full 5V voltage drop occurs across the LED—plenty to light it up and trigger the relay.
Pro Tip: If your relay module has a jumper for JD-VCC (relay power) separate from VCC (logic power), remove the jumper and power JD-VCC from 5V while keeping VCC at 3.3V. This provides complete isolation and better reliability with 3.3V microcontrollers.
Low Level vs High Level: Which Should You Choose?
Most relay modules come with a jumper or switch to select between low-level and high-level trigger modes. Here’s when to use each:
Choose Low Level Trigger When:
- ✅ Using 3.3V microcontrollers (ESP32, ESP8266, Raspberry Pi)
- ✅ You want fail-safe behavior (relay defaults OFF if control wire fails)
- ✅ Working with unknown or untested relay modules (it’s the more common/compatible mode)
- ✅ Your application requires the load to be OFF most of the time
- ✅ You’re a beginner (less likely to have compatibility issues)
Contoh Aplikasi:
- Home automation (lights OFF by default)
- Alarm systems (sirens OFF by default)
- Pump controls (pump OFF unless actively triggered)
- Safety interlocks (equipment disabled unless actively enabled)
Choose High Level Trigger When:
- ✅ You need the relay ON during Arduino reset/boot (rare but specific use cases)
- ✅ Working with normally-closed (NC) loads where you want inverse behavior
- ✅ Your code logic is simpler with “HIGH = ON” (personal preference)
- ✅ Interfacing with active-high control systems (PLCs, industrial controllers)
Contoh Aplikasi:
- Emergency lighting (stay ON during power failures)
- Cooling fans (ON by default for safety)
- Battery disconnect systems (specific fail-safe requirements)
The Honest Truth: For 95% of Arduino/ESP32 projects, low-level trigger is the better choice.
It’s more compatible, more reliable, and safer. Don’t overthink it.
Common Mistakes and How to Fix Them
Mistake #1: “My Relay Is Always ON!”
Symptom: Relay clicks ON as soon as you power up the Arduino, before your code even runs.
Cause: During boot, Arduino pins are in an undefined (floating) state. If the pin floats LOW, the relay triggers.
Fix:
void setup() {
digitalWrite(relayPin, HIGH); // Set HIGH first
pinMode(relayPin, OUTPUT); // Then set as OUTPUT
}
Setting the pin state before setting it as OUTPUT ensures it starts in the OFF state.
Mistake #2: “It Works… But Then Randomly Triggers”
Symptom: Relay occasionally clicks ON when it shouldn’t, especially with long wires or noisy environments.
Cause: Electrical noise or floating pin states.
Fix #1 – Add External Pull-Up Resistor:
Connect a 10kΩ resistor between IN pin and VCC. This keeps IN pulled HIGH (relay OFF) when your Arduino isn’t actively pulling it LOW.
Fix #2 – Enable Internal Pull-Up:
void setup() {
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
// Or for extra insurance:
pinMode(relayPin, INPUT_PULLUP); // Temporarily
delay(100);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
}
Mistake #3: “ESP32 Relay Doesn’t Click Consistently”
Symptom: Relay works sometimes, fails other times. LED on relay board lights up but relay doesn’t click.
Cause: Insufficient current from 3.3V GPIO to drive the optocoupler LED reliably.
Fix – Use a Dedicated 3.3V Relay Module:
Look for relay modules specifically rated for 3.3V trigger voltage (not just 3.3V compatible). These have optimized optocoupler circuits with lower LED forward voltage requirements.
Or – Power the Relay Module’s VCC at 5V:
Even though the ESP32 is 3.3V, you can power the relay module’s VCC from 5V (ESP32’s 5V pin or external supply) while the ESP32 GPIO sinks current to GND. This provides stronger LED current through the optocoupler.
Mistake #4: “I Set the Jumper Wrong”
Symptom: Relay behavior is opposite of what your code expects.
Cause: The relay module has a jumper set to high-level trigger mode.
Fix:
Look for a 3-pin jumper near the screw terminals, usually labeled:
- H (High level trigger)
- COM (Common)
- L (Low level trigger)
Move the jumper to connect COM and L for low-level trigger mode.
If No Jumper Exists: Some relay modules are fixed at low-level only. Check the product description or test: if LOW turns it ON, it’s low-level trigger.
Mistake #5: “Relay Clicks But Load Doesn’t Turn On”
Symptom: You hear the relay click, LED lights up, but your lamp/motor/pump doesn’t activate.
Cause: This isn’t a trigger problem—it’s a wiring problem on the high-voltage side.
Fix – Check Load Wiring:
COM (Common) connects to power source (e.g., 12V+ or AC line)
NO (Normally Open) connects to load positive terminal
Load negative goes back to power source negative
For AC loads (like a lamp):
- COM to AC hot wire
- NO to lamp
- Lamp other terminal to AC neutral
Catatan Keamanan Kritis:
If working with AC mains voltage (110V/220V), turn OFF power at the breaker before wiring. If you’re not comfortable with AC wiring, use a qualified electrician.
Practical Applications: When You Actually Need Low Level Trigger Relays
1. Home Automation Projects
Scenario: ESP32-controlled smart outlet for lamps.
Why Low Level Trigger:
- ESP32 is 3.3V (better compatibility)
- Lamp should be OFF by default (fail-safe)
- Random triggers during WiFi reconnects would be annoying
Implementation:
const int relayPin = 23;
bool lampState = false;
void toggleLamp() {
lampState = !lampState;
digitalWrite(relayPin, lampState ? LOW : HIGH);
}
2. Garden Irrigation Controller
Scenario: Arduino-timed water pump for garden beds.
Why Low Level Trigger:
- Pump OFF by default (prevents flooding if Arduino crashes)
- Long wires to outdoor relay (noise immunity with pull-up)
- Fail-safe: broken wire = no water = plant survive
Implementation:
void waterGarden(int minutes) {
digitalWrite(pumpRelay, LOW); // Pump ON
delay(minutes * 60000); // Wait
digitalWrite(pumpRelay, HIGH); // Pump OFF
}
3. 3D Printer Power Management
Scenario: Automatically power printer ON before print jobs, OFF when complete.
Why Low Level Trigger:
- Printer OFF when not printing (saves power, reduces fire risk)
- OctoPrint (Raspberry Pi) uses 3.3V GPIO
- Fail-safe: system crash = printer stays OFF
4. Aquarium Controller
Scenario: Temperature-based heater control with Arduino.
Why Low Level Trigger:
- Heater OFF by default (prevents overheating fish if sensor fails)
- 5V Arduino or 3.3V ESP32 compatibility
- Multiple relays (lights, filter, heater) all need coordinated fail-safe behavior
What This Means for Your Next Project
Low level trigger relays aren’t weird—they’re the standard. Once you internalize the logic (“LOW = ON, HIGH = OFF”), they become second nature. And the benefits—fail-safe behavior, better compatibility, noise immunity—make them the smart choice for most Arduino and ESP32 projects.
Quick Decision Guide:
Use Low Level Trigger Relay If:
- ✅ You’re using ESP32, ESP8266, or any 3.3V microcontroller
- ✅ Your load should be OFF by default (pumps, heaters, alarms)
- ✅ You want fail-safe behavior (wire break = relay OFF)
- ✅ You’re building a beginner project
- ✅ You value compatibility over fighting with logic levels
Use High Level Trigger Relay If:
- ✅ Your specific application requires relay ON during microcontroller boot
- ✅ You’re interfacing with industrial control systems (PLCs)
- ✅ You have a very specific reason (and you know what it is)
Pro Tip:
When buying relay modules, look for ones that support both high and low level triggering with a jumper. This gives you flexibility to choose the best mode for each project.
Choosing the Right Relay Module
When shopping for relay modules, here’s what to check:
For Arduino Uno / Mega (5V):
- Operating voltage: 5V DC
- Trigger voltage: 5V compatible
- Trigger current: <15mA (Arduino pins source max 20-40mA)
- Optocoupler isolation: Yes (PC817 or similar)
For ESP32 / ESP8266 (3.3V):
- Operating voltage: 5V DC (for relay coil power)
- Trigger voltage: 3.3V compatible OR low-level trigger mode
- Trigger current: <12mA (ESP32 pins source max 12mA)
- Optocoupler isolation: Required
- Separate VCC/JD-VCC: Preferred
Common Specifications:
- Contact rating: 10A @ 250VAC or 10A @ 30VDC (typical)
- Number of channels: 1, 2, 4, 8 (based on your needs)
- Mounting: Screw terminals for easy wiring
- Indicators: LED for power and relay state
VIOX Electric offers a complete range of relay modules optimized for Arduino, ESP32, and industrial control applications. Our relay modules feature:
- True 3.3V/5V compatibility with low-level trigger design
- High-quality optocoupler isolation (PC817)
- Screw terminal connections for secure wiring
- Dual-LED indicators (power + relay state)
- Selectable trigger modes (jumper for high/low level)
Browse VIOX Relay Modules → or Contact our technical team for application-specific recommendations.


