I want to count the number of people in a small room. According to my research, there are person-counters in the web but I want to use the number of people data for coding hence I must transfer the number so I found occurence sensors can be useful for this goal. However, I cannot trust these sensors much.

So is there any practical way to count the number of people in a single room at any time ? What should be my steps to calculate this ?


  • \$\begingroup\$ IR camera maybe ? \$\endgroup\$ – Elbehery Sep 21 '16 at 22:39
  • \$\begingroup\$ 2 systems I have seen. 1 is a camera with a birds eye view above the entry point(s), it then has analytics and calculates number of people crossing zones in or out. 2. Was a PE beam/laser setup low at feet level with several detectors and an algorithm to work out direction of travel and how many people. 3. Another option is access control and counting upon access but has to be a secure area and you really need something physical like turnstiles to prevent tailgating or passback. \$\endgroup\$ – D-on Sep 21 '16 at 23:36
  • \$\begingroup\$ This is more Diy than electrical engineering, but I won't vote to close yet. \$\endgroup\$ – user86234 Sep 22 '16 at 17:14

Laser tripwire

While I won't go into too much detail, it is possible to count how many people are in a room using a laser tripwire in the doorway to count how many people enter/exit. You would have to install 2 wires in each doorway if you need to know if someone entered or exited. One laser on the outer side of the doorway, and one on the inner side. For you I'd recommend a 5mW ultraviolet laser, as UV lasers are typically the safest lasers to handle, they're discrete (invisible), and photo diodes react well to them.

Double Pressure plates

this solution will take a bit of extra engineering, but if you put a mat over a pressure plate, then you can also count how many people move in and out. Something like a force sensitive resistor will be a sufficient pressure plate. The problem with this one is that people may like to stand on these pressure plates for various reasons, and it may be hard to detect who is moving where.

Good luck!

  • \$\begingroup\$ you sir are a genius. \$\endgroup\$ – Alex Sep 22 '16 at 17:23
  • \$\begingroup\$ @Alex haha, you may want to change your definition of genius. ;-) \$\endgroup\$ – user86234 Sep 22 '16 at 17:24
  • \$\begingroup\$ I wold have never thought of it. something so simple, yet so effective. \$\endgroup\$ – Alex Sep 22 '16 at 17:27
  • \$\begingroup\$ You could trick the system by opening, closing the door but not passing through the door. \$\endgroup\$ – lucas92 Sep 22 '16 at 17:39
  • 1
    \$\begingroup\$ @lucas92 Sure, there will always be ways to dupe the system, I just thought that this would be the most cost-effective solution. \$\endgroup\$ – user86234 Sep 22 '16 at 17:45

The best solution would require to know more details about the setting. This is the setting that I imagine. It may not be the cheapest way to do, but with the following assumptions I think this would work rather well: small room, people are moving.

In this case you could have a ceiling camera and detect people by detecting motion on the picture. Of course, if there was an big dog among the people, it could be recognized as a person.

In case it was a classroom, you could dedicate regions of interest in the image were the person is expected to be (such as a chair). Then, you could process those ROIs to see if the person is there.


Probably a little late, but here is my approach.

I placed a sound based distance sensor into my door frame and tilted it, so it measures 30° relative to the floor into one possible walk direction. If someone walks through the door from the side the sensors is pointing to, you will see a sudden decrease of the distance measured until it suddenly falls back to the default distance (the floor or whatever). When someone walks through in the other direction, the whole thing reverses. First a sudden decrease, followed by a slower increase, back to the default distance.

Not so easy to get the software to work reliable and the sensor to produce less noise, but still doable. If you are interested in my software (Python), just leave a comment.


CO2 PPM Correlation

If it is a relatively closed room (e.g. no open windows or strong drafts) you could use an air quality/VOC sensor like the IDT ZMOD4410-EVK to get a CO2 ppm approximation and then correlate this to number of people in the room.

If you won't be developing an embedded solution maybe a Vernier CO2 sensor with a Go!Link might be a viable sensing solution.

The practicality of the solution lies in it being a non-mechanical method of measurement.

  • \$\begingroup\$ Interesting idea, I wonder how well CO2 correlates to the number of people in a room, and how hard it would be to calibrate the system. \$\endgroup\$ – C_Elegans Nov 28 '18 at 0:09

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