[youtube=http://www.youtube.com/watch?v=iGiRK0vmcUw]
Sharp GP2D12 and 2Y0A02 infrared rangers output a voltage proportionate to the distance of an object from the sensor. The GPD12 senses objects at a distance of 10-80cm, while the 2Y0A02 has twice the range.
We’ve previously looked at the Sharp GP2Y0D02 digital proximity sensor. It only signals the presence of objects, while the GP2D12 and 2Y0A02 measure distance to them. If you’ve got a GP2YoD02, it might still be possible to tap the analog output. We’ll show you how use these sensors below.
Sharp GP2D12, 10-80cm analog IR ranger (Digikey #425-2046-ND, $12.81). Datasheet (PDF).
Sharp 2Y0A02, 20-150cm analog IR ranger (Digikey #425-2062-ND, $14.38). Datasheet (PDF).
We powered the sensors with a 5volt supply, as shown in the schematic above. We connected the output directly to a multimeter set to measure voltage. The datasheet also recommends a 10uF bypass capacitor between the power and ground pins, but we didn’t use it for this demonstration.
This graph shows the relationship between the output voltage of the GP2D12 and the distance of objects from the sensor (datasheet page 3, figure 6). You can find the distance/voltage curve for the 2Y0A02 in datasheet page 5, figure 2. There’s an equation to determine distance from the output voltage, or you could use a simple lookup table.
The output is unreliable for extremely close objects, seen as the small hump between 5 and 10cm. It’s possible to combat this by using several sensors with overlapping ranges, or by placing sensors so that nothing can come within the minimum range.
For an exhaustive discussion of the various Sharp proximity sensors, check out the Sharp IR ranger information page at Arconame.
Like this post? Check out the parts posts you may have missed. Want to request a part post? Please leave your suggestions in the comments.
that’s some brilliant timing, i impulse bought a gp2d12 along with some other stuff last week. saw some on a robot at work and thought it might be cool to play with. my intention is to combine it with a vibration motor on the palm of a glove, so that you can ‘feel’ things with a spooky sixth sense. could also work as a cheapo parking sensor…
does anyone know how to get range sensing at around 30-60 meters?
This isnt hack-a-day worthy…
…and neither are you ethan.
@hunt: oh snap!
K, so these things are great, but for those who want something digital, might I recomend these guys:
http://www.hvwtech.com/products_view.asp?ProductID=665
They basically took the same sharp sensor and added their own really small pic microcontroller, and gave the things I2C out, or if you search around on their site they also have serial ones. Cool stuff, handy for more complicated projects.
Make me one that works in meters instead of centimeters and it’ll be reeeally useful.
@steamboated-
No problem- but you gotta start looking audio instead. Try this for a 2m – 3m range:
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=DM163026-ND
You can use some better parts to get more like 10m range if you need it.
Sorry wrong link- that one has a range finder on it, but its not dedicated. Try this one instead (its cheaper):
http://www.micro-examples.com/public/microex-navig/doc/090-ultrasonic-ranger.html
Great video – I’m guessing the meter actually shows something eh?
@vonskippy – Sorry about the video quality on this one. It looked much better before being youtubeized.
well Ethan have a point, well here future hacks:
“termoresistor multimeter and a match”
“LDR and flashlight”
and everyone’s favorite touch activated a “button and a led”
You’re right ethan and therian, this isn’t a hack. I notice that myself right off, when the title started with “Parts:” . . .
As long as there’s at least one hack per day the site can keep it’s name and it’s nice for them to post these little additions that might spark someones creativity and prompt a future hack.
I used three of these little sharp sensors for my masters project, a light weight height sensor for helicopter UAVs. I combined the GP2D15A, GP2A2YK and GP2AKOF in complement using a TI MSP430 to get a range from 15cm to about 5m. They are slightly tricky to use though since the output voltage isnt linear. Have a look if you like:
http://dl.getdropbox.com/u/160901/Report_08-M-067.pdf
The object used in the video is the “hack a day webserver on a businesscard” pcb ;)
@DarkAxi0m
you’ll probably have to go with sonic or laser range finders for that kind of distance (re: golf range finders are typically laser).
I used these sensors for a microprocessor project. I attached them to the head of a roboquad and then used them (I fried the original IR sensor since I didnt know what it was).
So I used them to measure the distance from the head, then controlled the motors in the head to look around and draw a ‘picture’ of the distances in front of it.
I have used these sensors for a project of mine but found their accuracy (even after calibration) to be a bit off. The output even with the capacitor was very noisy. Does anybody know of another (preferable cheap) sensor that can do the same job but be more accurate at distances from 0-80cm?
accurate at distances from 0-80cm
maybe
parking sensor ..? but they expensive
@SchrodingersCat (don’t know if you’re there or not :-))
You might look at the Maxbotix ultrasonic rangers which are $30. They’ll use more power though. They almost have to, as infrared is as power-frugal as you’re going to get at that range, as neither capacitive nor inductive sensing will work except in REALLY constrained environments.
I got one of these a few weeks ago, but haven’t played with it yet. I was thinking of replacing the transmit LED with a laser — I need to sense the distance of a small object at a distance, and a more-precise spot might be helpful. Looking for to experimenting with this!
Does anybody know how to connect a Sharp IRDM gp2y0a710k0f to an analog input of a Velleman k8055?
Dear Sales ,
Oompany is distribute Electronic parts in Iran market .
If it’s possible for you please send me your price about
GP2D12 100PCS
I’m waiting your reply
Thanks
Mina
Tell : +9821 6671 5432
Fax : +9821 6671 2825
hi.. i would like to ask, is it i directly connect the output signal to the meter like above, then i will get the reading? or i need to change it to dc 1st onie can get the voltage like the video? pls help… thanks alot