[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]
not to see in Germany, thank you GEMA :(
“You can pick up a magnetic reed switch at the hardware or electronics store that is rated for 500 mA.”
Or simply use a PNP as a high side switch instead of the NPN on the low side.
https://www.circuitlab.com/circuit/9z28wj/screenshot/1024×768/
Or use a push to brake switch.
http://www.ebay.nl/itm/1-Push-to-Break-Normally-Close-ON-OFF-Switch-GYM212-Fin-/300725925150?pt=LH_DefaultDomain_0&hash=item4604a9751e
Only usefull if the door has a latch so the button won’t push the door open ;-P
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.
“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).
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.
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
( Which is of course primarily just Ohm’s law on the 9v battery and 2meg resistor, and an inconsequential amount through the FET )
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!
Same thoughts here exactly, a mosfet would give much better performance and help manage it’s residual off-current.
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.
This could be done using limit switch with zero current drain wasted. But i would just assume that he want to play with reed switch.
i would just assume that he wants to play with reed switch since this has been done so many times using liimit switch (zero current drain).
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?
Presumably it’s what he had laying around.
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.
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.
I wouldn’t speculate on how much engineered it is…typically you would expect an engineer to follow a solution path to the least costly and most reliable solution.
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.)
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…
So where’s the little man? :)
Tweeks
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.
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
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).
You can also bias the reed switch with a second magnet, so when the first magnet is removed the reed switch turns on.
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.
I switched to a MOSFET – please see updated project below:
http://makeprojects.com/Project/Automatic+Lights+for+Desk+Interior/3034/1#.UNbb8oUihks
Regards
Mahesh
You still need to increase the 1K resistor’s value. Otherwise the change doesn’t do anything. Try something like at least 1M.
I think you didn’t see my updated link – the resistor value is now 470K.
Didn’t check the schematic. Just the parts list where it says:
Relevant Parts
MOSFET BS 170
Resistors, 1kΩ
Reed relays
Missed the parts list – updated now, thanks.
Why limit it to a desk? Attach this switch idea to anywhere you need a light to automatically come on and you’re set. Attics, basement stairs, closets you don’t use often.