Close

Hardware

A project log for Arduino based bath night light controller

This small Arduino Nano based project controls light in my bathroom giving two modes with single wal switch

andrey.malyshenkoandrey.malyshenko 04/22/2019 at 13:210 Comments

Simple trick that i hired to control modes with singe switch is double-click hander so to speak. When you switch on the light via wall switch - 12v power suppy starts to feed ardunio nano via linear voltage stab. 5 volts charges almost immideately 470uF cap. Through resistor voltage devider arduino itself knows if 12v power is on or off. White light is switched on then.

When power is switched off - arduino senses that and shuts off all lights and starts monitoring power with long loops of sleep to save capacitor juice. Shottkey diode added to prevent cap to discharge back to liner regulator. Also all pins are connected to driver through resistors to prevent current leak.

If power returns within second or so - arduino stil being up and running - able to switch led mode to ambient (or rainbow) and that concludes the trick   

Discussions