








GP2Y0A21YK0F SENSOR - Sharp Distance Measuring Sensor (10–80 cm) – Analog Output Proximity Module
This IR distance sensor produces an analog output that varies from 3.1V at 10cm to 0.3V at 80cm. It can find the distance to objects that present a very narrow edge such as a wall at a very sharp angle. The Sharp GP2Y0A21YK0F IR Distance Sensor is a compact, analog-output proximity module capable of measuring objects from 10 cm to 80 cm. Designed for use with Arduino, Raspberry Pi, and robotic automation, it delivers stable and accurate distance measurements using infrared triangulation.
₹ 390
₹499
499



Add FAQ
Detailed Description:
Precisely measure distances in your robotics, automation, and interactive projects with the reliable GP2Y0A21YK0F Sensor – Sharp Distance Measuring Sensor (10–80 cm). This popular and cost-effective infrared (IR) sensor provides a continuous analog output voltage that is inversely proportional to the distance of an object within its detection range, making it incredibly versatile for various applications from obstacle avoidance to human-machine interaction.
The GP2Y0A21YK0F operates using the principle of triangulation. An integrated infrared LED emits a beam of light, which reflects off an object and is then detected by a Position Sensitive Detector (PSD). The angle at which the reflected light hits the PSD allows the sensor's internal signal processing circuit to accurately determine the distance. This method provides robust performance, being less susceptible to ambient light interference and object reflectivity compared to simpler IR reflectance sensors.
With an optimal measurement range of 10 cm to 80 cm (approximately 4 to 32 inches), this sensor is well-suited for close to medium-range applications. It typically operates on a 5V DC supply (4.5V to 5.5V) and draws a low average current of about 30mA. The analog output voltage ranges from approximately 2.3V at 10cm to 0.4V at 80cm (values may vary slightly by sensor, and it's important to note the non-linear relationship between voltage and distance, often requiring a lookup table or a power-law formula for accurate conversion). Due to its analog nature, it connects directly to an analog input pin on microcontrollers like Arduino, ESP32, or Raspberry Pi (with an ADC). We recommend adding a 10µF or larger capacitor between VCC and GND near the sensor to stabilize its power supply, ensuring stable and accurate readings. The GP2Y0A21YK0F is a compact, robust, and essential component for adding smart proximity and distance sensing capabilities to your next innovative project here in Pune, Maharashtra, India.
The Sharp GP2Y0A21YK0F is an infrared (IR) proximity sensor that provides non-contact distance measurement in the range of 10 cm to 80 cm. The sensor outputs a non-linear analog voltage corresponding to the distance of an object, making it ideal for robot navigation, obstacle detection, autonomous systems, and automated control setups.
Unlike ultrasonic sensors, this sensor uses IR triangulation, which provides more consistent readings on uneven surfaces and in noisy environments. It comes with a 3-pin JST cable and is directly compatible with Arduino analog pins.
Key Features:
-
Measures distances from 10 cm to 80 cm
-
Analog voltage output – easy to read with ADC
-
Uses infrared triangulation – more stable than ultrasonic in many cases
-
Compact and lightweight – fits easily in robotic systems
-
High noise immunity and fast response time (~39 ms)
-
Directly usable with Arduino, ESP32, STM32, Raspberry Pi (with ADC)
-
JST 3-pin connector for quick setup
-
Reliable and maintenance-free operation
Technical Specifications:
Parameter | Specification |
---|---|
Sensor Model | Sharp GP2Y0A21YK0F |
Distance Measuring Range | 10 cm to 80 cm |
Output Type | Analog voltage (non-linear) |
Supply Voltage | 4.5V – 5.5V DC |
Average Current Consumption | ~30 mA |
Response Time | ~39 ms |
Interface Type | JST 3-pin (VCC, GND, OUT) |
Operating Temperature | -10°C to 60°C |
Dimensions | ~45mm x 20mm x 18mm |
How to Use:
-
Connect VCC to 5V, GND to GND, and OUT to an analog pin (e.g., A0).
-
Read the analog value and map it to distance using a conversion formula or look-up table.
const int sensorPin = A0;
void setup() {
Serial.begin(9600);
}void loop() {
int raw = analogRead(sensorPin);
float voltage = raw * (5.0 / 1023.0);
Serial.print("Sensor Voltage: ");
Serial.println(voltage);
delay(100);
}Note: The output is non-linear. Use a calibration curve or graph to map analog values to actual distance in cm.
Applications:
-
Mobile robot obstacle detection
-
Proximity alarms and auto-door triggers
-
Wall-following robotic cars
-
Automated parking systems
-
Industrial automation and object counters
-
Distance-based motor control
-
Smart garbage bins and touchless control
-
DIY laser tag or IR tripwire systems
Package Includes:
-
1 x Sharp GP2Y0A21YK0F IR Distance Sensor (10–80 cm)
-
1 x 3-pin JST Connection Cable
0 Reviews For this Product
