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