Effective Ways To Detect People Using Common Sensors

Updated 06 June 2023

In this guide, we'll look at common methods of detecting people and some of the different sensors you can use to detect people in your next project.


Introduction

Being able to determine if a person is (or is not) physically present can be useful for a range of IoT and Home Automation applications, such as automatic lighting and surveillance systems.

There are many creative ways to build people detectors using common electrical components, however, in this guide, we're going to focus on a handful of purpose-built sensors that are cheap, easy to source, and most importantly easy to use!


People Detection Methods

The sensors we will be looking at all have one thing in common: they detect people by detecting changes to a specific attribute of their physical environment, such as changes to light or sound.

The methods these sensors use to detect these changes fall into two broad categories: Area-based detection and Distance-based detection.

Area-Based Detection

Area-based detection works by the sensor measuring radiation - such as Infrared or Microwave - across a wide viewing area, and then comparing those measurements to look for fluctuations beyond what is 'normal', such as a person walking across the viewing angle.

These types of sensors typically output their detections using a simple 'HIGH' or 'LOW' electrical signal on a single pin/wire, and while that gives us only the bare minimum amount of information to work with ('detected' or 'not detected'), it does make them easy to use in analog circuits such as outdoor sensor lights. That's not to say you can't use them with a microcontroller though!

Area-based sensors are useful for detecting if movement happens somewhere within a large environment, such as a backyard or a room in your house. However, they are typically limited to detecting movement only - for example, if you stay within the viewing angle but stop moving you can usually trick the sensor into thinking you are no longer there, as the sensor no longer sees any fluctuations in its measurements.

PIR Sensors Detect Light From A Wide AreaPIR Sensors Detect Light From A Wide Area
PIR Sensors Detect Changes In Light Across A Wide Area

Distance-Based Detection

Distance-based detection works by the sensor sending out a signal - such as an ultrasonic ping or a laser beam - in a single direction and then timing how long that signal takes to bounce back to the sensor. The sensor uses the measured timing and the known speed of sound or light to calculate how far away the object is that the signal bounced off.

These sensors don't actually decide if a person is detected, rather they output the measured distance and it is up to you to monitor the measurements and decide if a change is likely to mean a person has been detected - such as a person walking in front of the sensor. The measurements are usually sent using a communication interface such as I2C or Serial, so you will need a microcontroller to use them, such as a Raspberry Pi Pico.

Distance-based sensors are useful for detecting if movement happens across the direct path of a single line, much like a trip-wire. A common example is detecting when a person walks through a doorway - in which case the measurements from the sensor will rapidly change as the person momentarily walks through the path of the sensor.

They can also be used for other interesting applications such as determining if a person is present and not moving significantly - such as sitting at a desk, or if a person is moving along a straight path - such as a hallway. In these cases, we could decide to keep lights on in an office as we know someone is present even though they are not moving, or to turn on/off lights in time with the person walking down the hallway.

Ultrasonic Sensors Calculate Distance Using The Timing Of Sound WavesUltrasonic Sensors Calculate Distance Using The Timing Of Sound Waves
Ultrasonic Sensors Calculate Distance Using The Timing Of Sound Waves

Sensor Types

Now that we know the two methods of detection, let's look at some common sensor types and the method each uses - PIRs, Radar, Ultrasonic, and Laser.

PIR Sensors

PIR, or Passive Infrared, Sensors are area-based and monitor Infrared Radiation - or in simple terms they monitor for heat.

They consist of a Pyroelectric Sensor, which is an IR detector composed of two halves - which you can think of as two small windows.

Sitting atop the windows is a semi-transparent dome called a Fresnel Lens, which directs light coming from different directions straight into either of the two windows.

A Common PIR Motion Sensor

The PIR detects movement by comparing the amount of Infrared being received by either window. If either of the two windows detects more IR than the other window the PIR decides that something has moved in front of it, and outputs a HIGH or LOW signal.

The image on the right demonstrates the difference in Infrared being received by either window in a PIR when a person walks in front of the sensor. Note in reality the fresnel lens drastically reduces the resolution of the incoming radiation, and the pyroelectric sensor perceives the Infrared radiation as an electrical signal, not an image.

The heat from our body radiates as Infrared, which makes the PIR sensor great for detecting people. But this also makes them susceptible to interference from other heat sources - especially the sun.

PIR Sensors work best in spaces out of direct sunlight, and that don't have fluctuating heat sources such as fireplaces.

Example of what a PIR would be seeing in either window when a person walks in front of itExample of what a PIR would be seeing in either window when a person walks in front of it

The circuitry on a common PIR contains two trim-pots which allow you to adjust the sensitivity and delay time of the sensor.

Adjusting the sensitivity affects how much IR radiation is required to make the sensor trigger, which in turn also affects the detectable distance of the sensor.

Adjusting the delay time affects how long the sensor output stays HIGH once a movement is detected. For example, a sensor light with a high delay time set will have its light stay on for a long time after a movement is detected.

To use a PIR sensor in a circuit only three connections are needed:

  • VCC -> Goes to your circuit positive power and usually needs to be 5V.
  • OUTPUT -> Goes to an input pin on your microcontroller. When this pin reads a LOW signal, there is no motion detected. When the pin reads a HIGH signal when motion has been detected.
  • GND-> Goes to ground in your circuit.

Radar Sensors

Radar Sensors are also area-based, and work by emitting a signal at high frequencies and watching for changes in the signal when it bounces back at the sensor.

Two common types are Microwave and Millimetre-wave - which operate at different frequencies in the RF spectrum.

One primary advantage they have over PIR sensors is that they can detect motion through solid non-metal surfaces, making them handy for putting inside a waterproof enclosure or detecting movement through walls and ceilings.

Radar sensors are not susceptible to infrared interference like PIR sensors are, which makes them an ideal replacement for areas where PIRs cannot be used such as in direct sunlight. However, only some Radar Sensors support controlling their sensing range, such as the SEN0395 mmWave Sensor mentioned below.

Controlling a Radar's sensing range can be useful for ensuring that the sensor only monitors a specific area. For example, since a Radar can detect through walls, limiting the sensor range can ensure that false positives are not triggered by movement in another room.

Image Source: https://github.com/jdesbonnet/RCWL-0516

RCWL-0516 Microwave Sensor

An example of a Microwave Sensor is the low-cost RCWL-0516 3GHz Presence Sensor.

It is operated much like a PIR Sensor with an output pin that goes HIGH when motion is detected. Additionally, it supports connecting a Light Dependant Resistor to disable the output when it is light, which can be used as an extra feature when controlling lighting.

The sensitivity/sensing area of this sensor cannot be controlled, and any delay timing needs to be manually implemented in your own code on a microcontroller. However, it is a great alternative for a PIR as it is priced equivalently to a basic PIR, works inside a project box, and isn't affected by IR interference.

SEN0395 mmWave Sensor

An example of a Millimetre-wave Sensor is the SEN0395 24GHz mmWave Radar.

This sensor is more expensive than the RCWL-0516 Microwave Sensor, however, it comes with more features - the most significant of which is that this sensor can detect presence with and without movement.

For example, if a person were to walk into a room and then sit down at a desk and stop moving, this mmWave sensor would continue to detect the person's presence once they stopped moving, whereas the PIR and Microwave would have only detected the initial movement.

In addition to providing a HIGH/LOW output (on the IO2 pin) like the PIR and Microwave sensors, this sensor also provides a UART interface for configuring the detection distance and timing of the sensor, as well as reading the detection state over Serial.

There's some discussion about this module on the forums, if you have your own experiences with it we'd love to hear from you!

SEN0395 mmWave Radar SensorSEN0395 mmWave Radar Sensor
SEN0395 mmWave Radar Sensor

Ultrasonic Sensors

Ultrasonic Sensors are distance-based, and work by emitting sound waves in the ultrasonic frequency and timing how long those sound waves take to return to the sensor.

Ultrasonic Sensors are cost-effective and are not affected by light or heat interference, making them suitable for use in direct sunlight or other places a PIR or Laser sensor cannot be used reliably.

However, they do have a limited range (typically up to a few meters) and are susceptible to sound interference, making them unsuitable in noisy environments - especially with ultra-high-pitched noises.

Check out our in-depth guide on the PiicoDev Ultrasonic Rangefinder for more details on how to use an Ultrasonic Sensor.

PiicoDev Ultrasonic RangefinderPiicoDev Ultrasonic Rangefinder
PiicoDev Ultrasonic Rangefinder

Laser Sensors

Laser Sensors are also distance-based, and work by sending light waves out in the infrared or ultraviolet frequencies and timing how long those light waves take to return to the sensor.

Laser Sensors are a good alternative to Ultrasonic Sensors when accuracy or distance is a priority, as they have up to millimetre accuracy, and typically a much large working distance than Ultrasonic.

Laser Sensors are also not susceptible to sound interference like Ultrasonic Sensors, which can make them a good alternative in noisy environments. However, they are susceptible to interference from light in the infrared spectrum, which sunlight contains lots of, so these sensors work best when indoors.

Check out our in-depth guide on the PiicoDev Laser Distance Sensor for more details on how to use a Laser Sensor.

PiicoDev Laser Distance SensorPiicoDev Laser Distance Sensor
PiicoDev Laser Distance Sensor

Other Sensor Types

We've covered the most common types of sensors for detecting people, but there are many other ways it can be done, for example:


Conclusion

If you're detecting people in an interesting way, or if you have any questions about anything from this guide, let us know about it on the forums.

Until next time, happy making!

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.