Infrared Proximity Sensor Short Range - Sharp GP2Y0A41SK0F

Infrared proximity sensor made by Sharp. Part # GP2Y0A41SK0F has an analog output that varies from 3.1V at 4cm to 0.3V at 30cm 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.

Infrared Proximity Sensor Short Range - Sharp GP2Y0A41SK0F Product Help and Resources

Resources & Going Further

For more project ideas about the IR Sensor? Check out the following blog posts::


Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

2 Programming

Skill Level: Rookie - You will need a better fundamental understand of what code is, and how it works. You will be using beginner-level software and development tools like Arduino. You will be dealing directly with code, but numerous examples and libraries are available. Sensors or shields will communicate with serial or TTL.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

1 Electrical Prototyping

Skill Level: Noob - You don't need to reference a datasheet, but you will need to know basic power requirements.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #1082551 / about 7 years ago / 1

    Anyone have a problem using this type of sensor and getting a lot of noise or spikes in the output signal? I tried using an electrolytic capacitor to help mitigate the noise but it keeps showing spikes in output.

    I tried a filter, but the noise spikes are there and I need a consistent and steady output value. I read in a blog that when using arduino if you are plugged into a computer there may be ambient noise from the PC itself through the USB cable.

    here is the code I have.

    #include <Filters.h>
    
    const int output = 6;
    const int input = 0;
    
    const long referenceMv = 5000;
    
    
    float windowLength = 1;     // how long to average the signal, for statistist
    
    
    
    void setup() {
    
    }
    void loop() {
      // filters out changes faster that 5 Hz.
    float filterFrequency = 50.0;  
    
    // create a one pole (RC) lowpass filter
    FilterOnePole lowpassFilter( LOWPASS, filterFrequency );   
    RunningStatistics lowpassFilterStats;                    // create running statistics to smooth these values
    lowpassFilterStats.setWindowSecs( windowLength );
    
    while( true ) {
    
      lowpassFilter.input( analogRead(input) );
      lowpassFilterStats.input(analogRead(input));
      // do something else
      // put your setup code here, to run once:
      Serial.begin(9600);
      pinMode(output, OUTPUT);
      // put your main code here, to run repeatedly:
      //int val = lowpassFilter.output();
      int val = lowpassFilterStats.mean();
      int mV = (val * referenceMv) / 1023;
      int percent;
      percent = map(val,0,1023,0,10000);
      Serial.print(mV);
      Serial.print(",");
      Serial.println(percent);
      analogWrite(output, val);
      delay(10);
     }
    }
    

  • eso_logic / about 11 years ago / 2

    I have posted a project using this sensor as well as taken high-resolution tear-down photos of the sensor and put it on my blog here

  • Member #688825 / about 9 years ago * / 1

    The last diagram in the datasheet is essentially a linear correlation between the sensor's output voltage (on the y axis) and 1/L + .42 (on the x axis), where L is the length in cm. In the form y = mx + b it has an m of about 12.7. Solving for the length gives L = 12.7/V - .42, in cm. On a 5V Arduino with 10-bit ADC conversion, V = 5 x (analogReading/1023). So you can substitute V and crunch a few numbers to get a nice little conversion formula:

    int reading = analogRead(sensorPin);
    reading = max(1, reading);  // avoid dividing by zero!
    float cm = (2598.42/reading) - .42;
    

    I found that this gave very good results, and the calculation is simple and fast. Hope this helps others using this sensor!

  • We're trying to develop a smart bin which will read the fill-level of the bin and notify us by email when the bin is full and ready for collection. Can we get help on this? I'm thinking this sensor could be used to read the distance from the top of the bin to the material inside and notify when the distance is say xcm. The bin wil approximately 1m in height. Rjio rijo.ealias@gmail.com

  • Member #370393 / about 10 years ago / 1

    Does anyone know the field of view for this type of sensor? I can't find it in the datasheet

  • Member #546458 / about 10 years ago / 1

    Would this sensor be able to detect the distance to a water level if placed at the top of a tank?

    • Member #513255 / about 10 years ago / 1

      What is the depth of the tank? That is a good idea and it should work but it has a short range. The long range sensor I have tested to work reliable up to 12 feet but sometimes 17 feet depending on what is around it. But usually, if you want to read a level, I have worked on King system in an industrial setting; I uses a tube going to the bottom of the take and since it had a vent in the top of the take, you simply use a pressure switch for low or high levels. With the right sensor you should be able to calculate how many gallons of liquid it actually in the tank.

  • bwhitman / about 10 years ago * / 1

    I did a dumb calibration / "best fit" power curve in Excel after some measurements of the voltage reading in an Arduino to inches, here's my function:

    int sensorValue = analogRead(A0);
    float inches = pow(sensorValue,-0.867) * 539.98;
    

    This is using 5V USB powering the board and the Vcc going to a 5V pin on the arduino.

    Hope this helps anyone using this

  • PhilG / about 10 years ago * / 1

    Anybody know what the refresh rate for receiving new reading is on this device. I realize that it's outputting a continuous analog signal, but what is the effective response time in terms of that signal responding to changes in distance.

  • Member #575074 / about 10 years ago / 1

    somebody know which is pigtail that recommended?

Customer Reviews

4 out of 5

Based on 4 ratings:

Currently viewing all customer reviews.

3 of 3 found this helpful:

Works Great...

...For what it does. It was the wrong tool for my project (obstacle detection) due to the field of view. It will range a wall or big thing, but a chair leg may not be noticed. Was very easy to use and implement. The pigtail Sparkfun recommends is also good and makes installation quick.

Works very well

My preliminary test of this sensor showed that it is going to work well for my application. It really demonstrates a different concept for proximity detection.

Sharp sensor

Upto standard

Infrared Proximity Sensor works well

I have two of these, one horizontal and one vertical. I was wondering if the sense or detection angle and range would be different but it seems not.