Stufin
Home Quick Cart Profile

IR (Infrared) Obstacle Avoidance Sensor Module

Buy Now on Stufin

Supply Voltage

3.3V or 5V

Operating Current

<10mA

Detection Range

Up to 30 cm (12 inches)

Accuracy

1 cm (0.4 inches)

Response Time

<10ms

Output

Digital (0 or 1)

Interface

3-pin connector (VCC, GND, OUT)

Dimension

23 x 15 x 10 mm (0.9 x 0.6 x 0.4 inches)

Weight

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.

Pin Configuration

  • IR (Infrared) Obstacle Avoidance Sensor Module Documentation
  • Pin Description:
  • The IR Obstacle Avoidance Sensor Module has 3 pins, which are:
  • ### 1. VCC (Power Supply) Pin
  • Function: Provides power supply to the sensor module
  • Voltage: Typically 3.3V to 5V DC
  • Connection: Connect to the positive terminal of a power source (e.g., a microcontroller's VCC pin or a battery)
  • ### 2. GND (Ground) Pin
  • Function: Provides a ground reference for the sensor module
  • Connection: Connect to the negative terminal of a power source (e.g., a microcontroller's GND pin or a battery)
  • ### 3. OUT (Output) Pin
  • Function: Provides a digital output signal indicating the presence or absence of an obstacle
  • Logic Level: Typically a 0V (Low) or VCC (High) signal
  • Connection: Connect to a digital input pin of a microcontroller (e.g., an Arduino board) to read the obstacle detection status
  • Connecting the Pins:
  • To use the IR Obstacle Avoidance Sensor Module, follow these steps:
  • 1. Power Connection:
  • Connect the VCC pin of the sensor module to the positive terminal of a power source (e.g., a microcontroller's VCC pin or a battery).
  • Connect the GND pin of the sensor module to the negative terminal of a power source (e.g., a microcontroller's GND pin or a battery).
  • 2. Output Connection:
  • Connect the OUT pin of the sensor module to a digital input pin of a microcontroller (e.g., an Arduino board).
  • 3. Optional: You can add a pull-down resistor (e.g., 1 k) between the OUT pin and GND to ensure a stable output signal.
  • Note:
  • Make sure to check the datasheet of the specific IR Obstacle Avoidance Sensor Module you are using, as the pinout and voltage requirements might vary.
  • The sensor module may have additional pins or variations, so always consult the datasheet for specific guidance.
  • When using the sensor module with a microcontroller, ensure that the microcontroller is configured to read the digital output signal correctly.

Code Examples

IR Obstacle Avoidance Sensor Module Documentation
Overview
The 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 Specifications
Operating Voltage: 5V
 Operating Current: 20mA
 Detection Range: 2-40cm
 Frequency: 38kHz
 Output: Digital (High/Low)
Pinout
VCC: 5V power supply
 GND: Ground
 OUT: Digital output (High/Low)
Code Examples
### Example 1: Basic Obstacle Detection with Arduino
In 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 2
void 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 = 26
GPIO.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.