I'm building an AC dimmer with arduino, but I also want to have the ability to control the lamp from the wall switch (just on/off, with no dimming). What is the best way to achieve this? Do I also need to have a relay, so the two way from the circuit would be the relay's Normally Open (NO) and Normally Closed (NC) poles? Will the dimming circuit work with the relay, or will it cause any interference to it? Thanks!


1 Answer 1


There are two ways you can do this.

1 - Power the Arduino from the wall switch control.

This way when you turn the switch off, the Arduino turns off and so does the lamp. When you switch the power back on, Arduino boots and dimming will work as usual.

Pros: no power consumption when off, somewhat easier to wire.

Cons: have to wait to boot when you turn light on, Arduino may get unexpected power downs (if you are saving or transmitting data for example).

2 - Power the Arduino from another, permanent power socket, and read the Switch as an input.

This way the Arduino is always on and dimming, and whenever it detects a change of state in the wall switch it decides what to do (turn on/off, dimm, etc..)

Cons: a bit harder to wire (you either have to re-wire the switch for DC - thus removing original functionality - or optocouple your input to read if AC is connected)

Pros: Arduino is always on so no boot delays, you can add power up and down fade-in/outs, etc..

  • \$\begingroup\$ I'm going to control the arduino through RF, so it needs to be always on. Regarding reading the switch as an input, it would require me to rewire everything on the wall. Hence, not a very practical solution if I want to do this on several switches. The dimmer + relay would be a better solution (assuming it works), since I would only need to add the circuit to either the wall switch socket, or to the lamp socket on the ceiling. \$\endgroup\$ Apr 15, 2016 at 13:21
  • \$\begingroup\$ Reading the switch wouldn't ~necessarily~ require rewiring, its just one of the options. You can also read if the switch is closed or not by wether there is AC or not in the original lamp wiring (with a SFH 620 for example). As for the relay I don't get why you would need it in any of the cases. \$\endgroup\$
    – Wesley Lee
    Apr 15, 2016 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.