Home | Product Categories | Infrared | SEN-08958

Infrared Proximity Sensor Long Range - Sharp GP2Y0A02YK0F

sku: SEN-08958 RoHS Compliant In Fritzing Library

Description: Infrared proximity sensor made by Sharp. Part # GP2Y0A02YK0F has an analog output that varies from 2.8V at 15cm to 0.4V at 150cm with a supply voltage between 4.5 and 5.5VDC. The sensor has a Japanese Solderless Terminal (JST) Connector. We recommend purchasing the related pigtail below or soldering wires directly to the back of the module.

This sensor is great for sensing objects up to 5 feet away!

Documents:

Pricing

In stock

14.95
13.46
11.96

4,015 in stock

price
10-99
100+



Add to Wish List


Comments 45 comments

  • Using this sensor, an Arduino Uno and Python 2.5 for data processing I made a single pixel camera. The sensor is attached to a servo rig allowing incremental rotation along X and Y axis. Python then takes the distance values and servo rotation coordinates, converts them to luminance and constructs an image pixel by pixel:
    Here’s a test scan:
    http://img413.imageshack.us/img413/2867/pointscan.jpg
    Image on the left is taken with a web camera and the image on the right is scanned with this Sharp Sensor (over the course of about 5 minutes). Used a single 0.1uF capacitor for signal filtering.
    The noise in the image comes primarily from the mechanical wobble of the rig (i.e. cheap Futaba servos).

    • By the way, this is what the rig looks like (pardon the webcam image quality).


      http://img443.imageshack.us/img443/4656/scannerx.jpg


      or


      http://yfrog.com/cbscannerxj


      In the foreground – a servo mount with the sharp sensor. In the background – a battery pack (4xAA) with Arduino Uno and a ProtoShield on top.


      Python 2.5 processed the data using PySerial module for serial communication and PIL (Python Image Library) for image reconstruction.

  • if your using the 3 wire connector then you need to wire the yellow to the analog in, the red to the 5V, and the black to GRD
    hope this helps

  • lmao! “This is a really hard to find item! Limit 4 pieces per customer.” vs. $13.45 10-99 (10% off), $11.96 100+ (20% off) i think there is a problem here as an individual may want to purchase more than 10 perhaps

    • its just the Sparkfun standard. Every single item on site has these cheaper priced listed under it. And the change all that for just three items..? (I am referring to the other two sharp IR sensors that Sparkfun sells)

  • I hooked this up to my Arduino, but I am not getting any input voltage. How should the wires be connected?

    • I take that back. The input voltage seems to be random, and not related to how far an object is.

    • Check the datasheet… One really fun gotcha of this component is that it needs two reads to really stabilize the data and get good information, but it will tell you the first read, meaning that if there is constant motion, or something JUST NOW stopped, your first read will be trash, and subsequent reads will actually have a basis in reality.

      • Re the comments on the “gotcha” – this comment threw me off a bit. I interpreted it as meaning every other read would be garbage..but actually it’s really just the very first read which (for me anyway) is no big deal.
        -Randy

  • Do they make something like this that works up to 50 feet?

  • 20 feet is pushing IR. I think Sharp makes one for that range. Beyond 20 feet, you’ll have to rely on LASER ranging ($$$). You might also try two parallel LASER beams and a TV camera, and try analyzing the number of pixels apart the two beam dots are, but that’s only theoretical and may require LASER power that could be harmful to human (and animal) eyes.

  • Would it be possible to raise the item limit to 5? The robots I build tend to have an odd number of proximity sensors for symmetrical obstacle detection. There’s a central sensor and a matching number for the left and right side. 3 sensors are enough for some setups, but for anything more complex (near/far side detection) or for motion tracking 4 just isn’t enough.
    Last time I needed to track linear movement, I had to go with a thermopile array, just because I couldn’t buy enough stand alone infrared detectors from Sparkfun.

    • You know, Jade, I’d be willing to bet if you explained your situation to Sparkfun, they’d let you buy the extra sensor. They’re reasonable folk.

  • Had a chance to test these out today. Managed to reliably extract about 1/3 of the maximum stated range (60cm) off a 4.5 volt power supply. Increasing the voltage to 5.5v raised the max range all the way to the stated 1.5m. Much like with sonic sensors, the power supply affects the intensity of the dot/ping and the max detection range. However the input voltage does not change the min range cutoff, so if 15cm is too much for you, go with a mid or short range Sharp sensor.
    Overall, great value, fast response and negligibly low self-noise.

  • These are great for almost everything. I’m going to be using this on a small robot.
    I unsoldered the weird connector thing, and soldered on a few 90 degree male header pins to this.

  • Hey, all these sharp proximity sensors are obselete!
    I almost used them on a project.

    • They work reasonably well and there doesn’t appear to be any single-component replacement available. Get ‘em while the getting is good.

  • Will IR remote controller interfere with it?

    • Short answer – yes. Depth perception will get affected by a small amount in presence of a foreign IR light source, but the remote is very unlikely to cause a major misreading unless you shine it right into the sensor or have it against the obstacle that it’s scanning.
      This device projects an infrared dot and triangulates the distance based on where it sees the reflection. The dot itself is not perfectly sharp, so the triangulation result gets affected by reflective quality of the obstacle on which it lands. A dot on a white surface will appear to be slightly closer than one on a black plane. The ambient light (including sunlight) containing infrared spectrum will also increase the perceived radius of the dot.
      Most IR remotes project a soft cone of light as oppose to a focused beam, so they won’t cause much error in reading. A ray of sunlight, in comparison, will generate a measurement error 100x greater. The device is best suited for indoor applications with constant lighting containing the least amount of IR. To get the idea of what the sensor actually sees check out my post higher in the thread.

  • Can we use glass case to protect this sensor from weather? Would it be ideal for car backup monitor? the ultrasonic ones arent weather proof and putting a glass case will void the range finding.

    • Glass case can be used for protection, provided it is flat and clear, not refracting or scattering light. Don’t use plexiglass as it reduces or completely blocks the infrared light.
      Regarding the main question, this would be a very bad choice for car backup monitor as it performs poorly in sunlight or under any light containing infrared spectrum. It’s best suited for indoor use. Most car sensors are ultrasonic. I use this one for outdoors which has some weatherproofing http://www.sparkfun.com/products/9496. It is pricey and if you do get dirt into it, it’ll be absolutely impossible to clean.
      In your case I’d go with a cheap Maxsonar EZ series sensor, putting a PVC pipe extender onto it for weatherproofing. The longer the barrel, the less chances of something getting into it.
      Another issue with IR sensors is that they project a dot and are only able to detect what’s directly in front of them based on how well the dot is reflected. If the object is black, shiny or textured you may get a bad reading. A sonic sensor is a lot harder to fool. In addition it emits a cone-shaped sound wave, so the detection radius is much wider.

  • I was wondering if anyone can help me with my problem.
    I bought this sensor hoping for it to track the distance my hand is away from it, which it does. However, the numbers corresponding to the distance fluctuate very quickly despite how I hold my hand still. Is this normal?
    I plan to use these numbers as a way to control which sounds I play. However, if the numbers fluctuate so much it won’t work.
    I’m using an Arduino Uno and Max MSP for my project.
    I apologize if this isn’t the place to ask this question but hopefully someone here can help me. Thanks.
    Other than that the sensor is plug and play =)

    • Make sure your power supply is clean and filter it with capacitors if necessary.
      Putting a 0.1 uF ceramic capacitor on the IR sensor output may also smooth out some of the signal.
      You can also smooth out the signal by averaging a set of readings in your Arduino code. Something along the lines of:
      void loop()
      {
      sensorInput = (analogRead(sensorPin));
      bufferA = bufferB;
      bufferB = bufferC;
      bufferC = sensorInput;
      average = (bufferA + bufferB + bufferC) / 3;
      delay(x);
      }
      That example takes a sensor reading and puts it in bufferC the first time. Second time the loop runs, that value passes to bufferB and third time to bufferA. Essentially, you get to keep the last 3 readings that you can then average to get a smooth output. By increasing the number of samples or the delay you can increase smoothing at the expense of latency.

  • Does anyone know how these react to different color? Say I have a white board at 2 ft and take a reading (discard first, average 4), then switch to a red, green or blue board at the same distance and take another reading the same way. Will I get the same reading both/all times or even something close?

    • Sounds like you’ve got an experiment to do!

      • Yup, I should get one soon then. I have the other style ones (GP2D120’s), so I might try it with that tonight.

  • Can someone help me with the equation to convert the reading into actual distance i.e. 975 x 1.318359375 = 1285.4mm 975 = 128.5cm
    Is my thinking incorrect? or my math?
    2.8V @ 15cm
    0.4V @ 150cm
    2.4/1024 = 0.00234375V
    1500mm/1024 = 1.318359375mm

    • This link should help:
      http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html

  • I did line fitting based on datasheet
    For 10bit ADC such as Arduino (0-5V => 0-1023),R square = 0.9902
    distance = 30431 * pow (sensorValue,-1.169)

  • very nice sensor. much easier to use than a ping sensor but does not have as much range. It is perfect though for my application.

  • hi guys
    what is the angle range of this sensor?
    thanks
    regards

  • !ATTENTION!
    This sensor’s case has relatively low resistance (150 Ohms), be careful when mounting on other conductors.

  • Surprised at how little information this data sheet has. Even plain old LED spreadsheets usually have a Radiation pattern.

  • how to installl this on the arducopter?

  • can I use this one to determine a waterlevel?
    so fixing it in my watertank with its beam downwards.
    or does water not reflex enough to give a distance??

    • it works on water as well but just to be sure i’m using a pingpong ball in a tube to determine the waterlevel (see also: http://howmuchsnow.com/waterlevel/)

  • The datasheet is clear it’s not 15cm it’s 20cm.

  • The equation I derived through measurements and am using with pretty good success is: y = 21208 * pow(x, -1.251);

    y = distance in inches. x = analog reading from sensor.

    The sensor works pretty good and buffering the values certainly helps with a more stable output. I’m buffering 10 values.

    I forgot to buy the 3 pin JST connectors with my sensors so placed an order for a bunch of 2, 3, 4, 6, & 8 pin PH connectors (male & female) from digikey.

    Sorry for multiple posts….The site is not compatible with Opera browser for posting comments.