POLOLU
Sharp GP2Y0A21YK0F Analog Distance Sensor 10-80cm
Sharp GP2Y0A21YK0F Analog Distance Sensor 10-80cm
SKU:Pololu-136
2 in stock
Couldn't load pickup availability
Share
The GP2Y0A21 Sharp distance sensor is a great way to add obstacle avoidance or motion sensing to your robot or any other project. With a detection range of 4" to 32" and an analog voltage indicating the distance, this sensor is very easy to use.
Overview
The Sharp distance sensors are a popular choice for many projects that require accurate distance measurements. This IR sensor is more economical than sonar rangefinders, yet it provides much better performance than other IR alternatives. Interfacing to most microcontrollers is straightforward: the single analog output can be connected to an analog-to-digital converter for taking distance measurements, or the output can be connected to a comparator for threshold detection. The detection range of this version is approximately 10 cm to 80 cm (4" to 32"); a plot of distance versus output voltage is shown below.
The GP2Y0A21 uses a 3-pin JST connector that works with our 3-pin JST cables for Sharp distance sensors (not included) as shown in the upper picture on the right. It is also simple to solder three wires to the sensor where the connector pins are mounted (see the lower picture to the right). When looking at the back, the three connections from left to right are power, ground, and the output signal.
![]() ![]() |
Feature summary
- operating voltage: 4.5 V to 5.5 V
- average current consumption: 30 mA (typical)
- distance measuring range: 10 cm to 80 cm (4" to 32")
- output type: analog voltage
- output voltage differential over distance range: 1.9 V (typical)
- response time: 38 ± 10 ms
- package size: 29.5×13.0×13.5 mm (1.16×0.5×0.53")
![]() |
Linearizing the output
The relationship between the sensor’s output voltage and the inverse of the measured distance is approximately linear over the sensor’s usable range. The GP2Y0A21YK data sheet (374k pdf) contains a plot of analog output voltage as a function of the inverse of distance to a reflective object. You can use this plot to convert the sensor output voltage to an approximate distance by constructing a best-fit line that relates the inverse of the output voltage (V) to distance (cm). In its simplest form, the linearizing equation can be that the distance to the reflective object is approximately equal to a constant scale factor (~27 V*cm) divided by the sensor’s output voltage. Adding a constant distance offset and modifying the scale factor can improve the fit of this line.
Alternative Sharp Distance Sensors
We carry two other versions of this sensor as well: the longer-range Sharp GP2Y0A02YK0F analog distance sensor (20 – 150 cm) and the shorter-range Sharp GP2D120XJ00F analog distance sensor (4 – 30 cm). These analog distance sensors all have identical pin-outs and very similar packages, making it easy to swap one version for another should your application requirements change. We also sell a digital Sharp distance sensor, which has a very low minimum detection distance, quicker response time, lower current draw, and a much smaller package.
![]() ![]() |
A variety of Sharp distance sensors. |
---|
Note: The GP2Y0A21YK0F model is a lead-free (RoHS-compliant) version of the Sharp GP2Y0A21 Distance Sensor. The manufacturer recommends you insert a bypass capacitor of 10 uF or more between Vcc and GND near this sensor to stabilize your power supply line.

New Products
-
Sold out
PoE Injector
Vendor:LuxonisRegular price Rs. 2,099.00Regular priceUnit price / perSold out -
Sold out
OAK Thermal
Vendor:LuxonisRegular price Rs. 67,399.00Regular priceUnit price / perSold out -
Sold out
1-Port VINT Hub Phidget
Vendor:PhidgetsRegular price Rs. 2,699.00Regular priceUnit price / perSold out -
ACS37220LEZATR-100B3 Current Sensor Large Carrier -100A to +100A, 3.3V
Vendor:POLOLURegular price Rs. 829.00Regular priceUnit price / perSold out -
CT433-HSWF50MR TMR Current Sensor Compact Carrier -50A to +50A, 3.3V
Vendor:POLOLURegular price Rs. 1,039.00Regular priceUnit price / perSold out -
A5984 Stepper Motor Driver Carrier, Adjustable Current, Blue Edition
Vendor:POLOLURegular price Rs. 409.00Regular priceUnit price / perSold out -
A5984 Stepper Motor Driver Carrier, Fixed 1A@5V / 660mA@3.3V, Blue Edition (Soldered Header Pins)
Vendor:POLOLURegular price Rs. 489.00Regular priceUnit price / perSold out -
A5984 Stepper Motor Driver Carrier, Fixed 500mA@5V / 330mA@3.3V (Soldered Header Pins)
Vendor:POLOLURegular price Rs. 469.00Regular priceUnit price / perSold out -
Sold out
T Connector Male-Female Pair
Vendor:POLOLURegular price Rs. 169.00Regular priceUnit price / perSold out -
Pololu Reverse Voltage Protector, 4-60V, 10A
Vendor:POLOLURegular price Rs. 159.00Regular priceUnit price / perSold out -
Pololu Reverse Voltage Protector, 4-60V, 12A
Vendor:POLOLURegular price Rs. 199.00Regular priceUnit price / perSold out -
Pololu Ideal Diode Reverse Voltage Protector, 4-60V, 10A
Vendor:POLOLURegular price Rs. 179.00Regular priceUnit price / perSold out -
Pololu Ideal Diode Reverse Voltage Protector, 4-60V, 12A
Vendor:POLOLURegular price Rs. 229.00Regular priceUnit price / perSold out -
Pololu Mini Plastic Gearmotor Bracket Pair - Tall
Vendor:POLOLURegular price Rs. 599.00Regular priceUnit price / perSold out -
Ribbon Cable with Pre-Crimped Terminals 10-Color M-F 6" (15 cm)
Vendor:POLOLURegular price Rs. 149.00Regular priceUnit price / perSold out -
Ribbon Cable with Pre-Crimped Terminals 10-Color M-F 12" (30 cm)
Vendor:POLOLURegular price Rs. 279.00Regular priceUnit price / perSold out -
Wires with Pre-Crimped Terminals 10-Pack M-F 6"
Vendor:POLOLURegular price Rs. 339.00Regular priceUnit price / perSold out -
Ribbon Cable Premium Jumper Wires 10-Color M-M 6" (15 cm)
Vendor:POLOLURegular price Rs. 209.00Regular priceUnit price / perSold out -
Ribbon Cable Premium Jumper Wires 10-Color F-F 6" (15 cm)
Vendor:POLOLURegular price Rs. 209.00Regular priceUnit price / perSold out -
Ribbon Cable Premium Jumper Wires 10-Color M-F 6" (15 cm)
Vendor:POLOLURegular price Rs. 209.00Regular priceUnit price / perSold out -
Sold out
Pololu 30T Track Set - Black
Vendor:POLOLURegular price Rs. 1,809.00Regular priceUnit price / perSold out -
Pololu High-Power Stepper Motor Driver 36v8
Vendor:POLOLURegular price Rs. 3,119.00Regular priceUnit price / perSold out -
Sold out
Pololu USB AVR Programmer v2.1
Vendor:POLOLURegular price Rs. 1,239.00Regular priceUnit price / perSold out -
3-Channel Wide FOV Time-of-Flight Distance Sensor for TI-RSLK MAX Using OPT3101
Vendor:POLOLURegular price Rs. 6,289.00Regular priceUnit price / perSold out -
75:1 Micro Metal Gearmotor MP 6V with 12 CPR Encoder, Side Connector
Vendor:POLOLURegular price Rs. 3,149.00Regular priceUnit price / perSold out