IR (Infrared) Obstacle Avoidance Sensor Module
🔍 What this module is
The IR Obstacle Avoidance Sensor is used to detect nearby objects without contact.
👉 It works by:
Emitting infrared light
Detecting reflected light from objects
If reflection is detected → obstacle present
⚙️ Working Principle (simple)
IR LED sends invisible infrared light
Object reflects the light
IR receiver detects reflection
Comparator gives output (HIGH/LOW)
➡️ Output becomes LOW when obstacle detected (most modules)
⚙️ Key Specifications
Operating Voltage: 3.3V – 5V
Detection Range: ~2 cm to 30 cm (adjustable)
Detection Angle: ~35°
Output: Digital (HIGH/LOW)
Comparator IC: LM393 (common)
🔌 Pinout
3-pin version:
VCC → 3.3V / 5V
GND → Ground
OUT → Digital pin
4-pin version (some modules):
EN → Enable pin
🧠 Key Features
✔️ Adjustable sensitivity (via potentiometer)
✔️ Fast response (<10 ms)
✔️ Built-in LED indicators
✔️ Easy to use with Arduino / ESP32
✔️ Very low cost
💡 Applications
🤖 Obstacle avoiding robots
🚗 Smart cars / RC vehicles
📏 Proximity detection systems
🏭 Automation (object detection)
📦 Line-following robots
⚠️ Important Notes (very important)
⚠️ Works best for short distance only (few cm)
⚠️ Accuracy affected by:
Sunlight
Dark/black objects (absorb IR)
Reflective surfaces
⚠️ Not suitable for precise distance measurement
👉 For better distance measurement, use Ultrasonic sensor (HC-SR04) instead
🆚 IR vs Ultrasonic Sensor
| Feature | IR Sensor | Ultrasonic |
|---|---|---|
| Range | Short (2–30 cm) | Longer (2–400 cm) |
| Accuracy | Medium | Better |
| Cost | Very cheap | Slightly higher |
| Speed | Faster | Slightly slower |
👍 When to use this
Use IR sensor if you want:
Simple obstacle detection
Low-cost robotics projects
Fast response in short range
🚀 Pro Tips (from real usage)
Adjust the potentiometer to avoid false detection
Use multiple sensors for better robot navigation
Add delay/filtering in code to reduce noise
