Maker Pro
Maker Pro

trying to understand data from GP2Y0A02YK0F distance sensor

mli

Apr 16, 2014
2
Joined
Apr 16, 2014
Messages
2
Hi there.
I'm new to everything electronics so I apologize in advance for any remedial questions. I just bought a Sharp GP2Y0A02YK0F distance sensor. the datasheet is found here:

http://www.sharpsma.com/webfm_send/1487

I *think* I've wired it up correctly... I'm getting data back and printing it out to a console (using an arduino board).
I have two questions / issues:

1. When the unit is lying with the lenses facing up, I'm getting back values that are between 180 and 190. There's nothing in front of it. it's facing the ceiling which is 7ft up. I've measured the voltage and it looks like I'm getting a reading of 0.49xx consistently. If I'm understanding the charts on page 5 of the manual properly, at 0.5 volts,shouldn't it be returning a value of 0 or max 10?
I'm not sure if I'm understanding the chart properly.

2. how would i convert the numbers that are coming back into cms?
I tried reviewing the second chart on page 3 but I can't make heads or tails of it.

Sorry, this is my first electronics project.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
The sensor will give you a voltage between 0.5 and 2.75V.

Try placing a piece of white card about 20cm from the sensor. The output should be around 2.5V.

And show us how you've wired it up.
 

nas-r

Apr 13, 2014
10
Joined
Apr 13, 2014
Messages
10
The first graph in fig2. seems to show that as the object gets further away the output voltage drops. This device was only designed to accurately measure between 20-150cms. At 150cms you should expect a voltage close to 0.5, and as you can see from the graph distances greater than this don't cause much of a change in output voltage. So when it's facing the ceiling the reading of 0.49 seems to make sense according to that graph.

I think the point of confusion is that they've drawn a line from the origin to the first measured point on their graph at 10cms. My advice would be to ignore anything before that first plotted point at (10cms, 2.3V)

Regarding calibrating the voltage reading vs. distance, you could use the chart on page 5, put it in excel and find a function that correlates the voltage with the distance. Alternatively you could calibrate it manually by constructing your own chart with values of distance vs voltage. This is how I would do it.

Good luck!
 
Top