Components / Sensors / Sharp GP2Y0A21YK0F IR distance sensor

Sharp GP2Y0A21YK0F IR distance sensor

Analog IR distance sensor for 10 to 80 cm.

MeasuresDistance (IR triangulation)
Range10 to 80 cm
InterfaceAnalog voltage, not linear
Supply voltage4.5 to 5.5 V
SensorsReviewedMPN GP2Y0A21YK0FUsed in 3 projects
SHARP
In short

What is the Sharp GP2Y0A21YK0F IR distance sensor and what is it used for?

Analog IR distance sensor for 10 to 80 cm. Makers use it for robot obstacle distance.

How it works

An IR LED projects a spot and a position-sensitive detector measures the angle of the reflection (triangulation).

Key specifications

Sensor specValue
MeasuresDistance (IR triangulation)
Range10 to 80 cm
InterfaceAnalog voltage, not linear
Supply voltage4.5 to 5.5 V

Pinout

VoAnalog output (yellow wire)
GNDGround (black wire)
Vcc5 V (red wire)

How to use it

The output is not linear: about 3.1 V at 10 cm falling to about 0.4 V at 80 cm. Use a lookup table or a fitted curve. Add a 10 µF capacitor across the supply at the sensor, as it draws current in pulses. Below 10 cm the reading folds back and looks far again.

Applications

Alternatives

Buy at

Common questions

What is the Sharp GP2Y0A21YK0F IR distance sensor used for?

In maker projects: robot obstacle distance.

How does the Sharp GP2Y0A21YK0F IR distance sensor work?

An IR LED projects a spot and a position-sensitive detector measures the angle of the reflection (triangulation).

What voltage does the Sharp GP2Y0A21YK0F IR distance sensor need?

4.5 to 5.5 V.

How do I connect the Sharp GP2Y0A21YK0F IR distance sensor to an Arduino or ESP32?

Analog voltage, not linear. Pins: Vo (Analog output (yellow wire)), GND (Ground (black wire)), Vcc (5 V (red wire)).

What can I use instead of the Sharp GP2Y0A21YK0F IR distance sensor?

VL53L0X time-of-flight distance sensor.