Help with interfacing GP2Y0A60SZ with Arduino

I have been unable to successfully find a way to accurately use this sensor: playground.arduino.cc/Main/SharpIR . I am using this simply because it is the smallest thing I’ve found that can measure over a meter in distance, and would love to be able to use this in my projects.

One more thing: The data sheet says that this sensor needs 400 mA of power; is this true? What would happen if I only supplied it 150 mA? Thanks a lot!

Hello.

Could you post your raw sensor readings, so I could take a look at what you are getting?

The emitter on the sensor draws current in bursts. Limiting the amount of current might affect the performance of the sensor. How are you powering the sensor? Could you post pictures of your setup that show all connections?

- Grant

[quote=“grant”]Hello.

Could you post your raw sensor readings, so I could take a look at what you are getting?

The emitter on the sensor draws current in bursts. Limiting the amount of current might affect the performance of the sensor. How are you powering the sensor? Could you post pictures of your setup that show all connections?

  • Grant[/quote]

I actually just solved this problem. I’m giving the sensor straight voltage right out of the 3.3 v pin on a blend micro, plugging the ground pin straight into one of the grounds on the blend micro, and taking the readings through the A5 pin. My next question is, how do I convert the analog readings to distance in centimeters? Since this is not a linear, and the readings are reversed (output gets higher the closer an object is), I do not know how to approach this.

I am glad you were able to figure out your issue. You can use the graph in the datasheet to give you an idea of how the output relates to the detection distance. The data sheet can be found under the “Resources” tab on the sensors product page. To properly map the output to the distance, you might consider creating a table of the voltages at a few key distances and then interpolate between the points in the table to approximate the distance that corresponds to intermediate sensor output voltages.

- Grant