A PIR sensor is a device that can detect infrared light (heat) emitted by an object (for example, a person). We see these types of sensors all around us in applications such as security systems and automatic doors and lights that react to our presence. The passive in PIR means the sensor just detects movement. To detect what moved and how, you would need an active infrared device, such as a thermal camera.
PIR sensors come in a few different forms and varieties; however, their basic usage is the same – they act as a simple digital switch. When they do not detect movement, they output a digital LOW, and when movement is detected, they output a digital HIGH.
Shown in the following figure is the HC-SR501 PIR sensor module that we will be using for our example. Pictured are the top of the module, the underside, and a common schematic symbol for a PIR sensor:
Some PIR sensors, including our...