3.3V or 5V
3.3V or 5V
<10mA
Up to 30 cm (12 inches)
1 cm (0.4 inches)
<10ms
Digital (0 or 1)
3-pin connector (VCC, GND, OUT)
23 x 15 x 10 mm (0.9 x 0.6 x 0.4 inches)
2g
Applications
| The IR Obstacle Avoidance Sensor Module is suitable for a wide range of applications, including |
Robotics and autonomous systems
Drones and UAVs
Industrial automation
Smart home devices
IoT projects
Obstacle detection in vehicles
Security systems
Conclusion
The IR Obstacle Avoidance Sensor Module is a reliable and efficient solution for detecting obstacles in a variety of applications. Its compact design, low power consumption, and high accuracy make it an ideal choice for designers and engineers working on IoT, robotics, and automation projects.
IR Obstacle Avoidance Sensor Module DocumentationOverviewThe IR Obstacle Avoidance Sensor Module is a popular IoT component used to detect obstacles or objects within a certain range using infrared technology. It is commonly used in robotics, automation, and other applications where obstacle detection is crucial. This module provides a digital output indicating the presence or absence of an obstacle.Technical SpecificationsOperating Voltage: 5V
Operating Current: 20mA
Detection Range: 2-40cm
Frequency: 38kHz
Output: Digital (High/Low)PinoutVCC: 5V power supply
GND: Ground
OUT: Digital output (High/Low)Code Examples### Example 1: Basic Obstacle Detection with ArduinoIn this example, we will use the IR Obstacle Avoidance Sensor Module to detect obstacles using an Arduino board.```c
const int obstaclePin = 2; // IR sensor output pin connected to digital pin 2void setup() {
pinMode(obstaclePin, INPUT);
Serial.begin(9600);
}void loop() {
int obstacleState = digitalRead(obstaclePin);
if (obstacleState == HIGH) {
Serial.println("Obstacle detected!");
} else {
Serial.println("No obstacle detected.");
}
delay(500);
}
```In this code, we read the digital output from the IR sensor and print a message to the serial console indicating whether an obstacle is detected or not.### Example 2: Line Follower Robot using IR Obstacle Avoidance Sensor with Raspberry Pi (Python)In this example, we will use the IR Obstacle Avoidance Sensor Module to create a line follower robot using a Raspberry Pi and a motor driver.```python
import RPi.GPIO as GPIO
import time# IR sensor output pin connected to GPIO 17
IR_PIN = 17# Motor driver pins
LEFT_MOTOR_FORWARD = 23
LEFT_MOTOR_BACKWARD = 24
RIGHT_MOTOR_FORWARD = 25
RIGHT_MOTOR_BACKWARD = 26GPIO.setmode(GPIO.BCM)
GPIO.setup(IR_PIN, GPIO.IN)
GPIO.setup(LEFT_MOTOR_FORWARD, GPIO.OUT)
GPIO.setup(LEFT_MOTOR_BACKWARD, GPIO.OUT)
GPIO.setup(RIGHT_MOTOR_FORWARD, GPIO.OUT)
GPIO.setup(RIGHT_MOTOR_BACKWARD, GPIO.OUT)while True:
obstacleState = GPIO.input(IR_PIN)
if obstacleState:
# Obstacle detected, turn around
GPIO.output(LEFT_MOTOR_FORWARD, GPIO.LOW)
GPIO.output(LEFT_MOTOR_BACKWARD, GPIO.HIGH)
GPIO.output(RIGHT_MOTOR_FORWARD, GPIO.LOW)
GPIO.output(RIGHT_MOTOR_BACKWARD, GPIO.HIGH)
else:
# No obstacle, move forward
GPIO.output(LEFT_MOTOR_FORWARD, GPIO.HIGH)
GPIO.output(LEFT_MOTOR_BACKWARD, GPIO.LOW)
GPIO.output(RIGHT_MOTOR_FORWARD, GPIO.HIGH)
GPIO.output(RIGHT_MOTOR_BACKWARD, GPIO.LOW)
time.sleep(0.1)
```In this code, we use the IR sensor to detect obstacles and control the motors to turn around or move forward accordingly.Note: Please ensure to adjust the pin connections and motor driver configurations according to your specific setup.