شحن مجاني للأوردرات فوق
1000 ج
رمضان كريم
Reliable Object Detection for Robotics and Automation Projects
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.

850nm IR LED with phototransistor receiver
2cm-30cm detection (via potentiometer)
TTL-level signal (0V or VCC)
Typical current: 15-20mA
| 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 | Label | Description | Arduino Connection |
|---|---|---|---|
| 1 | VCC | Power (3.3V-5V) | 5V |
| 2 | GND | Ground | GND |
| 3 | OUT | Digital Output | D2 (Digital Pin) |
// 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
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);
}
// Connect OUT to analog pin
int sensorValue = analogRead(A0);
// Higher values = closer objects
// Requires threshold calibration
// Array of sensor pins
int sensorPins[] = {2,3,4,5};
void setup() {
for(int i=0; i<4; i++) {
pinMode(sensorPins[i], INPUT);
}
}
// Software debounce
unsigned long lastDetect = 0;
const int debounceDelay = 50;
if(digitalRead(IRSensor) == LOW &&
millis() - lastDetect > debounceDelay) {
lastDetect = millis();
// Trigger action
}
// Simple obstacle avoidance
if(digitalRead(leftSensor) == LOW) {
turnRight();
}
else if(digitalRead(rightSensor) == LOW) {
turnLeft();
}
else {
moveForward();
}
No account yet?
Create an Account
Recent Comments