Pir sensor with analog output

PIR sensors are used to detect motion. So what I am trying to do is to have 4 of them to detect direction of movemenmt. My problem is all PIR sensor I have seen so far has an adjustable delay before firing (approx 2-4 seconds), adjustable sensitivity and gives high/low output.

Is there any small pir sensor out there that has analog output instead of digital with delay or digital without delay? Preferably a breakoutboard to make it easy to test in arduino first.

Sounds like you need to look at ultrasonic sensors if you're wanting distance tracking.

I want to track if person are going into the room or leaving, if coming in sensor A gets triggered before B and other way when leaving, problem with digital out is that the pin stays high for more than 200-500ms then you will not be able to detect if the person change it minds and turn around and leave. By using 4 or more in array they can also enter diagonal or any angle.. Hence I am looking for one with digital output and no delay or analog..

Now you're talking about object tracking. What do these sensors control? Counter? Lights?
You need to consider how the setup will differentiate scenarios. Could 2 people confuse it?
Please describe the layout. Stairs? Hallway? Door? Etc.

What I want to achieve is to count people in the room,

The sensor is to be mounted in the ceiling, and will be triggered by door opening in most cases(entrance,bedrooms,balcony and bathroom), however I do have two open zones(no door) which I would also like to count people in. These zones are kitchen and living room.

I will use arduino to set a counter, i.e livingRoomCounter = 3 the logic to handle what to do with this counter will be regulated by rules in Openhab(my smart home system) to set light,temperature,music and ventilation.

For instance, if I leave the leaving room and enter bathroom, lights will go on in bathroom, the music will change speaker to bathroom, however if my gf is still left in i.e livingRoomCounter = 1 then also keep playing in livingroom.

On top of this I also know what time of the day it is and what scene is activated and can also use this in my rules what to do when the counter changes. For instance if its after 10pm and all counters except of bedrooms are 0 then I can activate nightmode(door locks, tv and music in all rooms(except bedroom) will enter sleepmode,lights will then turn red(if someones gets up in the night), phone are set to silent(IFTT trigger), switch off floor heating, slow down ventilation in all rooms except of bedrooms. )

That was my idea, feel free to collaborate about the idea

But to achieve this i need to know how many is in each room. Or rather i need to know if a room is empty or not.. Maybe IR camera instead or netatmo welcome camera?

So actually counting people is irrelevant, you just need to know if anyone is present, right?

Yes, but its hard to use IR and cover a whole large room, that means you need many IR sensor to make sure that you have covered every square meter of the room, thats why I thought counting people would be easier.

It isn't.

These PIR sensors are not very directional, they look everywhere at once, so t
they aren't very useful for counting. The Prismatic polythene lens used provides
sensitivity to motion by fragmenting the heat image, so that motion leads to
intensity variation.

A thermal imager is needed for more localized sensing I reckon. You can get
4x4 thermal imagers, but they cost more and the lenses for them are expensive
too unless you can make your own from pure germanium or silicon or certain
plastics, or make do with the reduced sensitivity of a pinhole camera arrangement.

So Mark, can I use some other sensor instead, IR Diodes, Laser, Ultrasonic?

So INTP, how can I differentiate if someone is in Kitchen or Living room with PIR sensorwhen the layout is open, (only one way to enter the kitchen area though), should I also remove the lens cover?

They are motion sensors, not presence sensors, they only respond to change. If someone is sat down
not moving they will not detect them.

To detect someone moving through a doorway light beams are quite a straightforward way - two beams
gives information about which way someone went, but they can still be fooled by stray light or someone
hovering in the doorway.

You know that accurate counting of room occupancy is a known hard problem?

Hey skatun,

I had the exact same idea and goal, but my lack of electronics experience is making it difficult to put together a solution.

You're on the right track, though. A single PIR sensor has two "windows" and a voltage difference when something passes in front of one, then the other "window". This link explains it better: How Infrared Motion Detector Components Work

Notice the positive/negative peak and valley of the analog signal. Regular digital PIR motion sensors use a comparator that ignores the sign and just checks whether there's a large enough voltage difference to trigger the binary motion sensor (on/off).

Without a fresnel lens in front of the naked PIR sensor, the two "windows" can discern movement individually up to 3-4 feet, enough to detect a person's head and shoulders passing through the doorway.

Sadly, there are two roadblocks here (for me). The first is that I have no idea what kind of circuit would give an Arduino a +1, 0 (no motion) or -1 digital signal depending on which "window" got triggered first (basically, whether the voltage was positive or negative).

The second is that such a device has already been patented in 1994 (US5291020A - Method and apparatus for detecting direction and speed using PIR sensor - Google Patents), even though there are no products out there that detect direction of motion using a single PIR sensor. The guys at Glolab (first link above) sell one with two sensors, but it's prohibitive and overkill for what you and I are trying to achieve.

So please let me know if you figure this out, I'd love to be able to count people entering/leaving a room, even if it requires manual adjustment or resetting the number of occupants, from time to time (I'm a home-assistant user).

Good luck!

I was thinking of something somewhat similar where I need to know if someone is approaching or moving away from the sensor. Assuming an analog PIR sensor, is the voltage output from the PIR sensor a function of distance? Is it possible to tell whether someone is becoming nearer by tracking the amplitude of the PIR sensor output? ie. is the amplitude higher as someone is approaching the sensor? Thanks

Good discussion. I wonder what the end solution was.

There are analog sensors but they aren't cheap, e.g. Panasonic AMN21111

I was going to use infra-red in a larger array for tracking general motion outdoors. It does seem for indoors "passage counts' ultra-sonic sensors would be more fun. You get distinct signatures in the echo patterns. Using multiple ultra-sonic sensors can result in "cross-talk", like feedback, which can handled by time slicing the scans or thru wiring the sensors to trigger in sequence.