PIR sensor presence detection

I have a simple noob question how PIR sensors actually works and which one fits my needs.

I understood that it captures the heat from an object. What I do want is not only to trigger the light but also keep the light on if the person (the object emitting heat) is in the range of the PIR sensor.

Is that possible please?

A passive infra-red sensor (PIR) triggers only when a heat source moves across zones of the sensor. So to stay triggered the heat source would have to be constantly moving. You can set up your automations so that the light only turns off if there has been no movement for a certain time. See here for an example of this sort of automation.

See this diagram showing the zones of a typical sensor:

images

Some sensors are ‘pet-immune’. They don’t detect small heat sources moving down low. Most also have a sensitivity or pulse count setting so that an object has to move though a zone (or multiple zones) more than once to be triggered.

PIRs are not as sensitive at detecting heat sources moving directly towards them (as you are likely to stay in one zone). Mount the sensor so that people move across the front of the sensor and thus cross multiple zones.

I use them effectively to trigger lights in traffic areas (e.g. hallways) but do not use them in rooms where I can be still for some time (e.g. living room).

Be aware that battery powered wireless PIRs will have a minimum on time (from 30 seconds to 5 minutes, depending on the model). This is done to conserve battery life and can interfere with your intended automations.

One last thing, if used outside make sure you have a condition that only allows switching of the light after sunset. The sun moving to or from behind a cloud will trigger them. This is not as much of a problem indoors but try not to install them facing windows. There are ‘outdoor’ PIRs that also have Doppler radio movement detection sensors and both the PIR and Doppler sensors have to be triggered to cause an output. This is supposed to prevent false triggering by the sun. However in practice warm air currents can trigger the Doppler sensor and you still get false triggering.

2 Likes

Thank you for great answer. I have with PIR sensors at work WC. It was often going off and it turned me crazy.

I was going to use PIRs on the hall, wc, bathroom and kitchen but it seems that except hall it would be better to just use the old fashioned wallswitch.

I have one in the kitchen and as long as I’m not standing at the stove stirring a pot for too long it works well. Even then I just have to do a little dance and the light comes back on.

Ok then which one to choose?

And another question is, which one to choose for turning on the lights based just on light intensity not by movement as I think it is capable of this function right?

No, you need a lux sensor for light levels. Some zigbee and zwave sensors have this built in.

There’s also a class of PIR sensors known as occupancy detectors. They’re designed to detect very minor movements. As a consequence of their high sensitivity, they are not suitable for security purposes (i.e. greater potential for false detection). They also tend to be more expensive than standard motion detectors.

They also tend to be mains powered rather than ELV.

Yes! An important detail I overlooked to mention. Here are a few ceiling-mounted models from Leviton’s line-up and not a battery-powered one in the lot (mains or low-voltage only):

Yeah, I’ve been searching for an ELV version for ages and have yet to find one. Let me know if you do!

Funnily enough, I don’t think I’ve ever looked for a battery-powered version. Most everything in my home is hard-wired because:

  • I started automating my home in 2006 when battery-powered devices weren’t as numerous, or power-efficient, as they are today.
  • Reliability.
  • Low maintenance.

The flip side is, of course, high installation effort! I’ve become intimately familiar with my home’s “innards” and where I can and can’t easily run wires. To be honest, “easily run wires” is something I’ve yet to experience; a Saturday afternoon qualifies as “easy”. :slight_smile:

The exact reasons my door/window reed switches, smoke, and PIR sensors are all wired. All 12V though.

I’m sick to death of crawling around in the roof and under the floor!

I still went wifi ESPs for environment sensors but they are less critical and since going with Unifi APs all over the place extremely reliable.

Minor additional note on PIR sensors:

Most have just a single fixed IR sensor. In front of it is a fresnel lens (the milky translucent plastic cover) which fragments the image into dozens of tiny images, sort of like an insect compound eye. The entire set of images is focussed onto the one one sensor. As you move in front of the sensor, your image flickers across all the tiny images, causing the IR level on the sensor to flicker up and down. It’s the flickering IR input that it detects as movement. One way to change the sensitivity of the detector to movement is to change the fresnel lens.

True. Also you can slide some PIR boards up or down in the enclosure to change the range simply by moving the focus of the lens:

Guys I did not expect so much cool details! Thanks! Can you recommend me some? Maybe I will go for the Xiaomi ones.

1 Like

We live on a big house around 400m2.
We have several PIR sensors that are connected to HOME Assistance.
They work smoothly.

I want to design a card that will show room occupancy based on the PIR detection.
What is the easiest way to do it ?

Assuming your PIR are linked to an area you could search for them in a certain state (e.g. ON) and only display area… an example below for lights that are ON

{% set ns = namespace(areas=[], lights= expand(
      states.light|selectattr('name','ne','All')) | selectattr("state","eq","on") | list) %}
    
    {% for elm in ns.lights if not area_name(elm.entity_id) in ns.areas%}
       {% set ns.areas = ns.areas + [area_name(elm.entity_id)] %}
    {%- endfor %}
    
    {% for area in ns.areas -%}
    {{ area_id(area) }},
    
    {%- endfor %}

EDIT: the result can be used e.g. in a markdown card (areas are not entities and not many cards can handle that)