The Sharp GP2Y0A02YK0F is an infrared sensor that returns an analog signal proportional to the distance to an object. It is sensitive between 20cm and 150cm. Clones sold under the reference A02YK0 FXX may have different characteristics and require manual calibration. Read this tutorial that explains step by step how to manually calibrate your sensor.
The Sharp A02YK0 connects to an analog input of an Arduino, ESP32 or ESP8266.
I advise you to use the ZSharp library directly available from the Arduino IDE to read the distance directly in millimeters.
If you get random measurements like in this case beyond 700mm
Follow this tutorial to perform a manual calibration. You can increase the accuracy and the measuring range.
After calibration, the sensor reliably allows up to 1300mm (1.3m).
Sharp GP2Y0A02YK0F Specials