5V
5V
10mA (typical)
Up to 30cm (12 inches)
Onboard potentiometer
HIGH ( obstacle detected) or LOW (no obstacle detected)
38kHz
25mm x 15mm x 10mm (1 inch x 0.6 inches x 0.4 inches)
5g (0.18 oz)
Applications
Robotics and automation
Object detection and counting
Gesture recognition and control systems
IoT projects requiring object detection
Home automation and security systems
Pinout
Power supply (5V)
Ground
Digital output (HIGH or LOW)
Example Usage
The IR Obstacle Sensor Module can be used in a robot to detect obstacles and avoid them. Connect the module to a microcontroller, such as an Arduino, and use the digital output to trigger movements or actions when an obstacle is detected.
Troubleshooting Tips
Adjust the sensitivity potentiometer to fine-tune the detection range.
Ensure the module is powered correctly and the digital output is connected to a microcontroller or other compatible device.
Check for objects or debris blocking the IR LED or photodiode sensor.
By providing a compact, low-cost, and easy-to-use solution for obstacle detection, the IR Obstacle Sensor Module is a versatile component for a wide range of IoT and robotics projects.
IR Obstacle Sensor Module Documentation
The IR Obstacle Sensor Module is a compact and reliable sensor module designed to detect obstacles or objects within a certain range. It uses infrared light to detect reflections from objects and provides a digital output signal indicating the presence or absence of an obstacle.
Specifications:
Operating Voltage: 5V
Operating Current: 10mA
Detection Range: 2-30cm
Output Signal: Digital (High/Low)
Response Time: 10-20ms
Interface: 3-pin (VCC, GND, OUT)
Pinout:
VCC: 5V power supply
GND: Ground connection
OUT: Digital output signal (High/Low)
Code Examples:
### Example 1: Basic Obstacle Detection using Arduino
In this example, we will use the IR Obstacle Sensor Module with an Arduino board to detect obstacles and turn on an LED when an object is within range.
```c
const int sensorPin = 2; // IR Obstacle Sensor Module output pin
const int ledPin = 13; // LED pin
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int sensorState = digitalRead(sensorPin);
if (sensorState == HIGH) { // Obstacle detected
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
delay(50); // Debounce interval
}
```
### Example 2: Implementing a Simple Line Follower Robot using Raspberry Pi
In this example, we will use the IR Obstacle Sensor Module with a Raspberry Pi to create a simple line follower robot. The sensor will detect the line and control the robot's movement.
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO pins
GPIO.setmode(GPIO.BCM)
sensor_pin = 17 # IR Obstacle Sensor Module output pin
left_motor_fwd = 23
left_motor_bwd = 24
right_motor_fwd = 25
right_motor_bwd = 26
GPIO.setup(sensor_pin, GPIO.IN)
GPIO.setup(left_motor_fwd, GPIO.OUT)
GPIO.setup(left_motor_bwd, GPIO.OUT)
GPIO.setup(right_motor_fwd, GPIO.OUT)
GPIO.setup(right_motor_bwd, GPIO.OUT)
while True:
sensor_state = GPIO.input(sensor_pin)
if sensor_state == GPIO.HIGH: # Line detected
# Move forward
GPIO.output(left_motor_fwd, GPIO.HIGH)
GPIO.output(right_motor_fwd, GPIO.HIGH)
else:
# Stop and turn
GPIO.output(left_motor_fwd, GPIO.LOW)
GPIO.output(right_motor_fwd, GPIO.LOW)
time.sleep(0.5)
GPIO.output(left_motor_bwd, GPIO.HIGH)
GPIO.output(right_motor_bwd, GPIO.LOW)
time.sleep(0.5)
GPIO.output(left_motor_bwd, GPIO.LOW)
GPIO.output(right_motor_bwd, GPIO.HIGH)
time.sleep(0.5)
```
Note: In this example, you need to connect the IR Obstacle Sensor Module to the Raspberry Pi's GPIO pins and the motor driver IC to control the robot's movement.
Troubleshooting Tips:
Ensure the sensor module is properly connected to the power supply and the output pin is connected to a digital input on your microcontroller.
Adjust the detection range by adjusting the sensor's infrared LED angle or the object's surface reflectivity.
Use a debouncing mechanism to prevent false triggers due to noise or multiple reflections.