Creative Commons images are CC BY 2.0

### \$ 13.95

shopping cart

 quantity Out of stock out of stock 13.95 1+ units 13.25 25+ units 12.56 100+ units

We do not currently have an estimate of when this product will be back in stock.

Need larger quantities?
Check out our Volume Sales program

Description: 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.

Documents:

## Recommended Products

• 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

• 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

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

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

• 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.

• 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

• 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.

• somebody know which is pigtail that recommended?

## Customer Reviews

### 4 out of 5

Based on 1 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.

In 2003, CU student Nate Seidle blew a power supply in his dorm room and, in lieu of a way to order easy replacements, decided to start his own company. Since then, SparkFun has been committed to sustainably helping our world achieve electronics literacy from our headquarters in Boulder, Colorado.

No matter your vision, SparkFun's products and resources are designed to make the world of electronics more accessible. In addition to over 2,000 open source components and widgets, SparkFun offers curriculum, training and online tutorials designed to help demystify the wonderful world of embedded electronics. We're here to help you start something.