Sharp 2Y0A700 with Arduino linearizing readings?

Has anyone ever used the IR distance sensor Sharp 2Y0A700? It's their biggest sensor, that detects up to a 5.5 m range. I need to use it in an installation with a deadline coming up soon and have two problems with it:

1 _Chaotic readings and I saw that using a capacitor might help. I will try that later today. Where exactly do I need to connect it? Since my Sharp has 2 ground/V ins, means I need 2 capacitors then, non?

2 _Looking for a formula to linearize the readings for that specific sensor. There's an explanation on the Acroname website, but my math skills are totally inappropriate to understand or even reproduce that....


Most grateful for any good advice! Cheers

Where exactly do I need to connect it?

Accross +ve and gnd at the sensor, just one cap.

but my math skills are totally inappropriate to understand

Why do you need to linearise it? You would only do this if you wanted to do some calculations on the distance and your maths is not up to it. I suspect you just want to trigger something if it is within a certain range, just do this with a constant built into the program.

As Grumpy Mike has said, you probably don't need to linearize your sensor. If you really want to, however, look at your sensor's datasheet:

The math is the kind of thing you would have learned in gradeschool, so if you're able to multiply and divide it shouldn't be beyond you. There are two plots in the datasheet: output voltage vs distance and output voltage vs 1/distance. You will note that the second plot is approximately linear, which means you can get a nice, simple relationship between output voltage and 1/distance (pick two datapoints from the graph and use them to come up with an equation for the where y is output voltage and x is 1/distance. Rearrange the equation so that distance is alone on the left side and you will have your equation for distance as a function of output voltage.

without actually performing the full calculation for you, here's the general way I'd go about it:

y = mx + b

compute m and b by using two datapoints from the line

rewrite this as:

V = m(1/L) + b, where V is output voltage and L is distance => (V - b) / m = 1 / L => L = m / (V - b)

If you know m and b, you can compute L for any voltage reading V.

  • Ben