Reading a PIR motion sensor
Warm-up time, hold time and retrigger mode explained with an HC-SR501.
A PIR sensor detects changes in infrared radiation across its sensing zones. Movement across the field of view often produces a stronger change than movement straight towards it. It is not a distance sensor and cannot reliably detect a completely stationary person.
Check the module PCB markings before connecting wires. For the HC-SR501 on a 5V UNO, connect VCC to 5V, GND to ground and OUT to a digital input such as D2. Module pin order is not universal. A typical output HIGH is around 3.3V, which the UNO can read.
Allow at least 60 seconds of settling after power-up, and longer if the output remains unstable. Avoid sunlight, heaters and air currents near warm objects during your first test. Read OUT with digitalRead() and print the value at 9600 baud.
The delay control sets how long the output stays HIGH after detection. The sensitivity control changes the response range. Many modules offer H retrigger mode, which extends the HIGH time with further movement, and L non-retrigger mode. Confirm the jumper markings on your specific module.
Build the PIR Motion Indicator project and compare jumper modes while keeping the same test distance. Record the warm-up duration and output hold time before changing the controls. Treat the build as a demonstration rather than a security system.
