This question already has an answer here:

We are making a project in which we want to count the no. of people entering and leaving a room with one single entrance. We are using IR sensors and detectors for this ,along with an Aurdino. We have a problem in this system, i.e when two or more persons are entering or leaving the room at a time we are getting a wrong count. Thanks in advance for your valuable time and solution.....If there is any other better way,please state that.


marked as duplicate by Chuck, Mark Booth Apr 4 '16 at 0:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ Wrote a longer response but my phone refreshed the page. Basically, it's been asked before, you can't do it with the equipment you have (almost-guarantee; you don't state what equipment you are using!), and re-designing the system is an open-ended design problem which is off-topic for this site. If you would like a discussion, try Robotics chat. $\endgroup$ – Chuck Apr 3 '16 at 19:00
  • $\begingroup$ This will not work unless you use full body scanners, aka backscatter X-ray. All other automatic security gates I know can be tricked when 2 (slim) people pass it. $\endgroup$ – ott-- Apr 3 '16 at 20:43

You question is a bit vague in sense of how many IR sensors you have, what type of them etc. With that in mind, I will try to answer with the following assumptions:

  1. You have IR sensors which are laser-ir diode/resistor/transistor pairs (the person walking cuts the laser beam which can be detected on the photosensitive element).
  2. You have enough of those.
  3. People will not be trying to fool your system.

You can try to put a bit denser array of these sensors both horizontally and vertically so that you may distinguish two persons walking in at the same time. This will call for some heuristics in the sense of how wide a single person is etc.

A much easier solution (involving a bit more sophisticated IR sensor) is using Microsoft Kinect along with Kinect SDK which has skeleton detection already implemented so you can just read if and how many people are entering and leaving the room.


Not the answer you're looking for? Browse other questions tagged or ask your own question.