IR Obstacle Sensor


An IR sensor is mainly consist of an infrared transmitter, and infrared receiver and a potentiometer. The infrared transmitter will transmit the infrared ray, if there is no obstacle the emitted infrared ray will be weaken with the distance it spreads and finally disappear. If there is obstacle , the ray will be reflected back to infrared receiver. Then the receiver  detects this signal and confirm the obstacle in front.

Pin configuration:

  1. Vcc:to the power supply 3-5V DC;
  2. Gnd:to the ground reference;
  3. Out:for the digital output signal of the sensor.(To Digital pin of arduino)




        Interfacing with Arduino


    int IRSensor = 2; // connect ir sensor to arduino pin 2
    int LED = 13; // conect Led to arduino pin 13
    void setup()
    pinMode (IRSensor, INPUT); // sensor pin INPUT
    pinMode (LED, OUTPUT); // Led pin OUTPUT
    void loop()
    int statusSensor = digitalRead (IRSensor);
    if (statusSensor == 1)
    digitalWrite(LED, LOW); // LED LOW
    digitalWrite(LED, HIGH); // LED High





    • it is use to detect an object in front of it.
    • It is also used to distinguishing between black and white color.




    • It provides secured communication due to line of sight or point-to-point mode of communication.
    • The battery used in infrared devices last for long duration due to lower power consumption.
    • Infrared motion sensors detect motion in daytime and nighttime reliably. 
    • The sensor does not require any contact with the product to be sensed.  
    • It provides good stability over time.


    • Infrared frequencies are affected by hard objects (e.g. walls, doors) , smoke, dust, fog, sunlight etc. Hence it does not work through walls or doors. 
    • Infrared waves at high power can damage eyes. 
    • In monitor & control application, it can control only one device at one time. Moreover it is difficult to control things which are not in LOS (Line of Sight). It requires line of sight between transmitter and receiver to communicate. 
    • It supports shorter range and hence it performance degrades with longer distances. 
    • It supports lower data rate transmission compare to wired transmission