

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 component is widely used in security systems, home automation, and DIY electronics projects. It is particularly popular for triggering alarms, lights, or other devices when motion is detected.








The HC-SR501 PIR sensor is a versatile and adjustable module with the following key specifications:
| Parameter | Value |
|---|---|
| Operating Voltage | 4.5V to 20V DC |
| Quiescent Current | < 50 µA |
| Detection Range | Up to 7 meters (adjustable) |
| Detection Angle | Approximately 120° |
| Trigger Modes | Repeatable (default) and non-repeatable |
| Output Voltage | High: 3.3V, Low: 0V |
| Output Duration | Adjustable (0.3s to 5 minutes) |
| Operating Temperature | -15°C to +70°C |
| Dimensions | 32mm x 24mm x 25mm |
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 Example with Arduino UNO
// 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
}
No Motion Detected:
False Triggers:
Output Stays HIGH:
Short Detection Range:
Q1: Can the HC-SR501 detect motion through glass?
A1: No, the HC-SR501 cannot detect motion through glass as infrared radiation does not pass through it effectively.
Q2: What is the maximum detection range of the HC-SR501?
A2: The maximum detection range is approximately 7 meters, depending on the sensitivity setting and environmental conditions.
Q3: Can I power the HC-SR501 with a 3.3V supply?
A3: No, the minimum operating voltage is 4.5V. Use a power supply within the 4.5V to 20V range.
Q4: How do I switch between trigger modes?
A4: Use the onboard jumper to toggle between repeatable and non-repeatable modes. Refer to the module's markings for guidance.
By following this documentation, you can effectively integrate the HC-SR501 PIR sensor into your projects and troubleshoot common issues with ease.