Introduction to HC-SR501
The HC-SR501 is the most widely used Passive Infrared (PIR) sensor module in the electronics hobbyist and prototyping community. This comprehensive guide covers everything you need to know about this sensor, from its physical pinout to advanced adjustment techniques.
The HC-SR501 is a low-cost, easy-to-use motion detection module based on infrared technology. It detects movement by measuring changes in infrared radiation levels emitted by warm objects, such as human bodies, within its detection range.
Technical Specifications
| Parameter | Value |
|---|---|
| Operating Voltage | DC 4.5V – 20V |
| Operating Current | < 50mA (typical 65µA in standby) |
| Output Voltage | High 3.3V / Low 0V |
| Detection Range | 3-7 meters (adjustable) |
| Detection Angle | < 120° (depending on lens) |
| Delay Time | 5-200 seconds (adjustable) |
| Block Time | 2.5 seconds (default) |
| Operating Temperature | -20°C to +80°C |
| Dimensions | 32mm × 24mm |
Pinout Diagram
The HC-SR501 has a standard 3-pin interface:
- VCC (Pin 1): Power supply input. Accepts 4.5V to 20V DC. For Arduino projects, connect to 5V pin.
- OUT (Pin 2): Digital output pin. Goes HIGH (3.3V) when motion is detected, LOW (0V) when no motion.
- GND (Pin 3): Ground connection. Connect to Arduino GND.
Understanding the Potentiometers
The HC-SR501 features two adjustable potentiometers that control its behavior:
Sensitivity Potentiometer (Distance Adjustment)
– Controls how far the sensor can detect motion
– Clockwise rotation increases detection distance (up to 7 meters)
– Counter-clockwise reduces distance (down to 3 meters)
– Labeled as “SENS” or “Distance” on the board
Time Delay Potentiometer (Duration Adjustment)
– Controls how long the output remains HIGH after motion is detected
– Clockwise rotation increases delay (up to 200 seconds)
– Counter-clockwise reduces delay (down to 5 seconds)
– Labeled as “TIME” or “Duration” on the board
Jumper Settings: Repeatable vs Non-Repeatable Trigger
The HC-SR501 has a jumper that selects between two trigger modes:
H (Repeatable Trigger Mode):
– Output remains HIGH as long as motion is continuously detected
– The delay timer resets each time motion is detected
– Recommended for most applications like automatic lighting
L (Non-Repeatable Trigger Mode):
– Output stays HIGH for the set delay time, then goes LOW
– Motion detected during the delay period is ignored
– Useful for applications requiring single-pulse detection
Wiring with Arduino
// HC-SR501 PIR Sensor with Arduino
int pirPin = 2; // PIR output connected to digital pin 2
int ledPin = 13; // LED on pin 13
void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int pirState = digitalRead(pirPin);
if (pirState == HIGH) {
digitalWrite(ledPin, HIGH);
Serial.println("Motion detected!");
delay(1000);
} else {
digitalWrite(ledPin, LOW);
}
}
Important Usage Notes
Warm-up Time: After powering up, the HC-SR501 requires a 30-60 second initialization period. During this time, it may trigger falsely multiple times. This is normal behavior as the sensor stabilizes.
Placement Considerations:
– Avoid placing near air vents or heat sources
– Keep away from direct sunlight
– Do not mount behind glass (glass blocks infrared radiation)
– Optimal mounting height: 1.5-2.5 meters
Common Applications
- Automatic lighting systems
- Security alarms
- Smart home automation
- Visitor counters
- Robotics obstacle detection
