The IR Sensor Avoid Obstacles is an infrared sensor designed to detect and avoid obstacles by emitting and receiving IR signals. This sensor is commonly used in robotics, automation systems, and various electronic projects to enable devices to navigate around obstacles. It is a crucial component for creating autonomous robots and smart vehicles.
Parameter | Value |
---|---|
Operating Voltage | 3.0V - 5.0V |
Operating Current | 20mA |
Detection Range | 2cm - 30cm |
Output Type | Digital (High/Low) |
Dimensions | 3.2cm x 1.4cm x 0.7cm |
Weight | 5g |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (3.0V - 5.0V) |
2 | GND | Ground |
3 | OUT | Digital output signal (High when obstacle detected, Low otherwise) |
VCC ----> 5V (Arduino)
GND ----> GND (Arduino)
OUT ----> Digital Pin 2 (Arduino)
// IR Sensor Avoid Obstacles Example Code
// Connect the OUT pin of the IR sensor to digital pin 2 on the Arduino
const int irSensorPin = 2; // IR sensor OUT pin connected to digital pin 2
const int ledPin = 13; // Onboard LED pin
void setup() {
pinMode(irSensorPin, INPUT); // Set the IR sensor pin as input
pinMode(ledPin, OUTPUT); // Set the LED pin as output
Serial.begin(9600); // Initialize serial communication at 9600 baud
}
void loop() {
int sensorValue = digitalRead(irSensorPin); // Read the value from the IR sensor
if (sensorValue == HIGH) {
// Obstacle detected
digitalWrite(ledPin, HIGH); // Turn on the LED
Serial.println("Obstacle detected!");
} else {
// No obstacle
digitalWrite(ledPin, LOW); // Turn off the LED
Serial.println("No obstacle.");
}
delay(100); // Small delay to avoid serial monitor flooding
}
Sensor Not Detecting Obstacles:
False Positives/Negatives:
Inconsistent Readings:
Q1: What is the maximum detection range of the IR sensor?
Q2: Can the IR sensor detect transparent objects?
Q3: Can I use multiple IR sensors in a single project?
Q4: How can I increase the detection range of the IR sensor?
By following this documentation, you should be able to effectively integrate and use the IR Sensor Avoid Obstacles in your electronic projects. Happy building!