[Mahesh Venkitachalam] wanted to light up the dark recesses of his desk. What good is all that storage if you can’t see a darn thing in there? His solution was to add LED strips which turn on automatically when the door is opened.
The design is quite simple. A 2N2222 NPN transistor is responsible for connecting the ground rail of the LED strips mounted under each shelf. The base of that transistor is held high with a pull-up resistor. But a reed switch always connects the base to ground when the door is shut. Opening the door removes the magnet that keeps that reed switch closed. This allows current to flow from the pull-up to the base, connecting the ground rail to the LED strips and turning them on. You can see the video demo after the break.
One problem that we see with the design is that these are driven by a 9V battery. Over a long period of time that pull-up resistor will drain the cell. You can pick up a magnetic reed switch at the hardware or electronics store that is rated for 500 mA. If you can stay under that with the LED strips, and get one that is open when the magnet is present you will have zero power drain when the lights aren’t being used.