Skip to content
Motion

HC-SR501 PIR Motion Sensor

Passive infrared motion sensor with adjustable sensitivity and time delay — ideal for security projects.

The HC-SR501 is a passive infrared (PIR) motion sensor that detects the change in infrared radiation as a warm body moves across its Fresnel-lensed sensing cone. It outputs a simple digital HIGH when motion is detected and LOW otherwise — no library, no bus protocol, just a digital read.

It's the standard part for motion-activated lighting, security alarms, and occupancy sensing. The catch that trips people up is the two onboard trim pots and one jumper: the sensitivity pot sets detection range (up to ~7m), the delay pot sets how long the output stays HIGH after triggering (5s to 300s, defaulting to a very long ~5min-ish setting out of the box that makes the sensor look "stuck" on first test), and the jumper selects single-trigger (L, output resets during the delay window) vs repeatable-trigger (H, output stays high as long as motion continues). It also needs a 30–60 second warm-up period after power-on to stabilize — false or missed triggers in that window are normal.

Specifications

Operating voltage4.5–20V DC (onboard regulator, commonly powered at 5V)
OutputDigital HIGH/LOW, 3.3V logic level
Sensing rangeUp to 7m, adjustable via sensitivity trim pot
Sensing angle<100° detection cone (Fresnel lens)
Delay time5s–300s, adjustable via delay trim pot
Trigger modeJumper-selectable: L (single trigger) / H (repeatable trigger)
Warm-up time30–60s after power-on before stable operation
Current draw<60µA standby

Pinout

PinNameDescription
1VCCPower, 4.5–20V DC (typically 5V)
2OUTDigital output — HIGH when motion detected, LOW otherwise
3GNDGround

Three pins only — no library or bus needed, just a digitalRead() on OUT. The two trim pots (sensitivity, delay) and trigger-mode jumper (H/L) are set by hand on the board, not via code.

Variants

VariantTemp rangeHum rangeAccuracyProtocolPrice
HC-SR501~$1–2
AM312 (mini PIR)~$1–2
RCWL-0516 (microwave radar)~$1–2

Board Integration

Wiring

Component pinBoard pinNote
VCC5V
GNDGND
OUTD7

Code

C++

Notes

No library needed. Allow 30-60s after power-up for the sensor to stabilize before trusting readings.