

The HC-SR501 is a passive infrared (PIR) motion sensor designed to detect motion by sensing changes in infrared radiation emitted by objects in its field of view. This sensor is widely used in security systems, home automation, and robotics projects to trigger actions such as turning on lights, activating alarms, or starting recording devices when motion is detected.








The HC-SR501 is a versatile and adjustable motion sensor with the following key specifications:
| Parameter | Value |
|---|---|
| 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 (default) and Non-repeatable |
| Output Voltage (High) | 3.3V |
| Output Voltage (Low) | 0V |
| Delay Time | Adjustable (0.3 seconds to 5 minutes) |
| Sensitivity | Adjustable via onboard potentiometer |
| Dimensions | 32mm x 24mm x 25mm |
The HC-SR501 has three pins for interfacing with external circuits:
| 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 |
VCC pin to a DC power source (4.5V to 20V) and the GND pin to the ground.OUT pin to a microcontroller's digital input pin or directly to an external device (e.g., an LED or buzzer).Below is an example of how to connect and use the HC-SR501 with an Arduino UNO to control an LED when motion is detected.
VCC pin of the HC-SR501 to the Arduino's 5V pin.GND pin of the HC-SR501 to the Arduino's GND pin.OUT pin of the HC-SR501 to Arduino digital pin 2.13 with a 220-ohm resistor in series.// HC-SR501 Motion Sensor with Arduino UNO
// This code turns on an LED when motion is detected.
const int pirPin = 2; // HC-SR501 OUT pin connected to digital pin 2
const int ledPin = 13; // LED connected to digital pin 13
void setup() {
pinMode(pirPin, INPUT); // Set PIR sensor pin as input
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(9600); // Initialize serial communication for debugging
}
void loop() {
int motionDetected = digitalRead(pirPin); // Read PIR sensor output
if (motionDetected == HIGH) { // If motion is detected
digitalWrite(ledPin, HIGH); // Turn on the LED
Serial.println("Motion detected!"); // Print message to serial monitor
} else {
digitalWrite(ledPin, LOW); // Turn off the LED
}
delay(100); // Small delay to stabilize readings
}
Sensor Not Detecting Motion:
False Triggers:
Output Stuck HIGH or LOW:
Q: Can the HC-SR501 detect motion through glass?
A: No, the HC-SR501 cannot detect motion through glass, as infrared radiation does not pass through it effectively.
Q: How do I increase the detection range?
A: Adjust the sensitivity potentiometer clockwise to increase the detection range. Note that increasing sensitivity may also increase false triggers.
Q: What is the maximum detection angle of the HC-SR501?
A: The sensor has a detection angle of approximately 120°, which is determined by the Fresnel lens.
Q: Can I use the HC-SR501 with a 3.3V microcontroller?
A: Yes, the output of the HC-SR501 is 3.3V, making it compatible with 3.3V logic levels. However, the sensor itself requires a power supply of at least 4.5V.
By following this documentation, you can effectively integrate the HC-SR501 motion sensor into your projects for reliable motion detection.