HC-SR501 PIR Sensor (Passive Infrared Sensor) + IR Proximity Sensor
π 1. HC-SR501 PIR Sensor (Motion Detection)
π What it does
Detects human/animal movement
Works based on body heat (infrared radiation)
π It does NOT detect objects, only motion of warm bodies
βοΈ Key Specifications
Voltage: 4.5V β 20V
Output: Digital HIGH (3.3V) when motion detected
Range: ~3 to 7 meters
Angle: ~110Β°β120Β°
Delay time: 5s β 300s adjustable
π§ Features
βοΈ Adjustable sensitivity + delay
βοΈ Two modes:
Repeatable (keeps detecting)
Non-repeatable
βοΈ Very low power (<50Β΅A standby)
βοΈ Uses Fresnel lens for wide detection
π Pinout
VCC β 5V
GND β GND
OUT β Digital pin
π‘ Applications
π¨ Security systems
π‘ Automatic lights
π Smart home automation
π£ Human presence detection
β οΈ Important Notes
Needs 30β60 sec warm-up
Cannot detect stationary person
Sensitive to heat changes
π 2. IR Proximity Sensor (Obstacle Detection)
π What it does
Detects objects (any material)
Works using IR reflection
βοΈ Key Specifications
Voltage: 3.3V β 5V
Range: ~2 cm β 30 cm
Output: Digital LOW when obstacle detected
IC: LM393 comparator
π§ Features
βοΈ Adjustable detection distance
βοΈ Fast response
βοΈ Works for any object (not just humans)
βοΈ Cheap & simple
π Pinout
VCC β 3.3V / 5V
GND β GND
OUT β Digital pin
π‘ Applications
π€ Obstacle avoiding robot
π¦ Object detection
π Line following robot
π Smart vehicles
βοΈ PIR vs IR Sensor (VERY IMPORTANT)
| Feature | PIR Sensor | IR Sensor |
|---|---|---|
| Detects | Human motion | Any object |
| Range | Long (3β7m) | Short (2β30cm) |
| Type | Motion sensor | Proximity sensor |
| Works on | Body heat | IR reflection |
| Accuracy | Good for motion | Good for distance (short) |
π§ When to use which
π Use PIR if:
You want human detection
Example: automatic light ON when someone enters
π Use IR if:
You want object detection
Example: robot avoiding obstacles
π₯ Pro Tip (Very Useful)
π Combine BOTH sensors:
PIR β detect human presence
IR β detect distance/obstacle
β‘οΈ Used in:
Smart robots
Smart doors
Advanced IoT systems
β οΈ Common Beginner Mistakes
PIR not working β didnβt wait warm-up time
IR giving false output β not adjusted potentiometer
Using PIR for object detection β (wrong sensor choice)
