IR Proximity Sensor with Arduino


IR Proximity Sensor with Arduino

IR Proximity sensor is a simple Infrared Sensor which is used to detect obstacles. This is a multipurpose sensor and used in many robotic applications like Obstacle avoidance robot, Line Follower Robot, and any other obstacle detection projects. This is an Active Infrared sensor; it emits and detects its own IR rays. A passive infrared sensor only detects the emitted IR Rays from objects. PIR Sensor is a good example for Passive IR Sensors.

Working principle:

Infrared lights are Electromagnetic radiations with longer wavelengths and are not visible to Human eyes. In IR Sensors we have IR emitting and receiving LEDs. In the long distance, the angle of light and sensor are meet together makes the output as HIGH (+5v). If there is an obstacle the angle is less and the receiving LED can’t detect the IR wave. Hence it will output a LOW Signal (0v).

IR Proximity Sensor Principle V2

Buy IR Proximity Sensor

A simple way to see Infrared with a mobile phone:

The operation of the camera is capturing light signals from an object. It can capture all the light signals even the IR. So let’s try to capture the IR light. Connect power supply of IR Sensor and look at the colorless LED. You can’t see any light emitted with a naked human eye. But a camera can detect the Infrared light. Show the sensor in front of your mobile camera and you can see the Red IR rays emitted from the colorless IR LED (Transparent LED). If still not visible, congrats! You have a good quality camera with IR Blocking filters.

Pin details:

IR Sensor has three terminals, two terminals for power supply and one terminal for Output. Additionally, there is a potentiometer to calibrate the sensor.

IR Proximity Sensor

Vcc – Power Supply (+5V)

GND – Ground

OUT – Output

How to use with Arduino:

IR Proximity sensor is simple to use with Arduino. You have to connect the power supply pins to +5V and Ground. The sensor output to any digital pin of Arduino.

IR Proximity Sensor_bb


We use the onboard LED and Serial monitor to see the operation of IR Proximity sensor. An IR LED is connected at pin 7 of Arduino and onboard sensor is at pin 13. We defined a variable ‘sensorOut’ to store the sensor value temporarily.

Once the code is uploaded open serial monitor and make sure the baud rate is set to 9600. When there is no Obstacle in front of IR Sensor it prints ‘No Obstacle’. If you place an object in front of it, then it prints ‘What is this Obstacle?’ in the serial monitor.

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *