Sharp IR Distance Sensor Algorithms
I love me some Sharp IR distance sensors, even if their analog output is non-linear. I suspect most of us use these either with lookup tables or in non-precision applications where rough ranges are used. But this morning I found some hardcore equations at https://www.upgradeindustries.com/product/58/Sharp-10-80cm-Infrared-Distance-Sensor-(GP2Y0A21YK0F) and https://www.upgradeindustries.com/product/57/Sharp-20-150cm-Infrared-Distance-Sensor-(GP2Y0A02YK0F)
Depending on your ADC resolution and other factors, you might not need floating-point accuracy to 6-7 sig figs.
Depending on your ADC resolution and other factors, you might not need floating-point accuracy to 6-7 sig figs.
Comments
Thanks for sharing. Now....Bookmarked.
I bet Jim has that PDF and will post it. Or will I find it first?
Have to see what the competition is doing.
Hello,
Does anyone have some working code in C that works with the: GP2Y0A21YK0F?
I have attempted to access it with the example codes in the PropC libraries but nothng gives me
anything that is useable. Have used my Simpson and my O'scope to follow the voltage changes on
two of the sensors. The meter and the scope show correct function of the unit but the code for it
and the other example codes to not change values correctly and show an integer of 2 and a varing floating
point.
Thank you in advance.
Martin