hi guys!! so i just got my rbdimmer 1ch module and im trying to get it working with my arduino uno. i uploaded the code and it compiles fine but the lamp doesnt respond at all. like nothing happens — no flicker no dimming nothng.
heres my code:
#include <RBDdimmer.h>
#define outputPin 5
#define zerocross 2
dimmerLamp dimmer(outputPin, zerocross);
void setup() {
Serial.begin(9600);
dimmer.begin(NORMAL_MODE, ON);
}
void loop() {
dimmer.setPower(50);
delay(1000);
}
my wiring: i connected the DIM pin from the module to pin 5 on the arduino and the VCC and GND to 5V and GND. the lamp is plugged into the AC side and i can see the power LED on the module is on so its getting power.
what am i doing wrong?? i feel like the code looks right but maybe im missing somthing obvious lol. any help appreciated!!
Hi Jo — welcome to the forum!
I’ve seen this quite a few times. The code itself looks correct syntactically but I notice you mentioned connecting only the DIM pin. Did you also wire the Z-C (zero-cross) pin from the module to pin 2 on your Arduino?
Your code defines #define zerocross 2 which is correct — pin 2 is interrupt-capable on the Uno. But the library needs a physical zero-cross signal to detect when the AC waveform crosses zero volts. Without that signal the TRIAC never receives its firing pulse and the lamp stays off completely.
Here’s what’s happening under the hood:
- The AC mains voltage crosses zero 100 times per second (at 50 Hz) or 120 times per second (at 60 Hz)
- The module’s Z-C circuit detects each crossing and sends a pulse to your Arduino
- The library uses a hardware interrupt on pin 2 to catch that pulse
- It then calculates a delay based on your
setPower() value and fires the TRIAC at the right moment
If the Z-C wire isn’t connected the interrupt never fires → no TRIAC trigger → lamp stays dark.
Quick fix: connect the Z-C terminal on the module to pin 2 on the Arduino Uno (same pin you declared in code).
Also — our getting-started FAQ covers the full wiring diagram and common first-time mistakes: Which AC Dimmer Module to Choose — Complete Buyer’s Guide
Let us know if that resolves it!
— rbdimmer support team
Hey Jo — just to add onto what rbdimmer said:
On the Arduino Uno only pin 2 and pin 3 are hardware interrupt-capable. Your code already declares zerocross 2 so you’re good on that front — just make sure the physical wire is actually there.
For anyone finding this later here’s a quick reference for interrupt pins:
| Board |
Interrupt Pins |
| Arduino Uno / Nano |
2, 3 |
| Arduino Mega |
2, 3, 18, 19, 20, 21 |
| ESP8266 |
GPIO 4, 5, 12, 13, 14 |
| ESP32 |
Any GPIO |
Also double-check that your DIM pin (pin 5) is a PWM-capable pin — on the Uno that’s 3, 5, 6, 9, 10, 11. Pin 5 works fine.
One more thing: when you first power it on and the Z-C is connected properly you should see the lamp respond almost immediately. If it flickers wildly at first that’s actually a good sign — it means the zero-cross is being detected but the timing might need tuning. No response at all = no zero-cross signal reaching the Arduino.
omg i feel so dumb
i literally just didnt connect that wire. i saw 3 pins on the low voltage side (VCC GND DIM ZC) and i thought ZC was like optional or someting.
just hooked up ZC to pin 2 and THE LAMP IS DIMMING!! its working at 50% right now and i changed it to different values and it all wroks. this is so cool!!
thank you so much rbdimmer and hank!! that explanation about how the zero cross detection works actually made it click for me. so basically without that signal the arduino has no idea when to fire teh triac right?
one more question — is it safe to test with a 100W incandescent bulb? thats what im using rn and it seems fine but want to make sure i dont fry anythng
Glad it’s working Jo! 
You’ve got it exactly right — without the zero-cross signal the Arduino doesn’t know where in the AC cycle it is so it can’t fire the TRIAC at the correct phase angle.
Regarding your bulb — yes a 100 W incandescent is perfectly fine for testing with the 1-channel module. The standard 1CH module handles up to 4A at 110/220V which means:
- At 110 V: up to ~400 W
- At 220 V: up to ~800 W
So 100 W is well within the safe range. Incandescent and halogen bulbs are actually the easiest loads to dim with a TRIAC — they’re purely resistive so they respond smoothly across the full power range.
If you later want to dim LED bulbs keep in mind that most standard LEDs don’t support phase-cut dimming. You’d need specifically dimmable LED bulbs and even then the usable range is typically 30–100% with leading-edge (TRIAC) control. Below 30% you may see flicker. Our FAQ covers LED compatibility in detail.
Happy building!
— rbdimmer support team