PIR Motion Sensor HC-SR501
Senses changes in infrared radiation to detect motion.
What is the PIR Motion Sensor HC-SR501 and what is it used for?
Senses changes in infrared radiation to detect motion. Makers use it for activate low-power alarm indicator.
Lighting and occupancy detection
Sensors convert a physical quantity into an electrical signal. Calibrate, verify module supply, interfaces and environmental limits.
Key specifications
| Sensor spec | Value |
|---|---|
| Measures | Movement of warm bodies (passive infrared) |
| Range | Up to about 7 m, 110° cone |
| Accuracy | On/off output |
| Interface | Digital output, 3.3 V HIGH when triggered |
| Supply voltage | 5 to 20 V (onboard 3.3 V regulator) |
| Operating temperature | −15 to 70 °C |
Pinout
How to use it
Wait about a minute after power-up while it settles. The 3.3 V output works with both 5 V and 3.3 V boards.
void setup() { Serial.begin(9600); pinMode(2, INPUT); pinMode(13, OUTPUT); }
void loop() { int m = digitalRead(2); digitalWrite(13, m); if (m) Serial.println("motion"); delay(100); }Applications
Builds that use it
Desk motion counter
PIR intruder alarm with arm button
GSM intruder alert by SMS
Motion-triggered security camera on Raspberry Pi
ESPHome sensors in Home Assistant
Solar bird scarer for crop fields
Smart air freshener
Smart mirror with weather and calendar
Common questions
What is the PIR Motion Sensor HC-SR501 used for?
In products: lighting and occupancy detection. In maker projects: activate low-power alarm indicator.
How does the PIR Motion Sensor HC-SR501 work?
Sensors convert a physical quantity into an electrical signal. Calibrate, verify module supply, interfaces and environmental limits.
What voltage does the PIR Motion Sensor HC-SR501 need?
5 to 20 V (onboard 3.3 V regulator).
How do I connect the PIR Motion Sensor HC-SR501 to an Arduino or ESP32?
Digital output, 3.3 V HIGH when triggered. Pins: VCC (5 V), OUT (3.3 V HIGH on motion), GND (Ground), Sx trimmer (Sensitivity (range)), Tx trimmer (Hold time, about 3 s to 5 min), Jumper H / L (H: retrigger while moving; L: single trigger).
