Stufin
Home Quick Cart Profile

IR OBSTACLE SENSOR MODULE

Buy Now

Operating Voltage

5V

Operating Current

10mA (typical)

Detection Range

Up to 30cm (12 inches)

Sensitivity Adjustment

Onboard potentiometer

Digital Output

HIGH ( obstacle detected) or LOW (no obstacle detected)

IR Emission Frequency

38kHz

Dimensions

25mm x 15mm x 10mm (1 inch x 0.6 inches x 0.4 inches)

Weight

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

VCC

Power supply (5V)

GND

Ground

OUT

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.

Pin Configuration

  • IR OBSTACLE SENSOR MODULE Documentation
  • Pin Description:
  • The IR Obstacle Sensor Module has 3 pins, which are described below:
  • 1. VCC (Power Supply Pin)
  • Function: Power supply input for the module
  • Voltage: Typically 3.3V to 5V (dependent on the specific module)
  • Connection: Connect to the positive terminal of a power source (e.g., battery, voltage regulator, or microcontroller's VCC pin)
  • 2. GND (Ground Pin)
  • Function: Ground connection for the module
  • Connection: Connect to the negative terminal of a power source (e.g., battery, voltage regulator, or microcontroller's GND pin)
  • 3. OUT (Output Pin)
  • Function: Output signal indicating the presence or absence of an obstacle
  • Signal: Digital signal (HIGH or LOW)
  • Logic:
  • + HIGH (typically 3.3V or 5V): Indicates an obstacle is detected
  • + LOW (typically 0V): Indicates no obstacle is detected
  • Connection: Connect to a digital input pin of a microcontroller, Arduino, or other compatible devices to read the sensor output
  • Connection Structure:
  • To connect the IR Obstacle Sensor Module to a microcontroller or Arduino board, follow these steps:
  • 1. Connect the VCC pin of the sensor module to the VCC pin of the microcontroller or Arduino board.
  • 2. Connect the GND pin of the sensor module to the GND pin of the microcontroller or Arduino board.
  • 3. Connect the OUT pin of the sensor module to a digital input pin of the microcontroller or Arduino board (e.g., D2, D3, etc.).
  • Example Connection Diagram:
  • Here's an example connection diagram using an Arduino Uno board:
  • ```
  • IR Obstacle Sensor Module
  • VCC
  • Arduino Uno
  • GND
  • (D2) OUT >
  • ( DIGITAL PIN )
  • ```
  • In this example, the VCC pin of the IR Obstacle Sensor Module is connected to the 5V pin of the Arduino Uno, the GND pin is connected to the GND pin of the Arduino Uno, and the OUT pin is connected to digital pin D2 of the Arduino Uno.
  • Remember to consult the specific datasheet or documentation provided with your IR Obstacle Sensor Module for any specific connection requirements or recommendations.

Code Examples

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.