infrared sensor module interfacing with Arduino – obstacle detection

Infrared sensor interfacing with Arduino, In this article you will learn about very famous infrared sensor. you will learn what is infrared sensor? What are applications of infrared sensor? How to interface infrared sensor with Arduino Uno R3 ? How to make infrared sensor using electronic components? Circuit diagrams of  infrared sensor interfacing with very famous Arduino Uno R3. Programming for Arduino Uno interfacing with Arduino Uno R3. I have also posted a project on obstacle avoidance robot using Arduino.

infrared obstacle avoidance sensor module interfacing arduino

Before reading this article you should have basic know how of Arduino Uno R3 . If you don’t know anything about this or you didn’t ever use Arduino Uno R3.  I recommend you to check following article.

Arduino Uno R3 tutorials” 

Infrared sensor is a electronics device which is used to detect heat and objects. It works with the detection of infrared radiations and change in heat in its surrounding. There are two types of infrared sensors brief description of these is given below:

  • Thermal infrared sensor work by change of heat in its surrounding or use infrared radiations as a heat.
  • photo infrared sensor use photo diode to detect infrared radiations. I will be using photo infrared sensor in this article and will provide you easy way to make photo infrared sensor circuit  diagram.

Applications of Infrared sensor

Infrared sensors have many applications now a days from domestic use to industrial use. I have mentioned few application of infrared sensor below. Maximum of them are for student level projects.

  • Object detection
  • motion detection
  • Obstacle avoidance robot
  • Gas leakage detection
  • smoke detection
  • distance measurement
  • robotics
  • object counter and many others

Circuit diagram of infrared sensor

Circuit diagram of infrared sensor is given below. In this circuit, infrared receiver Led and photo diode are main parts of this sensor. Photo diode emit infrared radiations which when strike to any object turn back with some angle. These infrared radiations turn back after striking any object. Infrared receiver detect reflected radiations. Because we are using photo diode that’s why this type of sensor is called photo infrared sensor.

infrared circuit diagram
infrared circuit diagram

Components list of photo infrared sensor

  • IR receiver TSFF5210
  • Photodiode
  • 100 ohm resistor
  • 10k resistor
  • 10k variable resistor
  • LM358 IC

Lm358 is used as a comparator whenever IR receiver detect infrared radiations, output of lm358 goes high and led connected at the output turn on. This output pin is used to interface with Arduino Uno R3.

photo Infrared sensor interfacing with Arduino Uno R3

Circuit diagram below shows the interfacing of this sensor with Arduino Uno R3. Output of infrared sensors is connected with pin number 1 of Arduino Uno R3. To use this sensor with Arduino and to write its code, you need to know how to use switch with Arduino. Because this sensor output is acting as a switch. When IR receiver detect infrared radiations, output will be high, otherwise output will be low. This is basically a functionality similar to push button and switch.So I recommend you to first learn that how to interface push button with Arduino Uno R3. To know about it check following article :

how to use push button with Arduino

After reading above article you will surely able to write code for below given circuit diagram.


infrared sensor interfacing with arduino uno r3
infrared sensor interfacing with arduino uno r3

Code of infrared sensor module interfacing with Arduino

const int IR_INPUT=2; //Digital output reads pin for IR SENSOR
void setup() 
pinMode(13, OUTPUT); // ON Board LED to show output
void loop() 
if(digitalRead(IR_Sensor)==HIGH) // if no obstacle LED off
digitalWrite(13, LOW); // LED off when no obstacle
digitalWrite(13, HIGH); // LED on when there is a obstacle 

thanks for visiting our website. don’t forget to share it with your friends on social media. If you feel any trouble while writing code for this project. Let me know with your comments. enjoy and good luck 🙂

6 thoughts on “infrared sensor module interfacing with Arduino – obstacle detection”

  1. You made this circuit in Proteus. I am not able to find IR receiver and transmitter in Proteus Library. If you have this component library let me know because i want to simulate this in Proteus.


Leave a Comment