Sharp Range Sensor gives inconsistent results

I’m using a similar sensor gp2d12

I found this but have not tried it yet…waiting for another proto board to work on first.

it’s not a picaxe, but based on the same mcu family.

The guy notes the use of a 4.7mf cap for this sensor.

http://www.oopic.com/gp2d12.htm

Are you missing some resistors?

Once again, I have no idea what I am talking about but I noticed you are missing 2 resistors on your 18 board… I think they are called pull-down resistors. (Are pull down resistors only for digital inputs?). I have no idea what I am talking about. All I know it there are spaces for 2 resistors on that board. They are connected to the first two inputs. I have them installed and my sharp IR’s are working. You don’t have them and yours don’t.

Again, I have no idea what I am talking about.

 

–Oh, Frits-- I’m not the Ping/picaxe expert! I’m the guy who says it won’t work! – I have seen some promising posts, but I have yet to see a video with it working!! :slight_smile:

www.rocketbrandcustom.com baby!!

Since it’s an analogue

Since it’s an analogue device, a pull up/down resistor doesn’t make much sense(logic 1/0)…if anything I would guess it to be a current limiting resistor to prevent the mcu from getting fried if too much current were pushed to it. The input pins only sink/source 15-20ma from what I recall.

I got the ping/ picaxe

I got the ping/ picaxe working!

https://www.robotshop.com/letsmakerobots/node/1346

Check out the 3rd video down, and the code is attached to the post.

 

 

Sensor oddities

Strange things that might be a clue :

The Sharps have a “cone” of detection, starting at the sensor then widening about 15 degrees out to a maximum width of about 10 or 12 inches ( 25 to 27 cm ) in their range, sometimes even tapering off further out. What might not seem in their detection area can sometimes actually be causing false readings. The 100 reading sounds like it’s picking something up 5-6 inches (13-14 cm) away, and the pictures show the sensor aimed a bit downward, though you probably aim it somehow when testing. The max value you might see could be 160 or so, when the sensor detects something 2 inches (5 cm) away, but dropping again as the obstacle gets even closer.

Other possible glitches include some types of flourescent and sodium lighting, that used to mess with other types of IR detectors as there were 40 kHz harmonics in the light.Not sure if I recall any specific instances with the Sharps, though it did fool others.

Another possible glitch was from an old Sharp app note on these type sensors, that stated the device should be mounted vertically if the detected surface corners were vertical, or horizontal (as you have) if the corners detected were primarily horizontal (due to specular reflection or something like that).

I’ve personally noticed on these sensors a cracking of the solder joints around the pins. Retouching the solder generally cures it.

 

I’m getting exactly the same

I’m getting exactly the same problem (as I understand it) as the OP with a Sharp 3cm - 30cm analogue sensor.  Within the range 3cm to 30cm, the analogue output is exactly as per the graph - i.e. 3V down to 0.5V.  Also, below 3cm the output drops off again, as per the graph.  The strangeness occurs when the distance to an object is BEYOND 30cm.  The output rapidly increases from 0.5V to a constant level of around 1V and stays there.  I have included the 10uF decoupler near the device, am measuring with a scope and in an optically quiet environment. 

The sensor is performing to spec - It is a 3 to 30cm sensor, but the 1V out of range is annoying as any simple program would indicate an object at 10cm or so.  I think the way around it is to define a ‘dead band’ in the code where values are ignored, but this would chop a chunk out of the detection range.

Andy.