# Measuring distance moved using an Accelerometer

#### eptheta

Dec 20, 2009
188
I was playing around with a mma7660m and I realized it was a 3 axis tilt-accelerometer. I actually wanted to measure distance traveled by the accelerometer within a certain time interval.
Now there are loads of accelerometers out there, but I really have no idea which I should pick/which is suitable for my needs.
I am also aware that I can use the raw acceleration data from my current model and perform some sort of a double integration and get the data I need, but that seems like a lot of work.

So could anyone please suggest an accelerometer that can be interfaced nicely (some common protocol like I2C would be nice) to a uC and that will provide a slightly more processed form of data that I could use to find the distance moved using?

Thanks !

#### Electrobrains

Jan 2, 2012
259
The circuit you already have seems to be a good choice, or not?
I did not read through the whole data sheet, but it has an I2C interface and a proportional output.

If you want to measure speed, or one step further, position, you sure need mathematics! You need to integrate and to add one (or two) constants. That's pure physics!
The speed is the integral of acceleration and the position is the integral of speed.
So to find the position, you must integrate twice, first the accelerometer data and then your own speed data.

Integration is not very difficult for a micro controller. You just need to make a lot of additions (of positive or negative values) with defined, small distances of time (sample rate).
The added constants are "speed when starting to measure" and "position when starting to measure".

Maybe you could find a circuit that makes those (simple) calculations for you, but you would still need to set the constants to get a valid result.

In the end you need to scale the result to get a useful output value (which is probably the most advanced part of the calculation).

EDIT: I looked a bit more carefully at the data sheet. The type you have (MMA7660), seems to be a bit old by now. Max. sample rate is 120 readings/s and the resolution only 6 bit (+/- 32 counts= +/- 1.5g).

A more modern circuit is for instance MMA8452. It's also low-cost, but can sample up to 800 times per second with a resolution of 12 bits= +/- 2048 counts = +/- 2g.
It looks really interesting (I think I will buy one myself and make some tests)!

Last edited:

#### eptheta

Dec 20, 2009
188
I see. This is going to be much harder since there are going to be at least 2 constants I have to worry about.
I guess I may as well buy the module and experiment a bit too...

#### Electrobrains

Jan 2, 2012
259
The constants are no big deal!
If you start at position "0" with speed "0", they are both zero.

#### BobK

Jan 5, 2010
7,682
The integration is not difficult ... if the device stays in the same orientation at all times. If it is rotated, I think it becomes quite a difficult problem.

edited: perhaps even impossible without using a gyro.

Bob

Last edited:

Replies
2
Views
591
Replies
19
Views
2K
Replies
6
Views
747
Replies
11
Views
1K
T
Replies
3
Views
762
B