How to Use a PIR Sensor

Reading Time: 7 min

Learn about how PIR sensors work, and their applications in the workplace

PIR sensors, or passive infrared sensors, have been around for some time. If you’ve ever heard of someone talking about night-vision goggles or thermal cameras, they are actually referring to infrared sensors! But what is the science behind these? And how are they practically applied in real life (and not in movies)?

What is infrared radiation?

Infrared radiation is, as many of us probably remember from high school science, a band of wavelengths in the light spectrum. Essentially, if an atom emits a photon with a certain amount of energy that’s just lower than visible light, it will be classified in the infrared spectrum.

‍In practice, humans perceive IR light as heat. Any warm body that emits heat continuously at all frequencies of light is called a black body - you may have heard the term black body radiation used in reference to the sun! Thus, these bodies emit in the infrared and ultraviolet ranges, as well as in the visible range. Here is a chart of black body radiation for objects of varying temperatures. As you can see, the colder the object, the more shifted towards longer wavelengths the “peak emission” is. This means that warmer objects, like the sun, will emit mainly in visible and ultraviolet light, whereas cooler objects, like a lightbulb, or even a warm-blooded animal, will have a longer peak wavelength, meaning their black body spectrum will be shifted towards the infrared or beyond (to microwaves and radio waves).

The main takeaway here is that every warm body emits light, and the peak of that is often not in the visible light spectrum but in longer wavelengths, such as infrared.

What generates IR radiation?

As mentioned, every black body radiator emits infrared light, but in practice, we only really care about those objects that emit IR light but don’t emit visible light (if they did emit visible light, we wouldn’t need to detect IR light to “see” them!)

More significantly, humans emit infrared light! We can see each other in the daylight  because our bodies reflect emitted light from the sun. But because humans are also proper sources of infrared radiation, we are able to see each other with infrared sensors in environments without visible light. This is crucial to the importance of IR sensors.

And this is where the classic still frame of every action movie ever comes from, with the hero/heroine donning their IR goggles, and detecting the bad guys. Here’s an example photo, except that instead of a bad guy, it’s a cute kitty!

‍You may have heard this called “thermal vision” in these contexts — now you know why! You’ll notice the temperature readings on the side of the screen — at these temperatures, bodies don’t emit photons with high enough energy to be in the visible spectrum, but they are in the IR spectrum.

Passive vs Active IR Sensors

There’s a reason a PIR has the word “passive” as the first word in its name, and it’s not merely because it’s an inanimate object that has no motivation to get up off the couch and do its laundry or wash the dishes.

A passive sensor, as opposed to an active one, doesn’t actually emit any sort of radiation — it just receives it. So whereas an active IR sensor might emit an IR beam, and expect it to return (and perform analyses based on what it got back), a passive sensor will not emit any beam, and merely sense the ambient infrared radiation in its environment.

As a concrete example, a popular type of intruder detection system is the laser tripwire (you may have seen it done to death in spy movies). In this case, there is an active IR sensor, which emits the beam, and a passive one, which receives the beam, and when the passive one stops detecting, it can only mean that something interrupted the beam, which signifies an intruder.

Motion Sensing

The primary and most popular application of PIR technology is motion detection. Every motion detector that you will see that is not an actual visible light camera is a passive infrared detector.

The way they work is relatively straightforward: there is a sort of boxy device (though actual shapes vary) with a screen facing the room. The screen is generally only translucent to visible light: this prevents dust specs or other small particles from interfering with its operation. The screen, and almost all small particles, are transparent to IR radiation, but obstruct visible radiation. f the screen were to let in all visible light, it might qualify the wrong things as “motion” and raise a false alarm.

Behind the screen is the actual sensing camera. These are cameras that are optimized to detect in the IR range (though it’s quite difficult to exclude all other wavelengths, hence the screen), and it constantly keeps a general heatmap of its environment. The idea here is that when the general heatmap of the environment changes, it must be because an object with a different temperature than the ambient moved through it. So if we discount the highly unlikely scenario of a sentient space heater, the likeliest scenario is that a warm, living body moved through the space. At this point, the sensor triggers the alarm panel, and the motion alarm is raised.

Now, obviously, there remains the issue of the nature of the warm body that moved through this field of view. It could be that it was merely a cat, or a mouse, or even a human who was allowed to be there at that time. However, the PIR doesn’t concern itself with such questions: those are all handled on the back end by algorithms of varying sophistication. You can have anything ranging from highly advanced techniques for pattern recognition and gait analysis, to crude circuits that only detect deltas in temperature. However, the PIR sensor has done its job and detected motion.

Workplace Uses

Lighting Control and Door Opening

In common practice, probably the most common uses of PIR motion detectors are as automatic light switches and door openings. If you’ve ever seen a light switch with what looks like a blank screen above it, or some sort of strange camera above an automatic door, those are PIR sensors. They have algorithms that make it such that when they detect motion, they perform their assigned action, be it turning on the light, or opening the door. It’s the little things, right?

(PIR light switch)

Occupancy Measurement

A slightly more modern and sophisticated use of PIR sensors, using cutting-edge algorithmic techniques, is occupancy measurement. A PIR sensor in a given office room is constantly monitoring the space, so why not have some dev for the backend to make it do something useful with all the information it collects?

And that’s where the idea for occupancy measurement comes in. If you have a sufficiently granular image (detailed enough) from a PIR sensor, using computer algorithms it’s actually possible to count the number of humans in the room. The specific techniques are secondary, and vary from reader to reader (can be computing total area, or distinct bodies, etc.), but the result is that you can use that information to inform decisions about the space, such as alerting administrators that it is overcrowded, or calculating better fire escape routes.

Remote Thermometers

Another slightly less heralded but still important application of passive IR sensing is remote thermometers. As noted in the first section of this article, infrared light is essentially heat, so to detect IR radiation is to detect heat. Well if you’ve ever seen one of these bad boys lying around, you’ve seen that tech in action:

These sensors use a PIR sensor, with a much narrower field of view, of course, than PIR motion sensors. It will not only detect IR radiation, it will also register the intensity of that IR radiation. By comparing it to established baselines using some fancy algorithmic tools, it can translate that intensity to a numeric temperature. Neat!

Concluding Thoughts

In whatever form, passive infrared sensors present a clever bit of engineering in that they make use of a whole range of light that should be inaccessible to humans, but we’ve figured out a way to tame. Despite the amount of time they’ve been around, PIR motion sensors remain the leading standard for low-light situations, and will probably stay so for a while, as the laws of physics aren’t likely to change anytime soon.

Andrés Camperi

Product Platform