Parts: Analog distance sensors (Sharp GP2D12/2Y0A02)

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.

cct

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.

gp2d12

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.

Comments

  1. dan says:

    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…

  2. DarkAxi0m says:

    does anyone know how to get range sensing at around 30-60 meters?

  3. Ethan says:

    This isnt hack-a-day worthy…

  4. hunt says:

    …and neither are you ethan.

  5. gripen40k says:

    @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.

  6. SteamboatEd says:

    Make me one that works in meters instead of centimeters and it’ll be reeeally useful.

  7. Dave says:

    @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.

  8. Dave says:

    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

  9. vonskippy says:

    Great video – I’m guessing the meter actually shows something eh?

  10. Ian Lesnet says:

    @vonskippy – Sorry about the video quality on this one. It looked much better before being youtubeized.

  11. therian says:

    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”

  12. Zengar says:

    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.

  13. Jesco says:

    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

  14. Philip Klein says:

    The object used in the video is the “hack a day webserver on a businesscard” pcb ;)

  15. sly says:

    @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).

  16. JW says:

    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.

  17. SchrodingersCat says:

    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?

  18. therian says:

    accurate at distances from 0-80cm
    maybe
    parking sensor ..? but they expensive

  19. ericwertz says:

    @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.

  20. morcheeba says:

    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!

  21. tipo says:

    Does anybody know how to connect a Sharp IRDM gp2y0a710k0f to an analog input of a Velleman k8055?

  22. 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

  23. joey says:

    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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,813 other followers