Home Automation Hack Controls Lights Based On Head Count

This home automation hardware turns on and off the lights based on room occupancy. The hack is an extension of an earlier version that was only a proof of concept. [RPisces] took the idea and made it into reality by mounting the sensor hardware in a doorway.

He prototyped the device using the MSP430 launchpad. It monitors a pair of IR distance sensors which record a change when something passes between them and the opposite side of the hallway. This is a good sensor choice as it only requires hardware on one side of the passageway. Because two of them are used, it’s quite simple to figure out if a person is entering or leaving the room based on which is tripped first.

In this case [RPisces] drives a relay to switch a lamp on and off. But it could be used for just about anything. We’d enjoy seeing it trigger an audio system like the one [Quinn’s] installing in every room.

19 thoughts on “Home Automation Hack Controls Lights Based On Head Count

    1. Wasn’t there a project featured on HaD that uses multiple kinect units to map a room with a great degree of accuracy? Some clever person can extend that system to detect whether or not there’s anybody in the room. Also, one can implement some logic to recognise gestures and possibly even identify the people in the room. For instance, if it detects two people and one makes a lot of agitated gestures indicating anger, then it can pacify him with a tranquilliser dart or something. (c:

  1. Good job sir!

    I have thought of this exact same device, and made a prototype of it earlier this year but have not extended it to mains yet.

    My version, to check for direction, needed sensor A then sensor B to activate in the right order, followed by both being on, followed by A turning off then B turning off. The opposite was needed for the other direction. I found that doing this removed errors of someone popping in and out, or standing in the doorway.

    I also had the counter bottom out at 0 to avoid longer errors. It is useful to have a button to reset the count if it gets messed up.

    Another feature that I wanted to add that is quite nice, is a manual overide that turns off the light until the count reaches zero. For example, if you want to go to bed, you can set it to sleep, then if anyone else walks in it stays off. However once everyone has left, it resets to normal operation.

  2. Professional systems try to count people in the room and the all have failure points. the ony solution is the triple technology occupancy sensors. they use IR, FLIR, and Ultrasonics to get a 90% accuracy. nothing will deliver 100% accurate.

  3. how does this work if there is more than one person entering/leaving the room?

    person one enters, light turns on, person two and three enter, light remains on. person three leaves, light turns off, and person one and two are left in the dark? :(

    ‘home automation’ might be a stretch…

    1. It counts them in 1(on)..2..3 and counts them back out 3..2..1(off), the problem comes if the people are huddled together as they enter and the system thinks only 1 or 2 entered, then you get the problem you describe.

  4. Nice. I like the use of dual IR sensors for intelligent sensing. I just wonder how practical the control is long term when set to specific assumptions.

    Also, this project is using the sensor for 1 relay activation, when some logic would do instead of a micro. Funny how micro’s are taking the logic out of design.

    Logic gates / counters could be used for multiple outputs and LEDs as well….just sayin….

  5. you might be able to use only one sensor, placing it a bit diagonal to the hallway. the software will detect the direction of movement by the person getting closer or farther from the sensor.

  6. I love the idea of home automation but until they start building houses specifically to accommodate this, its just not practical. With kids and puppies and a generally busy life its really not practical to have wires and little boxes laying around just to be able to control a light. I think every electronics engineer dreams of a fully integrated, centrally controlled automated home but very few have the budget or time to make it happen – its a bit like the desire I used to have as a kid to have a big 45 degree control panel with lights and dials, levers and controls to press. At 8 years old I was inspired by the scifil programs and having the control panel was actually more desirable and mattered more than having the things it could control – somehow…now I have satisfied that in-built desire with shelves full of test equipment that have buttons and displays in abundance.

  7. My dad’s workplace has had an occupancy sensor in the break room for years, turning on the light when someone enters. I don’t know who made it, but it works well. Lutron is one company that makes these sensors.

Leave a 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.