Instructables

Door Activated LED Lighting using Hall Effect Sensors

Featured
Picture of Door Activated LED Lighting using Hall Effect Sensors
DSC08785.JPG
DSC08765.JPG
I've been meaning to make something cool for my dorm room this coming semester and decided that some custom closet lights would look great. In this Instructable, I'll show you how to make some nice-looking LED lights that will turn on automatically using a hall effect sensor and a magnet.

Edit: I've noticed a lot of people are hating on the excessive control used in this project so I just wanted to clarify a few things:

1. This instructable was also meant to be a lite introduction to actual AVR programming for those people who are used to only Arduino programming. I had a bit of trouble finding useful information when I was learning so I figured it would be nice to help out some others. That is why I posted the basic tutorials along with my AVR code.
2. Yes I'm aware I could have simply used a reed switch to switch the LEDs when the door opened and closed. I wanted to leave room open for myself to add different light modes, maybe using more wires and pins to create nice fading effects, possibly a remote control sensor, and maybe even an auto-shutoff routine.
 
Remove these adsRemove these ads by Signing Up

Step 1: Gather materials

Stuff needed:

The usual tools:
1. Soldering Iron/Solder
2. Electrical tape
3. Protoboard

Parts:
1. Hall Effect Sensor-(one used can be found here: http://www.sparkfun.com/commerce/product_info.php?products_id=9312
2. Attiny85-(any micro can be used, mainly just for quick and easy digital input readings)
3. Led's of any color
4. Cases for the lights,
5. Wire and Wall wart
6. Resistors (1k and 3x33Ohm used in mine)
7. Magnet

Note: A microcontroller isn't necessary for this to work. If you can get the sensor to successfully switch a transistor to saturation, you should be able to skip the whole controller and coding part.
Wally_Z3 years ago
Is there a way to modify this circuit to make it when my door is open for 15 seconds, a servo is activated to close it? If so please contact me.
micobanff4 years ago
 This would look amazing in those Ikea Hopen wardrobes, the ones with the frosted glass door. But maybe on a timer so that it's turned on from a certain time at night until early morning, a very big nightlight. lol
Entropy5124 years ago
One thing that could be an issue:  Since LEDs can have some variance in their forward voltage, it's usually not the best idea to have multiple parallel strings of LEDs (or in this case, parallel single LEDs) that share a single current source or resistor.  Unless the LEDs were specifically binned with identical Vf, the current distribution between the LEDs could be quite uneven, resulting in uneven LED brightness and potentially damage to any LEDs that have significantly lower Vf than the others.
from your pictures, it looks like its more for show. I say this because it doesnt look like its really brightening up the closet enough. I may be picky, but thats my opinion.
Ive never seen tis before, i have to admit and it would be extremely helpful.
I actually did make something comparable with a reed switch, and trust me it's bright enough.  Unless you actually enjoy the overhead lighting in a "normal" office of course...
is there any video?
dukich55364 years ago
oh wow, I think I'll try with a movement detector. Thanks for posting
geoper24 years ago
nice one thx for sharing there is really a lot that can be done for upgrade but its really useful thx again
ktalex4 years ago
instead of eating so many icebreakers u could have bought the led thing already made at the 99c store i saw them last week.
Pfft, and? Wheres the fun in that? Altough i would take that 99c device and rig up a serious annoy-o-ma tron and slide em around Lets say a 99c sensor + a 99c smoke alarm (more or less its alarm) and rig it up
there are 99c sensors dude u gotta tell me were to get that.
revhead5 years ago
oh, and i also wanted to ask if a 555 timer would work. never used an "Attiny85" before so i dont know??
woody1189 (author)  revhead5 years ago
I'm not sure how well the 555 timer would handle the input from the sensor since it can't be programmed, let me know if you get it to work somehow though! An Attiny85 is just the name of an AVR microcontroller; if you've ever used an Arduino, its the same type except they make the programming part much easier. The only reason I even used it was because I was having trouble getting the sensor to switch a transistor on its own. I think the source or sinking capabilities of the sensor are very low so I used the microcontroller to handle the transistor and just read the value of the sensor to not put it under much stress. If you don't have much experience with micros, you could try creating some sort of buffer stage for the sensor output so that it can drive a transistor to turn on the leds. If you're familiar with digital logic gates, maybe you could use a logical AND gate with the sensor at one of the inputs and +5v at the other with the output connected to the transistor's base.
Thanks for all that info. I don’t have any knowledge of programming microcontrollers but do have knowledge with transistors and the such. I have a fairly good schematic which is Brocken up into two sections, an input and an output. they are separated by a relay so that the "week" input can trigger a very small reed relay which will then trigger the output which includes a transistor to keep the LED's for example "on" even when the input disappears. I might give it a try with your concept. It’s confusing but it works, I built a Laser beam alarm system with it and it turned out great, I even posted an instructable on it. Check it out if you are interested. CHEERS!!
omnibot revhead5 years ago
I don't see why a halleffekt sensor wouldn't work with a 555 in astable, the switching is fairly on/off.
I am Silas.5 years ago
That is AWESOME!
mangomango5 years ago
If I was going to do this I would make it so that it turns on when the sensor goes off (say you walk into a room) then it turns off when you pass it again, pretty cool 'ible though
jambre5 years ago
Just wanted to say this could be done very easily with a reed switch instead of a hall cell and would use no power when the door is closed. Just put a reed switch instead of the hall cell and have it switch the power line to the LED's. No microcontroller necessary and reed switches are pretty cheap.
woody1189 (author)  jambre5 years ago
Funny you should say that, the reason I even thought to do this was because I found a reed switch in an old window alarm. Only problem I had was that I had no way of telling its current handling capabilities and because I tend to prefer solid state devices rather than those with moving, and therefore breakable, parts.
If you're concerned about the current through the reed switch, you could use it to drive the transistor. If the hall effect sensor is having trouble sourcing the current try hooking it to a FET instead
Couldn't you have simplified this circuit significantly using a reed switch and a relay? You wouldn't need any microcontroller at all.
woody1189 (author)  largejunglecat5 years ago
Yes I could have but I plan on later adding different light modes.
static5 years ago
A well done instructable for detailing your approach for acomplishing what you wanted to accomplish. For simply turning the lights on or off a simple magnetic reed switch(NO) should be able handle the current draw of controling theLEDs directly or control a 555 timer curcuit if if a delayed on time is desired. Arduino and other PICs are the rage of the day, used when simpler circuit would do the job. Like when the 555 was the rage of the day, used, when discrete transistor circuit would do the job. The differance being the 555 resulted in smaller less expensive project, and the PICs often result in larger more expensive project.
revhead5 years ago
u could attach a bracket to the top of a door which will wholed the magnet and place the sensor above the door frame, set it out so that when the door is opened, the magnet swings under the sensor, turning on the LED's. i think this is pretty cool, i will give it a try. cheers!
that's convenient having lights turn on when you walk in or out
LeonimuZ5 years ago
Cool and cheap!