SHARP IR Distance Sensor 10-80cm
The Sharp GP2Y0A21 IR Infrared Distance Sensor is an analog proximity sensor with a range of 10-80cm.
This sensor provides accurate distance measurements within the 10-80cm (4-32") range.
Infrared proximity sensors work by detecting the reflection of an invisible infrared light.
The GP2Y0A21 contains both an IR emitter LED and an IR detector in the same package along with some control circuitry.
It has three pins for connecting to your project: power, ground and an analog voltage output.
To use the GP2Y0A21, simply attach it to an analog input on your microcontroller and read the voltage to determine the distance.
It requires a 4.5-5.5V power supply and uses about 30 mA. A bypass capacitor of at least 10 uF between Vcc and GND is recommended.