

The HC-SR501 is a passive infrared (PIR) motion sensor designed to detect motion by sensing changes in infrared radiation emitted by objects within its detection range. This sensor is widely used in security systems, home automation, and DIY electronics projects. It is capable of detecting motion from humans or animals and can trigger actions such as turning on lights, activating alarms, or sending signals to microcontrollers like Arduino.








The HC-SR501 PIR sensor is equipped with adjustable settings for sensitivity and delay time, making it versatile for various applications. Below are its key technical details:
| Parameter | Specification |
|---|---|
| Operating Voltage | 4.5V to 20V DC |
| Operating Current | < 60 µA |
| Detection Range | Up to 7 meters (adjustable) |
| Detection Angle | Approximately 120° |
| Trigger Modes | Repeatable (H) and Non-repeatable (L) |
| Delay Time | Adjustable (0.3 seconds to 5 minutes) |
| Sensitivity Adjustment | Adjustable via onboard potentiometer |
| Output Voltage (High) | 3.3V |
| Output Voltage (Low) | 0V |
| Dimensions | 32mm x 24mm |
The HC-SR501 PIR sensor has three pins for interfacing:
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power supply input (4.5V to 20V DC) |
| 2 | OUT | Digital output pin (HIGH when motion is detected) |
| 3 | GND | Ground connection |
Below is an example of how to connect and program the HC-SR501 PIR sensor with an Arduino UNO to control an LED:
// HC-SR501 PIR Motion Sensor with Arduino
// This code turns on an LED when motion is detected.
#define PIR_PIN 2 // HC-SR501 OUT pin connected to digital pin 2
#define LED_PIN 13 // LED connected to digital pin 13
void setup() {
pinMode(PIR_PIN, INPUT); // Set PIR sensor pin as input
pinMode(LED_PIN, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication for debugging
}
void loop() {
int motionDetected = digitalRead(PIR_PIN); // Read PIR sensor output
if (motionDetected == HIGH) { // If motion is detected
digitalWrite(LED_PIN, HIGH); // Turn on the LED
Serial.println("Motion detected!"); // Print message to serial monitor
} else {
digitalWrite(LED_PIN, LOW); // Turn off the LED
}
delay(100); // Small delay to stabilize readings
}
The sensor does not detect motion:
False triggers or inconsistent detection:
Output remains HIGH even when no motion is present:
Output signal is weak or unstable:
Q: Can the HC-SR501 detect motion through glass or walls?
A: No, the HC-SR501 cannot detect motion through glass or walls as they block infrared radiation.
Q: How do I increase the detection range?
A: Turn the sensitivity potentiometer clockwise to increase the detection range. However, be cautious of false triggers at higher sensitivity levels.
Q: Can I power the HC-SR501 with a 3.3V supply?
A: No, the minimum operating voltage is 4.5V. Use a power supply within the 4.5V to 20V range.
Q: How long does the sensor take to stabilize after powering on?
A: The sensor typically requires 30-60 seconds to stabilize before it starts detecting motion.
By following this documentation, you can effectively integrate the HC-SR501 PIR sensor into your projects and troubleshoot common issues with ease.