Homemade Infrared Rangefinder (Similar to Sharp GP2D120

Picture of Homemade Infrared Rangefinder (Similar to Sharp GP2D120
GP2D12 (Medium).jpg
DSCN1467 (Medium).JPG
Here is my instructable on how to construct a pretty simple (for some!) short range infrared rangefinder/range sensor. Infrared rangefinders are very useful in a number of projects. The majority of these come from obstacle detection (in robots) or generally detecting distances! The one shown here is only a simple rangefinder and will only really be able to measure about 6 or 7cm infront of the range finder. Luckily, most objects reflect infrared well enough to produce a reading (including a hand, paper and tin foil). I will be showing you how to use the infrared range finder with an Arduino and ways of linearizing the result.
Remove these adsRemove these ads by Signing Up

Step 1: Theory

The theory behind an infrared rangefinder is that pulsed infrared is emitted from an IR led and then reflected back off an object into an IR receiver. As light adheres to the inverse square law which states that as distance from a source is increased, the intensity decreases by the square (Source: Essentially, the light is emitted by the infrared LED, which then bounces off the object. In the first instance, the LED is the emitter and the reflective object is the observer. Once the light hits the object, it then bounces off and is reflected back to the IR receiver. The object is then acting as the source of light so the inverse square law takes effect twice. This has the problem that the maximum range of the rangefinder is quite short and to increase the range, higher power LED’s would be required.

Another problem that takes affect with light based rangefinders is how it can be affected by ambient light. I fix this in my rangefinder by modulating the emitting LED. Without this modulation, a simple light bulb connected to the mains can affect the result by superimposing 50Hz onto the actual signal.

My rangefinder works through having a  modulated IR source at an ultrasonic frequency, being detected by a IR receiver (IR photodiode) which is then fed into a high pass filter, amplified and peak detected.
Mic1007 months ago
I finally built your 36KHz version of the NE555 everything is OK thank you
Now I will look for RC5
everything is here smd pictures of test

pyrohaz (author)  Mic1002 months ago

Awesome pcb man! Glad it worked for you :)

clapfilk11 days ago


Thats incredible


Thats spectacular...

HWgeek1 month ago

Very nicely done! Having had to deal with Sharp this looks like a nice way to not have to use their stuff.

Question on Step 3 - probing the IR receiver - the scope trace. What point were you probing and what was your voltage scale on the scope?? I ask, as I am trying my hand at building up this circuit, having some issues with getting it working on the receiving end. The darlington pair doesn't seem to be amplifying the signal. Thanks!

gazumpglue2 months ago

her is the kicad PCB projet in zipped file in my i've remplaced the 4148

diodes by shottky diodes

Mic1002 months ago

thanks to :)

her is the kicad PCB projet in zipped file in my i've remplaced the 4148

diodes by shottky diodes

pyrohaz (author)  Mic1002 months ago

Them 3d plots are great! Is that a part of kicad? I'm still used to working with eagle haha

Mic100 pyrohaz2 months ago

yes is part of kicad

pyrohaz (author)  tiecheap2 months ago

Cheers! :)

pyrohaz (author)  gamystuffed2 months ago

Thank you!

pyrohaz (author)  craniumfurbelow2 months ago

Thanks :)

pyrohaz (author)  nativemedia2 months ago

Cheers! :)

vandhika6 months ago
im newbie to electronics and want to learn. this project suites me as it seems easy to be done and i need distance meter that can be logged.

if build this, do i need the oscilloscope? is all component typical so i can use your constant (Normalize_constant, etc)?
pyrohaz (author)  vandhika6 months ago
Hey, you don't need an oscilloscope to do this project at all fortunately though one would definitely help to debug it. With hope, if you follow the build instructions directly, it should fully work! All of the component values will work with the current values.
BunnyRoger7 months ago
Very good Instructable!!!
pyrohaz (author)  BunnyRoger7 months ago
Awesome instructable!!
pyrohaz (author)  Amanda Culbert7 months ago
Thank you :D
MAApleton7 months ago
Very cool. Definitely one of my favorites.
pyrohaz (author)  MAApleton7 months ago
Thanks a bunch!
My Diet Area8 months ago
Thats fabulous...
pyrohaz (author)  My Diet Area7 months ago
Thanks! :)
Mic1001 year ago
Is Technical but is a Nice instructable
i'm try to make the same with 38KHz carrier for decoding RC5 ir code and drive my futur robot
Thank You
pyrohaz (author)  Mic1007 months ago
Hey, the receiver section could be modified to work as a 38KHz reciever, I'm not too knowledgeable on the RC5 coding scheme, though wikipedia does a pretty good job of describing it, with an IR reciever and a logic analyzer, I think you could be onto a start atleast!
Mic10011 months ago
Very good teaching of the electronic of IR sensors
and also very good for my money
Thank You very much :=)
pyrohaz (author)  Mic1007 months ago
Glad you liked it dude!
Mariska Botha7 months ago
Cool rangefinder Pyrohaz.
pyrohaz (author)  Mariska Botha7 months ago
Glad you like it! :)
pyrohaz (author)  lovingrolled7 months ago
Cheers! :)
pyrohaz (author)  fingerflamingo7 months ago
Thanks! :)
Squid19301 year ago
Great Instructable. How accurate do you think this is?
pyrohaz (author)  Squid19301 year ago
Hey, thanks a lot! :) Unfortunately, not particularly. As you can see in the schematic diagram, it uses lots of resistors and capacitors (none of these being particularly accurate, generally +/- 10%) which are also affected by temperature, humidity, extraneous light and pressure changes. If you were to keep environmental changes constant though, it could actually be quite accurate. Good enough for a not too important task though!
ray741 year ago
pyrohaz (author)  ray741 year ago
Cheers :D
Bot13981 year ago
Superb instructable , deserves a vote :)
pyrohaz (author)  Bot13981 year ago
Thanks dude! :)
lewisb421 year ago
Favoriting this. Could be useful on a mini-sumo robot -- it would be very nice to have a single circuit board with microcontroller and rangefinders integrated.

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!