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)
