How to count humans in room


You could try a Nvidia Jetson Nano to count people (and dogs).
It is a nice little and affordable platform for image recognition and object detection. It comes with a nice sdk that is quite usable (python, c++). All you need to do is feed it a videostream from the area you want to count people in. I started from here:

Best regards,

with all your ideas and suggestions, i found a rather cheap solution on the marked, called " Homematic IP Passage Sensor with Direction Recognition" which seems very promissing to what I need but still about 100$ each and I need up to 16 of those.

Is there any cheaper solution avialable? The idea from @m4rk (break beam type sensor) seems nice but can’t imagen putting it together.

@Max_G the “someting” is nice but not what I’m looking for.

At the end of the day, all I need is to know, if there is “someone in the room, yes or no”. That’s all. Nothing else, and the ability to connect that info with my OpenHAB

That’s occupancy detection. Quite different, nothing about counting. Lots of existing advice - make your mind up what you want.


I agree with Rossko57

For example, all the Velbus PIRs can be set to trigger on every single bit of movement, or can be set to trigger once then wait.

They also have multiple trigger channels, with light level options.

Here is a setup with 2 zwave motion detectors.

As stated it’s not accurate if 2 people at once enter the room

Timing is everything

I have a simualar topic, presence detection ! often you find article regarding to check it via mobile and WLAN, but what is if the mobile akku is empty or forgotten, wlan is off , … I doesn’t find any solution with really works. My idea is to use HMIP-SPDR. You have a homeatic ccu - maybe, could be a not so much expensive solution.

My idea is to use an Panasonic GridEye Sensor to track the heads going through a door frame.

I already have some data from these sensors in this position and I think it will work but didn’t had the time to write the code for it.

Which only shows when window is beeing open/closed. Not if anyone leave/enters through the window :smiley:

Hi @KenkiCK,
that was also something I found but it#s about 100€ each and I need about 16 of those. Read alot about it and yes, my Pi4 with OpenHabian is able to connect/read Homematic signales, bought an addon which works without CCU or whatever it is called.

How long does the battery last?


Hi @sapkra,

that looks promissing but I guess its way to complex for me.
Reading about the sensor makes me feel that this is the very perfect and most advanced solution but additional HW and SW is needed.

The Devkit already has USB and Bluetooth Support but costs much more. But yeah, it’s definitely complicated.

FYI: After hearing of some tests about the Homematic Sensor, telling that it is not working reliably for counting people, I’ve ask the Homematic team at a trade fair and they also said that it is just a hacky solution which was implemented later and will not work for this case because that’s not what the sensor was built for.

For such a huge of sensor I think you can get a good discount. By the way - batteries are not a issue - I have add a lot of HM components (motion, heating, door contacts, …) in the last 3 years and only for two sensors I must change the batteries. Here I’m very glad and it works pretty well.

Hi @sapkra,

no way… they said that, they said “…it is just a hacky solution which was implemented later and will not work for this case”. Wow.

@KenkiCK: You have it, you are using it (HMIP-SPDR). May I ask you to share your experience with that Sensor? I really need the ablity to say “Yes, at least one person is in the room”.

Never thought it’s so challenging

You might re-cast that requirement as -
“The room is unoccupied”

I think that illustrates the problem better. It’s really easy to detect motion, it’s easy to improve on that with multiple sensors, timers and wasp-in-box algorithms and so on.
It’s just plain difficult to detect someone sitting quietly reading, or dozing in the dark.

Nobody believes this until they try it.


Yes, it works well for me - but I think there are other option if you don’t want count the number of persons. there are also other sensors for only presence detection (also from HM). My suggestion to use homematic was 1. the integration into a complete system and the integration in OH because I have a lot of sensor of differend manufactors. On the other hand I calculate my effort to setup it f.e. with a PIR and Raspberry zero solution. But … every solution works not to 100 % - 95 % you can reach with a “normal” effort, for the last 5 % you need a lot of more effort like the 95 % . Wish you you find a good solution, let us know which way you will go.

I’m reminded of a movie where characters turned up the heat in a room so that their heat signatures would blend in (can’t remember the title). I didn’t fully get it when I watched the movie, because I hadn’t tried it myself. Now I know that contrast is everything when it comes to infrared motion sensors.

I think the thing with occupancy detection is that people often go into it thinking of a very specific use case or a single trigger, only to find out that there are many more variables that they had no reason to consider before.


The grideye sensor didn’t seem too bad but then maybe I know too little to know the effort needed.

The dev kit seemed easier and its wireless. There are examples of its use posted on the internet. Also, if building the grideye sensor directly connected to a pi I saw it supports i2c which is easilly enabled on a pi via config tool. Again plenty of examples posted.

I’ve used an older version of this before.

The Framework for Internal Navigation and Discovery ( FIND ) is like indoor GPS for your house or business, using only a simple smartphone or laptop.

Ich mach’s mal auf Deutsch:

Es guibt von HomeMatic einen Durchgangssensor, der die Richtung des Durchgangs registrieren kann. Mit dem sollte das gehen.