

The IR Obstacle Sensor Module is a compact and versatile electronic component designed to detect obstacles using infrared (IR) light. It works by emitting infrared rays and measuring the reflection from nearby objects. When an object is detected within its range, the module outputs a signal, making it ideal for proximity detection and obstacle avoidance.








The following table outlines the key technical details of the IR Obstacle Sensor Module:
| Parameter | Specification |
|---|---|
| Operating Voltage | 3.3V to 5V |
| Operating Current | 20mA (typical) |
| Detection Range | 2cm to 30cm (adjustable) |
| Output Type | Digital (High/Low) |
| IR Wavelength | 940nm |
| Dimensions | ~3.1cm x 1.5cm x 0.7cm |
The IR Obstacle Sensor Module typically has three pins. Their configuration and descriptions are as follows:
| Pin Name | Pin Number | Description |
|---|---|---|
| VCC | 1 | Power supply pin (3.3V to 5V) |
| GND | 2 | Ground pin |
| OUT | 3 | Digital output pin (High when no obstacle, Low when obstacle detected) |
VCC pin to a 3.3V or 5V power source and the GND pin to the ground of your circuit.OUT pin to a digital input pin of your microcontroller or directly to an LED/buzzer for simple obstacle detection.OUT pin will go LOW when an obstacle is detected.Below is an example of how to use the IR Obstacle Sensor Module with an Arduino UNO:
VCC pin of the module to the 5V pin on the Arduino.GND pin of the module to the GND pin on the Arduino.OUT pin of the module to digital pin 2 on the Arduino.// IR Obstacle Sensor Module Example Code
// This code reads the output of the IR sensor and turns on an LED when
// an obstacle is detected.
#define IR_SENSOR_PIN 2 // Digital pin connected to the OUT pin of the sensor
#define LED_PIN 13 // Built-in LED on Arduino UNO
void setup() {
pinMode(IR_SENSOR_PIN, INPUT); // Set the sensor pin as input
pinMode(LED_PIN, OUTPUT); // Set the LED pin as output
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = digitalRead(IR_SENSOR_PIN); // Read the sensor output
if (sensorValue == LOW) {
// Obstacle detected
digitalWrite(LED_PIN, HIGH); // Turn on the LED
Serial.println("Obstacle detected!");
} else {
// No obstacle
digitalWrite(LED_PIN, LOW); // Turn off the LED
Serial.println("No obstacle.");
}
delay(100); // Small delay for stability
}
The module is not detecting obstacles:
VCC and GND pins are connected properly.False detections or erratic behavior:
Output signal is always HIGH:
Output signal is always LOW:
Q: Can the module detect transparent objects?
A: The module may struggle to detect transparent objects like glass due to low IR reflection. Use alternative sensors for such applications.
Q: Can I use this module with a 3.3V microcontroller?
A: Yes, the module operates at 3.3V to 5V, making it compatible with 3.3V microcontrollers like ESP32 or Raspberry Pi Pico.
Q: How do I increase the detection range?
A: Adjust the onboard potentiometer clockwise to increase the detection range. Ensure the object is within the new range.
Q: Is the module suitable for outdoor use?
A: The module is not designed for outdoor use as it may be affected by sunlight and weather conditions. Use it in indoor or controlled environments.