Recommendations for a sensor that will count people

Hello, I am working on a project for school. Right now I am trying to make an application that in the end will count the amount of people that are in a room, but for that I need a sensor who will do that and that is also able to connect to openHab, so I can work with it. Does anybody have any recommendations for this?

Thanks in advance for your help.

Welcome to the forum, Marle!

Maybe this previous post will provide you with some insights.

Some security cameras can count customers entering stores, looking into the direction of store security might be worth it. Other professional sensors try to count people in office rooms for space management.

Cheaper but not 100% accurate idea would be to have a photoelectric barrier at the door (better two to be able to distinguish between entering and leaving the room). Problem ist that you might miss people walking in / out beside or very close to each other.
Simple floor contacts could be an option as well.
An ESP, Arduino or a Rasperry PI is an option to connect to those sensors - you might even run OH on the same PI and interface with the binding for the GPIO-Pins.
Depends on time, money and accuracy…

1 Like

It also depends on what you want to count. Random people or known people.
Because if it’s known people, a project like espresence can work out fine. If it’s random, something like yolo would probably suffice.

Per the thread that @Oggerschummer linked to, counting people is tricky if you’re on a budget. You won’t be able to accomplish this with a single $20 sensor.

There are a lot of things you have to consider before you jump to hardware solutions. Can you describe the scenario for us? Some (but not all) of the questions you might ask are:

  • What’s the maximum number of people you’ll need to count?
  • How big is the room and how many entrances does it have?
  • Can you count people as they enter/exit?

Tell us as much detail as you can, and we can help you hone in on a strategy. Then you can consider the possible options/solutions.

You might reveal the end purpose as well, this affects the options.
If this is for an automated attendance register, it must be high accuracy.
If this to control ventilation, an answer like “10 to 20” might do.


Right now I am working with 1 room, but this can change to 2 rooms, depending on how well it works in the first room. This room is around 6 meters by 5 meters. It also has only 1 entrance.
It is a place for meetings, so there is room for around 8/10 people inside.
What I need to be able to do is show if there is somebody inside (this is the first requirement) and after that I will need to know how many people are inside, so I can’t just use a presence sensor to know if people are inside the room. The people who will use this need to see with accuracy how many people are inside, so I can’t have a too big difference in the amount it shows and the real amount.

I do have a kind of budget, of course nothing outrageous. I have seen how expensive sensors can be sadly.

A (very) rough idea would be to use 2 functions:

  • entering / leaving
  • presence
    And have these feedback to eachother(even though I suspect the presence to be more accurate in this scenario(adults(?), meetings, no sleeping or low-movement activity).

Entering leaving using a lightbarrier and a presure-mat combined to detect direction of people in or out the room and the presence sensor(and possibly timer) to reset count in case of prolonged inactivity in the room.

If 100% accuracy isn’t needed this would likely sufficiently cover requirements.
Challenge would be to evolve from electronics and wires to an aesthetically acceptable solution :wink:


Why do you need to know how many people are inside?
What are the people doing in the room?

Just thinking if this would match your need?

1 Like