You are not logged in

Log in into our community

Log in so you acess some hidden content

* Fields are required.

Register into our community!

Sign up now for some good content

* Fields are required.

Lost something?

Enter your username or email to reset your password.

* Fields are required.

Infrared Obstacle Avoidance Sensor

Posted on : Sun , 07 2015 by : virusi

Necessary Knowledge :

Basic C Langugage knowledge.

Basic Hardware knowledge.

Basic Arduino knowledge.

Basic Microcontrollers knowledge.

Theory of Infrared Sensor :

The main infrared areas are sensing and remote controls. In the electromagnetic spectrum, the infrared portion is divided into three regions:

Near infrared region — 700 nm to 1400 nm — infrared sensors, fiber optic.

Mid infrared region — 1400 nm to 3000 nm — Heat sensing.

Far infrared region — 3000 nm to 1 mm — Thermal imaging

An infrared sensor emits and/or detects infrared radiation to sense its surroundings.

The working of any Infrared sensor is governed by three laws:

Planck’s Radiation law states that “every object emits radiation at a temperature not equal to 0K”.

Stephen Boltzmann law states that “at all wavelengths, the total energy emitted by a black body is proportional to the fourth power of the absolute temperature”.

Wien’s Displacement law states the radiation curve of a black body for different temperatures will reach its peak at a wavelength inversely proportional to the temperature”.

The basic concept of an Infrared Sensor which is used as Obstacle detector is to transmit an infrared signal, this infrared signal bounces from the surface of an object and the signal is received at the infrared receiver.

Types of IR Sensors :

Infrared sensors can be passive or active.

Passive infrared sensors are basically Infrared detectors. Passive infrared sensors do not use any infrared source and detects energy emitted by obstacles in the field of view. They are 2 types of passive infrared sensor:

Thermal infrared sensors use infrared energy as the source of heat and are independent of wavelength. (ex Thermocouples)

Quantum type infrared detectors offer higher detection performance and are faster than thermal type infrared detectors. The photosensitivity of quantum type detectors is wavelength dependent.

Active infrared sensors consist of two elements:

Infrared sources include an LED or infrared laser diode called IR LED. There are different types of infrared transmitters depending on their wavelengths, output power and response time.

Infrared detectors include photodiodes or phototransistors. Infrared Photodiodes are different from normal photo diodes as they detect only infrared radiation. Different types of IR receivers exist based on the wavelength, voltage, package, etc.


When used in an infrared transmitter – receiver combination, the wavelength of the receiver should match with that of the transmitter.

Practical Example using Infrared Obstacle Avoidance Sensor :

infrared obstacle avoidance sensor
Fig.1 Infrared Obstacle Avoidance Sensor.

The Infrared Obstacle Avoidance sensor consists of an Infrared source and a infrared detector that as we already know have the same wave length. The IR source emits radiation and if it reaches the object, some of the radiation is reflected back to the receiver. The intensity of the received signal can be controlled by the potentiometer that is mounted on the board.


If you always see the Green Led on this means that the sensor detects an object , this is because the infrared led has wider detection angle and it can reflect from your table or other object that are near the sensor. So as a solution turn off the lights or pick the sensor up on it should turn off (no obstacle detected).

Infrared sensor is more sensible to the white surface and activation time is very slow.

Pin Connection :

– VCC pin should be connected to the board 5V.

– GND pin should be connected to the board GND.

– Out pin should be connected to the board Digital input.

Infrared obstacle avoidance sensor characteristics :

– The module detects a distance of 2 ~ 80cm(can be adjusted with adjustment potentiometer clockwise).

– Detection angle 35 °

– 3-5V DC power supply module can be used

– More sensitive to white surfaces because black color absorbs the entire radiation incident on it and white color reflects the entire radiation incident on it.

Arduino Code :

Setup :
#define IR_OUT  7
#define ledPin  13

unsigned char state = 0;

void setup() 
  // sets the IR obstacle avoidance out pin as input
  pinMode(IR_OUT, INPUT);    
  // sets the LED pin as output
  pinMode(ledPin, OUTPUT);  
void loop() 
  /* read input value */
  unsigned char val = digitalRead(IR_OUT);
  /* sensor has detected and obstacle */   
  if(val == 0) 
    /* send data through serial only once */
    if(state != 1)
      // send state to the Serial Interface
      Serial.println("Obstacle Detected"); 
      // sets the LED state to High(Turn On)
      digitalWrite(ledPin, HIGH);  
      state = 1;
  else /* no obstacle detected */
    /* send data through serial only once */
    if(state != 2)
      // send state to the Serial Interface
      Serial.println("Obstacle Not Detected"); 
      // sets the LED state to Low(Turn OFF)
      digitalWrite(ledPin, LOW);  
      state = 2;
  /* delay the next reading */    

Download Link :

Interested in an working sketch download the Infrared Obstacle Avoidance Sensor Sketch.
Last updated on Sun , 07 2015

This page is waiting for your comment.

Share and Leave a comment.

You must be logged in to post a comment.

Back to Top