Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Sensors
  4. ›Sharp IR Distance Sensors

Component guide · Beginner · 3 min read

Sharp IR Distance Sensors

GP2Y0A21, GP2Y0A02 and I2C Models for Arduino

By Geekobot Learning Team · Updated 29 Oct 2026

On this page
Short answerHow it worksWiringConverting voltage to distanceBrackets and mountingAlternativesTry itCommon mistakesFAQsParts and next steps
Short answer

Sharp IR distance sensors measure distance by triangulation and output an analog voltage that falls as the distance grows. The curve is non-linear, so convert the reading with a formula or table. Add a capacitor across the supply to reduce noise, ignore readings closer than the minimum range, and choose the model for your range (for example 20 to 150 cm for the GP2Y0A02YK0F).

Key specs at a glance

GP2Y0A02YK0F
20 to 150 cm analog output
GP2Y0A21-class
10 to 80 cm analog output
GP2AP03VT00F
Digital I2C model
Supply
4.5 to 5.5 V, about 30 mA
Update
About 25 to 40 ms per reading
Mounting
Brackets and 3-pin cables
01

How it works

The sensor shines a narrow IR beam and a position-sensitive detector sees where the reflection lands. The angle gives the distance by triangulation, so colour matters less than with simple IR reflectance sensors. The analog output is highest at close range and falls with distance, and it also drops if the object is closer than the minimum distance, which gives a wrong, far-looking reading.

02

Wiring

Connect VCC to 5 V, GND to ground and the signal wire to an analog input. Place a 10 to 100 µF capacitor across the sensor's supply pins right at the connector, since it draws current in pulses. On 3.3 V boards read the output through the ADC range or a voltage divider; see ADC basics and voltage dividers.

03

Converting voltage to distance

The relation is roughly inverse: distance ≈ k / (V − b). Calibrate with a few known distances and fit the formula, or use a lookup table with interpolation. Average several readings, and discard values outside the datasheet range. The ADC resolution tool shows the step size of your reading.

04

Brackets and mounting

Use a bracket to aim the sensor parallel to the floor and keep it steady. Several sensors in a ring give a rough scan around a robot; stagger their readings in time so their beams do not interfere. Keep the lens clean and away from direct sun.

05

Alternatives

Time-of-flight sensors such as the VL53L0X give a digital distance, ultrasonic sensors work on any material and LiDAR suits long range. Simple obstacle detection is covered in IR sensor modules.

06

Try it: Adc resolution calculator

Change the values and the diagram and results update as you type.

07

Common mistakes to avoid

  • !Reading closer than the minimum distance.
  • !Skipping the supply capacitor.
  • !Treating the output as linear.
  • !Putting several sensors in a row firing at once.
  • !Using it in direct sunlight.
08

Frequently asked questions

How do I convert the voltage to centimetres?

Use a calibration table or a fitted inverse formula.

Why does my reading jump?

Supply noise, object too close or reflective surfaces. Add a capacitor and average.

Does colour matter?

Much less than with reflective IR modules, but very shiny surfaces can cause errors.

Can it work at 3.3 V?

It needs 4.5 V or more, but the output can be read by a 3.3 V ADC with a divider.

Which one for a robot?

The 10 to 80 cm model for small robots; the 20 to 150 cm model for larger ones.

Parts for this guide

  • Sharp Microelectronics GP2Y0A02YK0F 20–150 cm Infrared Distance Sensor – Analog Output
    ₹1,349View
  • Sharp Microelectronics GP2AP03VT00F Distance Sensor, I²C Digital Output, Range: 1 cm~30 cm
    ₹267View
  • Seeed Studio Grove IR Distance Interrupter v1.2 Sensor – 5V Digital Output
    ₹589View
  • EasyMech Parallel Bracket for Sharp Microelectronics IR Sensors – 1mm MS, M3 Hardware Kit
    ₹97View
  • EasyMech Perpendicular Mounting Bracket for Sharp Microelectronics IR Sensors – MS Steel w/ Nylon Hardware
    ₹85View
  • Replacement Cable for Sharp Microelectronics Distance Sensors – 30cm, JST PH Female Connector
    ₹19View
Shop Infrared, ToF & LiDAR Distance Sensors

Calculators

Adc resolution calculatorVoltage divider calculator

Terms in this guide

Analog signalA signal whose voltage varies continuously, such as a sensor output of 0 to 3.3 V, rather than switching only between HIGH and LOW.ADCAnalog-to-digital converter: turns a voltage into a number. A 10-bit ADC gives 0 to 1023; a 12-bit ADC gives 0 to 4095.Time of flightMeasuring distance from how long a signal (sound or light) takes to bounce back.InfraredLight just beyond red that people cannot see, used by IR obstacle sensors, remote controls and line-following sensors.

Projects that use it

Put this into practice: 1 step-by-step build in our project library uses parts from this guide.

Beginner · 1 to 2 hoursGarage parking assistant with a TF-Luna LiDAR and traffic-light LEDsView project
Browse all 1 project

Keep learning

Component guideIntermediateVL53L0X and VL53L1X Laser Distance SensorsThe VL53L0X and VL53L1X are tiny time-of-flight sensors from ST.3 min read · SensorsComponent guideBeginnerHC-SR04 Ultrasonic SensorThe HC-SR04 measures distance from about 2 cm to 4 m by sending a 40 kHz ultrasonic pulse and timing the echo.3 min read · SensorsComponent guideBeginnerIR Obstacle Sensor ModuleAn IR obstacle sensor module shines infrared light from an LED and watches for its reflection with a photodiode; when something is within about 2 to 30 cm, its OUT pin goes LOW.3 min read · SensorsComparisonIntermediateLiDAR Distance SensorsCompare LiDAR distance sensors: single-point TFmini and TF-Luna, 2D scanners for SLAM and 3D LiDAR. Range, interfaces, sunlight limits and Arduino code.3 min read · SensorsConcept explainerBeginnerADCs ExplainedAn analog-to-digital converter (ADC) measures a voltage and returns a number.4 min read · Electronics FundamentalsBuying guideBeginnerChoosing a Robot ChassisFor a first robot car, a 2WD acrylic chassis with two gear motors and a caster wheel is cheapest and easiest to program.3 min read · Robotics

Sources

  • Sharp Microelectronics datasheets

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerHow it worksWiringConverting voltage to distanceBrackets and mountingAlternativesTry itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide1 item · ₹549

Sharp GP2Y0A21YK0F IR Distance Sensor, 10-80 cm

Ask the Community

Ask a question