Lighting Controller Counts How Many People Are In A Room

[Deekshith Allamaneni] built this controller which will automatically turn the lights in a room on and off. No big deal, right? You can already get a replacement light switch at the home store that will do this for you. But there is one big difference. The commercial solutions we’ve seen simply rely in a motion sensor and a timer. But [Deekshith] found a way to count the number of people that enter a room, turning the lights on when the first person enters and off when the last person leaves.

The video after the break shows a demo of his test rig. At first we just thought that this was only counting how many times an object passes between the sensors. But it can also detect in which direction that object was traveling. Now the system just needs to be scaled up for use in a doorway.

It would be a great addition to the house that doesn’t have any light switches.

32 thoughts on “Lighting Controller Counts How Many People Are In A Room

  1. These photoresistor/phototransistor based sensors work really well when you have the light source that close, but when you have your gate mounted on oposite sides of a door, things might get a little funky. Also, it’s always a good idea to be able to manually overide the current number, so the number doesn’t get too far off

  2. I Thought about doing exactly the same thing, cause atm the traditional sensors are absolutely not perfect (when I’m sitting in the room at my laptop, after a few minutes the light switches off).

    But how can this be extended to detect when two persons are going through the door, one leaving and one entering?
    I already thought about infrared thermometers or thermal imaging cameras, but they’re either to expensive or I couldn’t imagine the ‘perfect’ way to use them…

    1. i thought about the exact same thing myself. I think what actually comes in our way to implementation is our own imagination that can give at least 10 different answers on how this could go wrong.

      somehow, this guy got it built, which is more than i can say about mmy own ideas 99 percent of the time.

  3. one of the problems will be people that just pop their head around the corner of a room to tell someone dinner is ready of that the taxi is there or something and then the number will likely be way off….

  4. In the real world counting who is in the room is very problematic. If you have children and/or pets the count can quickly become incorrect. We’ve tried this with software such as Misterhouse and the majority of folks quickly give up on this route. It appears technology such as kinect like devices can be used to solve this problem but this gets expensive for each room of the home.

  5. It doesn’t work for all the reasons mentioned before: people coming together, kids, pets, people not going out totally etc.
    Tried it personally.
    The best way to do it? I really don’t know, motion sensors fail if you sit still. Probably one of those occupancy sensors.

    1. Hey, do not judge that we cannot do. I have programmed it to eliminate those common errors. I have tested it with a 1 meter width gap(door) today. It works pretty fine (except that it is draining my batteries a lot). You will be convinced that it works only after seeing what I have done in the code.

      1. Sorry to be blunt, but _how_?
        We’re technical people, there’s really no need to spare the details. Saying that you’ve accounted for the problem in the code really doesn’t tell us anything.

  6. Can you explain how the code works?
    Also, provide more details as to how far the sensors are from eachother and at what height.

    I know someone who has done a lot of work trying to make this work. The problem is that you cannot use just 2 sensors for all cases. There are multiple cases that will generate the same senzor output sequence. There are things that will distract you like how a person holds the hands, if there is something carried, if two people enter, if they hold eachother etc.

    The real problem is that all this generates a cummulative error so once that appears things go bad until you have an opposite error.

  7. Consider substituting a pair of PIR sensors; 1 for the entry way, and 1 for the room.

    That way you know IF somone walked in or out, and IF someone is still in the room.

    They have excellent range and sensitivity.

  8. I have been thinking for long about implementing this kind of sensor for my bedroom.

    I think it should work well for my own convenience, but would likely fail if I wanted to brag to someone else, since I would place the sensor at the height of my head to best avoid miscounts.

    It’s improveable though, maybe by using more sensors at different heights, pir sensors, a real time clock for day/nicht profiles etc.

  9. Hi Everybody.
    I made this circuit. I have gone through all the comments. I will answer all of them soon. People have listed some problems which i have already solved and some others which I never thought of. Thank you for your interest in this circuit.

    I will soon write a post on my blog (www.deekshith.in) explaining it more clearly and provide the link here.

    Thank you all and Hack-A-Day

  10. This is a very, very old principle. :) When I was a child, I saw this kind of a light switch in some ancient book (yes, an ancient book made of paper :) ) which I got from local library. Of course, there was an old-school circuit made of discrete elements (it seems that there was no even logic ICs, but I can’t remember exactly now) and relays.

    1. Ha ha, Not any more. I am going to release it on my blog for free soon (possibly in a week or two). Yes, I have asked for money as I have spent on it. But, I got the money I’ve spent on it from a team of students (Ajay, Victor and Vidhyarthy) who took training from me for making it as their college project. I can now make it open-source whole heartedly.

      Making it open-source will not only benefit others but also the project as many people are expected to contribute to it.
      I need your feedback on this.
      Thank you for you all.

  11. Hey..It’s a simple counter, and it will should not work in a real room, where ambient light is a consideration. Moreover, what have you accounted in the code, you can only use the value that your sensors give and sensors will give you a high when two people are entering together. I doubt colleges accept such hacks as projects in India. It’s a 2 – 3hrs job for an EECS student.

    1. I bought this circuit from Deekshith and it works fine upto a separation of 2 meters even in sun light. I too thought this is a simple ciruit at first glance but first thing to be noticed is that it detects direction. Not only that, it uses a data pattern for sensors not just continuous light making it immune to ambient light. It has accounted almost all kinds of errors possible during its operation. Although the error due to multiple persons entering at a time is not completely solved, there is also a solution given to reduce it. I hardly get any errors practically installed to a door. Unlike the prototype shown the version I got has a two sets of sensors placed up and down (probably for improved accuracy). Although the code is too large than expected, I am quite happy with this after experimenting with many similar circuits.

  12. I have come up with a similar solution myself, but havent spent any time building it, because i can see all these ways it can go wrong, and my own rule about tinkering is that it should slove my problems.\

    Unfortunately, in this case, in my locative situation, i can see this very qucikly turning into a problem itself, so its just shifting the problem of keeping the lights off into the problem of maintaing the proper people count.

    HOWEVER, I did spend some time thinking about it, and i think the correct care-free solution would probably be some sort of fusion of different sensors: PIR, doorcounters, video….

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.