If you’re faced with a closet that doesn’t have any lights inside, you simply could go and find puck lights at most retail stores. But, if you’re Dillon Nichols, you buy a set of lights, and enhance them with a wired power supply and automatic Arduino control.
To accomplish this, Nichols decoded the infrared remote control signal to his puck lights using an Arduino Leonardo, then set up things up to sense the door’s opening via a physical switch and signal the lights accordingly. Now when he opens the closet, lights automatically shine down and fade out when it’s closed.
He also added a timer, so that they turn off after 10 minutes automatically if he forgets to shut the door. Looking for an over-engineered, non-permanent solution for yourself? You can check out his detailed write-up here and find the code for his build on GitHub.
[original story: Arduino Blog]