I've used the GP2D12, which is similar. Basically, it gives a voltage out based on proximity. So, you can use an ADC for general distance measuring or you can use a comparator to trigger on a fixed distance. I used an ADC.
Some points from experience:
- this sensor injects a lot noise on the power line - probably due to pulsing the IR LED. I used a 33 uF electrolytic as a bypass since the noise is pretty low frequency. a 100n cap wouldn't hurt either
- make sure the case is grounded. yes, the case is plastic but it is conductive.
- keep the sensor positioned as high as possible. I had mine mounted low and got a lot of ground scatter which translated into A LOT (5-6 LSBs) of noise. Once I raised it up, I got around 2.5 LSBs of noise. Bypassing helped somewhat. I've talked to others using this device and they got similar results.
- use good layout techniques for analog signals.
- internally, the device has a fairly slow update cycle, don't bother sampling it very fast - it's a waste of time.
Don't expect extreme accuracy. I spent a fair amount trying to get a decent mapping of ADC value to distance and found that the farther the distance, the less the accuracy. coupled with noise and at about 2/3 of max range the GP2D12 seemed almost useless as a distance measuring device. If you can nail the noise problem, accuracy could be improved. ground scatter is probably an issue at extreme range.