I'm stuck tinkering around with a Sharp IR rangefinder today. Analog values from my Arduino are between 90(max range)-300(min range).
I know the Arduino is supposed to output between 0-1024. What I can't figure out is that if there's nothing obstructing the IR rangefinder between it's minimum and maximum distances, why am I not seeing values fluctuating between a larger range than 90-300?
Has anyone ever used these IR rangefinders to do more than just report if something is in the way (i.e. as a digital sensor)? I would really like to use this IR to report a distance that an object is away from my robot, but calibrating the thing is becoming a nightmare. Anyone ever encountered this problem before?
I have worked with them before and have a calibration excel file. I worked with the Sharp GP2D02, I published the file here https://webfiles.uci.edu/cagell/docs/IR.xls, I hope that is useful for you.
Thanks for sharing the file. Did you end up using all this data to implement a function or did you just use a lookup table in your code?
Cool video, by the way. I was especially impressed by the PS2 mouse hack to get a cheap rotary encoder. Did you find a tutorial on that or was it your own creation? If so, I'd love to see a write up on it, it looks really neat.
The voltage swing looks to be about .4 - 2.6V or so. Meaning we have
532.8 for the min distance
and about 82 for the max distance.
This is about right with what I'm getting through experimentation. So I guess I can map this to a voltage change and use the linearized distance equation I've developed to determine what distance the object I'm looking at is from the sensor.
This still doesn't take care of the erratic noise values I'm getting, though. I think I will sum five or ten points and introduce a slight delay into the reading of the data. I may also rig up a resistor & cap combo to smooth it out, as well.
Feel free to look at the datasheet and let me know if there's anything I'm missing.