SparkFun Electronics
SparkFun Electronics GP2Y0A21YK Infrared Proximity Sensor
Infrared proximity sensor with analog output ranging from 3.1V at 10cm to .4V at 80cm and a JST connector
- TypeSensors
- Analog voltage drops from 3.1V at 10cm to .4V at 80cm
- Genuine Sharp GP2Y0A21YK part ensures reliable infrared detection
- Female JST connector allows quick wiring without soldering
- Continuous distance feedback suits robotics and automation projects
- Requires basic programming and prototyping skills for integration
Analog Infrared Proximity Sensor
The SparkFun GP2Y0A21YK is a Sharp-manufactured infrared proximity sensor that delivers an analog voltage signal proportional to object distance. It suits hobbyists, students, and engineers building obstacle-avoidance robots, interactive installations, or presence-detection circuits who need a ready-to-use module with a standard JST connector.
Upgrade from basic IR pair or digital-only module
This sensor replaces simple emitter-detector pairs or digital-switch modules when a continuous distance estimate is required. The jump is worth it when your application needs to distinguish near from far objects rather than only detect presence, and when you can work with an analog input on your microcontroller or ADC.
Check power supply voltage
Verify that your board can supply the sensor's operating voltage and that its analog-to-digital converter provides enough resolution to use the 0.4 V to 3.1 V output swing effectively. Ensure you have a compatible JST pigtail or the ability to solder wires to the rear connector, and confirm that the 10 cm to 80 cm sensing window matches your mechanical layout.
Highlights
- Analog voltage drops from 3.1V at 10cm to .4V at 80cm
- Genuine Sharp GP2Y0A21YK part ensures reliable infrared detection
- Female JST connector allows quick wiring without soldering
- Continuous distance feedback suits robotics and automation projects
- Requires basic programming and prototyping skills for integration
Specifications
| Type | Sensors |
|---|
Questions about this item
What spacing does the female JST connector on the back need for a mating pigtail?
The sensor uses a standard Japanese Solderless Terminal (JST) connector on the rear; a matching 3-pin JST pigtail plugs straight in without soldering.
How do you wire the sensor and which step do builders often miss?
Connect the JST pigtail to power, ground and the analog signal pin; the step often missed is adding a decoupling capacitor near the supply pins to suppress noise on the output.
When should the IR emitter or detector window be cleaned to keep readings accurate?
Clean the optical window whenever dust or debris builds up, since contamination changes the analog voltage that drops from 3.1V at 10cm to .4V at 80cm.
Also in this aisle
People compared these
Same shelf, same checkout — eight coins and a 30-minute rate lock.



