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
