Pir sensor with analog output

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!