I have an accelerometer connected to an Arduino Uno board, is there a way I can detect the distance it this accelerometer moved on each of the 3 axis?
This is normally referred to as Dead Reckoning. The processes of determining position using known values, such as acceleration.
Similarly, position is the integral of velocity with respect to time:
Here is an explanation that should tie this all together. However, it appears this explanation goes in the reverse order. That is using derivatives of position to find velocity. And derivatives of velocity to find acceleration. Simply put, finding a derivative is the opposite process of finding an integral.
A final note, this all works well on paper. In reality Dead Reckoning based only on acceleration does not work very well. For instance, I believe most vehicle GPS systems tend to use steering and speed if Dead Reckoning is to be used for guidance.
Found this web site where someone talks specifically about Dead Reckoning using an Arduino. He is simply using the deltas of filtered acceleration readings:
velocity(i) = velocity(i-1) + acceleration (i) position(i) = position (i-1) + velocity (i)
But goes on to say accumulated errors causes drift and positioning errors.
Think about it:
- Accelerometers measure acceleration.
- Acceleration is a change in speed.
- Distance travelled is speed multiplied by time.
If you know the starting speed (e.g., stationary) and you know how much you have accelerated between two points in time you can calculate the average speed for that time period - and since you know the time of that time period (one would hope) then you can get an approximation of the distance travelled in that axis.
I say approximation, because you are working with finite time points (quanta) and only looking at the acceleration at those points in time. It's far from perfect, but it can give you a rough ballpark figure. The smaller your quanta the better your accuracy - but it will never be anything more than a guestimation at best.
Now it's just, as they say, a SMOP.