Arduino IR Obstacle Sensor: Tutorial and Manual

 Arduino Infrared Collision Avoidance

Collision Detector ModuleThis is yet another one of those modules with cool possibilities.   You could for example, sound an alarm when something got too close or you could change the direction of  a robot or vehicle.

The device consists of an Infrared Transmitter, an Infrared Detector, and support circuitry.  It only requires three connections. When it detects an obstacle within range it will send an output low.




How to Purchase

There are several different styles of these modules available.   If this particular one suits your needs,  you can purchase one from the sellers below:



IR Obstacle Detection Module Pin Outs

The drawing and table below identify the function of module pin outs, controls and indicators.

Arduino IR Collision Detection Module Pin Outs

Pin, Control IndicatorDescription
Vcc3.3 to 5 Vdc Supply Input
GndGround Input
OutOutput that goes low when obstacle is in range
Power LEDIlluminates when power is applied
Obstacle LEDIlluminates when obstacle is detected
Distance AdjustAdjust detection distance. CCW decreases distance.
CW increases distance.
IR EmitterInfrared emitter LED
IR ReceiverInfrared receiver that receives signal transmitted by Infrared emitter.

Arduino IR Obstacle Collision Module Tutorial

Connect the Arduino to the Detection Module

Use the picture below.  It only requires three wires.

IR Collision Detection Module Arduino Tutorial Hook UpCopy, Paste and Upload the Sample Sketch

// IR Obstacle Collision Detection Module
// Henry's Bench

int LED = 13; // Use the onboard Uno LED
int isObstaclePin = 7;  // This is our input pin
int isObstacle = HIGH;  // HIGH MEANS NO OBSTACLE

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(isObstaclePin, INPUT);

void loop() {
  isObstacle = digitalRead(isObstaclePin);
  if (isObstacle == LOW)
    Serial.println("OBSTACLE!!, OBSTACLE!!");
    digitalWrite(LED, HIGH);
    digitalWrite(LED, LOW);

Test the Tutorial Sketch

Move your hand towards the IR LEDs.  As you near them, the Output LED on the module and the LED for pin 13 on your Arduino will illuminate.  Open your serial monitor and vary the distance of your hand while viewing the serial monitor.   The output should look like the picture below:

IR Obstacle Detection Module Arduino Tutorial Output