Adding Task Lighting Inside A Desk

storage-task-lighting

[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.

http://www.youtube.com/watch?v=64n8YgJmMOY

[via Flickr]

32 thoughts on “Adding Task Lighting Inside A Desk

    1. Sorry, but that circuit doesn’t do the same. The one he has turns the LEDs on when the battery is removed, yours turns it off when the battery is removed. The 100K is also somewhat superfluous here: the Hfe of the transistor only is about 30, so it won’t turn on when nothing is connected to its base anyway.

      1. “The one he has turns the LEDs on when the battery is removed,”

        I assume you mean when magnet is removed, the leds sure won’t light without a battery. The transistor was just the default, not selected. Having the base floating isn’t good practice I’d have thought generally.

        But you’re right, his switch closes with the magnet is present and opens with the magnet removed, door open switch open, door closed switch closed.

        Where mine is switch closed door open, switch open door closed. Of course the key is to have this reverse relationship to stop the current draw the door is closed.

        I can’t think of a way off the top of my head to achieve totally zero off current it with a normally open reed switch (aside from bodging it into a normally closed one with a second magnet to balance it when the door is closed).

        1. Sorry, you’re right, it’s late here and I meant ‘magnet’. FWIW: I can’t think of a non-botched zero-current solution with the current reed relay mechanics either, I’m curious if someone else figures one out. The one I outlined below (using a mosfet) is my best try.

          1. Yeah, I just don’t think it can be possible to have zero draw if you’re switch is closed when you want to draw nothing.

            A mosfet and a high resistance pull resistor could get you close enough for practical purposes I expect. A quick play in falstad gives me about 5 micro amps off-current with a 2 megohm pull down. http://phi.gogo.co.nz/edge7.png

  1. He seems to use an 1K resistor as pull-up, that would indeed drain the battery pretty quickly. He may be better off using a MosFET, in the same configuration. They don’t require current (just a voltage) to run through their control pin (base/gate) so the pull-up-resistor can be much, much higher, probably into the 470K/1M-range. Assuming an 9V-battery has about 400mA, that’d keep the circuit running for about 2 years. If he really uses an 1K resistor, the same battery would be empty after less than 2 days!

  2. Nice, simple solution.
    However, the npn needs, assuming hfe of 100 @ 9V and a load of 150mA, like 15mA of gate current so that forces you to use resistors around the 1k range.
    A mosfet is more appropriate though due to its low IGS, gate to source leakage (around 10uA) that would allow you to use a higher value pull-up thus reducing the idle consumption.

  3. can someone please explain to me why go through all the trouble of these npn things and whatnot, when he couldve used a simple switch to turn the lights on when he opens the drawer and turns them off when he closes it?

  4. I would have the magnet on a pivot or piece of springy metal or plastic, and the door would have a tab that pushes away the magnet. Or, have the tab slide between contacts that pinch together when the tab is removed.

    Or, use a completely standard microswitch with an NC contact.

    1. Microswitches are how it’s done in the industry I’m in. Actually, it’s often E series cherry switches now for the durability.

      I hate to say it, but I think this is slightly overengineered for when a simple switch would have been sufficient.

        1. True enough. Overcomplicated would be a better description.

          (Although the typical engineer I encounter tends to work under the assumption that “more complicated is obviously better”, much to the irritation of the technicians supporting the products.)

      1. That’s what I was thinking. Battery (or 5-volt wall wart) -> limit switch -> LED’s (they look like they have their own resistors) -> ground. Doesn’t get much simpler than that…

  5. Good for him for giving it a try. Yes the current drain is on the very high side but it’s obviously a new thing for him to play with transistors. As for over-engineering I might use an STM32 and FET combo to make the LED fade in and out. In low light conditions it could run less intensely and the FET would form a soft power switch with a few discreets. I did that before using a PIC and bipolar tranny in a battery riveter quite successfully.

    He could even have used a Darlington pair massively increasing gain so greatly reducing the needed switching current.

    Finally: Don’t ask a reed switch to carry large currents, it won’t last.

  6. Wow – great to see my project at hackaday. A couple of things:

    1. I changed my video. Being new to such things, I had used a Philip Glass background track, and it was flagged by youtube. So I created another video using Royalty Free music from Kevin MacLeod at http://incompetech.com. The updated link is:

    http://www.youtube.com/watch?v=wFeQDVLr_9k

    2. Yes, a MOSFET is a much better idea. I’ll be fixing that problem and updating this project.

    Thanks!

    Mahesh

  7. Ok, so he engineered the thing with what he had available. Other solutions have been suggested. I used switches.
    There are also reed switches that are normally closed (when there’s no magnet around).
    But the simplest way to improve on this design is to use a Darlington transistor which will require a smaller base current. Basically you require another 2n2222 transistor. I doubt that strip draws more than 100mA at 9V (it’s probably a 12V strip) so with a darlington configuration you will only need 10uA of current for the base. This boosts the standby time to 50.000 hours (>5 years).

  8. Here’s a thought: When I were just a boi I hung a wire out of the bedroom window in a lightning storm. At the other end was a FET (flavour unknown), meter and resistor (randomly picked coz it waz pretty). Lo and behold I could predict there would be another strike seconds before.

    Luckily I’m still here and my first experiments got me away from ‘just’ taking things apart to actually making stuff. On the theme of learning maybe it’d be a good idea to add a simple timer so that the light goes out after a couple of minutes. I’m thinking the world famous 555. Every budding tinkerer should get cozy with it’s datasheet at least once.

Leave a Reply to Duncan GunnCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.