- تكلفه فاتورة الكهرباء
- Electrical Energy Consumption
- Parallel and Series Resistor Calculator
- LED Resistor Calculator
- UPS Battery Backup Calculator
- Voltage Divider Calculator
- Resistor Color Code Calculator
- Ohm’s Law Calculator
- Current Divider Calculator
- Number System Conversion Calculator
- Boost Converter Calculator
- MOSFET Threshold Voltage Calculator
- Apparent Power Calculator (kVA & VA)
- 555 Timer Calculator
- Buck Converter Calculator
- Capacitors in Series or Parallel Calculator
- Low Pass Filter Calculator
- RMS Voltage Calculator
- Universal Data Converter
- RMS Voltage Calculator
- Capacitor Code Converter
- Series Inductors Calculator
IR Sensor Infrared Obstacle Avoidance Module
IR Infrared Obstacle Avoidance Sensor Module
Reliable Object Detection for Robotics and Automation Projects
Introduction
The IR Obstacle Avoidance Sensor is a reflective photoelectric detection module that uses infrared light to detect objects within 2-30cm. With adjustable sensitivity and digital output, it's ideal for robot navigation, object counting, and automation systems.
Key Features
Infrared Detection
850nm IR LED with phototransistor receiver
Adjustable Range
2cm-30cm detection (via potentiometer)
Digital Output
TTL-level signal (0V or VCC)
Low Power
Typical current: 15-20mA
Technical Specifications
Operating Voltage | 3.3V – 5V DC |
---|---|
Detection Range | 2cm – 30cm (adjustable) |
Output Type | Digital (High/Low) |
Response Time | <2ms |
IR Wavelength | 850nm |
Interface | 3-pin (VCC, GND, OUT) |
Pin Configuration

Pin | Label | Description | Arduino Connection |
---|---|---|---|
1 | VCC | Power (3.3V-5V) | 5V |
2 | GND | Ground | GND |
3 | OUT | Digital Output | D2 (Digital Pin) |
Note: Blue potentiometer adjusts detection sensitivity
Wiring Diagram (Arduino)
// Basic Connections: // VCC → 5V // GND → GND // OUT → D2 (or any digital pin) // For best results: // - Mount sensor 5-10cm above surface // - Avoid direct sunlight interference
Basic Detection Example
const int IRSensor = 2; // Connected to OUT pin void setup() { Serial.begin(9600); pinMode(IRSensor, INPUT); } void loop() { int obstacle = digitalRead(IRSensor); if (obstacle == LOW) { Serial.println("Obstacle detected!"); // Add your response code here } delay(100); }
Advanced Applications
Analog Reading (Optional)
// Connect OUT to analog pin
int sensorValue = analogRead(A0);
// Higher values = closer objects
// Requires threshold calibration
Multiple Sensors
// Array of sensor pins
int sensorPins[] = {2,3,4,5};
void setup() {
for(int i=0; i<4; i++) {
pinMode(sensorPins[i], INPUT);
}
}
Debouncing
// Software debounce
unsigned long lastDetect = 0;
const int debounceDelay = 50;
if(digitalRead(IRSensor) == LOW &&
millis() - lastDetect > debounceDelay) {
lastDetect = millis();
// Trigger action
}
Robot Navigation
// Simple obstacle avoidance
if(digitalRead(leftSensor) == LOW) {
turnRight();
}
else if(digitalRead(rightSensor) == LOW) {
turnLeft();
}
else {
moveForward();
}
Troubleshooting
No Detection
- Adjust potentiometer clockwise to increase sensitivity
- Check IR LED is emitting (view through phone camera)
- Verify object is within 2-30cm range
False Triggers
- Reduce sensitivity (turn potentiometer CCW)
- Shield from ambient IR sources
- Add software debouncing
Inconsistent Readings
- Ensure stable power supply
- Check for loose connections
- Test with different surface reflectivity