AC dimmer doesn't fully turn off — lamp keeps glowing faintly

Hello! I have a problem — when I set the dimmer to zero the lamp it not turn off completely.

I use Arduino Nano with rbdimmer 1CH 4A module and a 60W incandescent bulb for the kitchen light in my restaurant. The dimming works very nice from 100% down to maybe 10%. But when I do setPower(0) the lamp still has a very faint glow — like a small candle. Not completely dark.

I read the documentation and try also setMode(OFF_MODE) but the lamp still glows a little bit.

Here is my code:

#include <RBDdimmer.h>

dimmerLamp dimmer(5, 2);

void setup() {
  Serial.begin(115200);
  dimmer.begin(NORMAL_MODE, ON);
}

void loop() {
  if (Serial.available()) {
    int val = Serial.parseInt();
    if (val == 0) {
      dimmer.setPower(0);
      // also tried: dimmer.setMode(OFF_MODE);
    } else {
      dimmer.setPower(val);
    }
  }
}

When I send “0” from Serial Monitor the lamp goes very dim but not completely off. Is there something wrong with my module? Or maybe is a software problema?

Grazie for any help!

Pretty sure this is a setPower vs setState issue.

setPower(0) doesn’t actually stop the TRIAC from firing — it just sets the phase angle to nearly the end of the half-cycle. The TRIAC still gets a gate pulse each cycle so it can still conduct briefly.

What you want is setState(OFF) — this completely stops the gate pulses so the TRIAC never fires at all.

Try this:

if (val == 0) {
  dimmer.setState(OFF);  // fully stops TRIAC firing
} else {
  dimmer.setState(ON);   // resume dimming
  dimmer.setPower(val);
}

When you want to turn back on, call setState(ON) first and then set your power level. The lamp should go completely dark with setState(OFF).

AFAIK this catches a lot of people out because setPower(0) sounds like it should mean “off” but it doesn’t quite work that way with TRIACs.

Felix’s fix is correct — just want to add the explanation of why this happens from a circuit perspective.

The dimmer module uses a TRIAC (typically a BTA16 or similar) to control power. A TRIAC has a parameter called holding current — for the BTA16 this is specified as 25–80 mA depending on temperature and quadrant.

Here’s what happens when you call setPower(0):

  1. The library sets the firing angle to near 180° (end of the half-cycle)
  2. But it still sends a gate pulse to the TRIAC each half-cycle
  3. Even at this very late firing angle, the remaining AC voltage can push enough current through the filament to exceed the holding current threshold
  4. The TRIAC latches on for the brief remaining portion of the half-cycle
  5. Result: a tiny amount of energy reaches the filament each cycle — enough to produce a faint glow

This is especially visible with incandescent bulbs because the filament has very low cold resistance (a 60W bulb at 230V has about 70 Ω cold vs ~880 Ω hot). That low cold resistance means even a brief conduction pulse can push significant current.

With LEDs you might not see the glow because the LED driver has a minimum operating threshold — but the TRIAC is still conducting.

setState(OFF) solves this because it stops sending gate pulses entirely. No gate pulse → TRIAC never triggers → zero current → lamp truly off.

There’s a good writeup on this exact issue in the rbdimmer FAQ: https://rbdimmer.com/faq/ac-dimmer-doesn-t-turn-off-residual-glow-at-0-30

[SOLVED] Perfetto! The setState(OFF) works exactly right — the lamp is now completely dark when I send zero!

I change my code like Felix suggested:

if (val == 0) {
  dimmer.setState(OFF);
} else {
  dimmer.setState(ON);
  dimmer.setPower(val);
}

Now when I send “0” — completely off. Send “50” — dimmer turns back on at 50%. Beautiful.

And Vincent — grazie for the explanation about the holding current. Now I understand why the TRIAC still conducts a little bit even at zero power. Makes sense that the library needs to completely stop the gate pulses to get true off.

This forum is molto helpful — thank you both!