# Math Help - finding distance traveled from accelerometer readings

1. ## finding distance traveled from accelerometer readings

Hi There,

I would appreciate any suggestions you have..

I've got a sparkfun serial tri-axis accelerometer
SparkFun Electronics - Serial Accelerometer Tri-Axis v5 - Dongle

I would like to look at only the x axis data and over a given timeframe find the distance traveled from the accelerometery data.

It outputs..
X=-0.983 Y=1.227 Z=-0.007
X=-0.987 Y=1.223 Z=-0.013
...
at an adjustable 250x per second

These units are in g's, 1g = 9.8m/s^2

What method can I use to take these readings as they come in and at the end of the time period have single number for the distance traveled (m)?

Any ideas most welcome. Thanks

2. Well what you have are a periodic string of acceleration readings from the device between (0-590 Hz), so by recording the values over a period of time, you are essentially plotting an acceleration-time graph, for the x direction.

So what you need your software to do iis start recording data at a specified time $t_a$, and finish recording at another specified time $t_b$. Then to get back to the distance travelled, you need to integrate twice between $t_a$ and $t_b$.

Numerical integration is what pops to mind, (which would be very staightforward, knowing your fequency, and each of your acceleration values) but you'd need to integrate twice, so I'm not too sure there is a method for this.

All I can think is to somehow interpolate the points as a function $A(t)$ (which I can see being difficult), and then calculate $\int_{a}^{b}\int A(t) dt^2$.

Maybe someone else knows of some better methods. (You might do well to ask about it on a programming forum)