Introduction: IR-Distance (Analog Value) Sensor 2$

Picture of IR-Distance (Analog Value) Sensor 2$

This Homemade IR Distance Sensor can easily sense distance betwwn 55 cm to 0.5 cm and display it on a 16X2 LCD

it does not require any costly sensors or drivers.....

all it uses is an IR Pair and a few resistors ............

the cost of the finished sensor is under 2$ !!!! Happy Constructing

Step 1: Getting Started

Picture of Getting Started

You will require these materials for the build :-

-- IR LED Pair(Transmitter and Reciever)

-- 16X2 LCD

-- 10 K Resistor

-- LED (Normal)

-- Breadboard

-- Jumper Wires

-- Arduino (or other microcontroller) ...

Step 2: The Circuit !!!

Picture of The Circuit !!!

just follow the fritzing diagram :-

also add the lcd from pins 7 to 2

like this wiring :-

* LCD RS pin to digital pin 7
* LCD Enable pin to digital pin 6

* LCD D4 pin to digital pin 5

* LCD D5 pin to digital pin 4

* LCD D6 pin to digital pin 3

* LCD D7 pin to digital pin 2

* LCD R/W pin to ground

* 10K resistor: ends to +5V and ground

* wiper to LCD VO pin (pin 3)

Step 3: Code It !!!!

Picture of Code It !!!!

the code is :-


LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

int ledpin = 9 ;

void setup() {


lcd.begin(16, 2);


void loop() {

int sensorValue = analogRead(A5);

sensorValue = map (sensorValue,3,20,0,1000);

if (sensorValue > 60){

lcd.print("Motion Detected");





sensorValue = map (sensorValue,0,1000,0,255);






Step 4: Caliberating the Sensor !!!!!

Picture of Caliberating the Sensor !!!!!

when there is no object in front of the sensor then the value that is displayed on the lcd is the minimum value

just place it into the

minValue of the given code:-

in my case it was 58 so i decided to go onto 60..

put the value in the map function...


johnyradio (author)2015-01-05

hi, is the arduino required? What signal is going into the Arduino from the detector? How does it change as distance changes? thx

HarshV (author)johnyradio2016-04-17

Sorry . I am too late for replying . You might wanna google it . I cant explain it briefly...its inveraly proportional

Mice job! It's great to be able to make simple sensors like this :)

Yeah, It is so protective, that it can even be used upto 64 volts (DC) (I've tested it..!)...and I've used arduino to sense the current itself.....!it's amazing.!

HarshV (author)HarshV2014-10-24

Sorry,,, the above comment is for opto isolator.

About This Instructable




More by HarshV:Automatic Temperature Sensor IR-Distance (Analog Value) Sensor 2$Opto-Isolator  Homemade (9 - 35 Volts with Arduino)
Add instructable to: