velocity calculated from accelerometer

Electronics Computer Programming Q&A
Post Reply
Posts: 5
Joined: Tue May 19, 2009 1:32 pm

velocity calculated from accelerometer

Post by brandonl » Tue Oct 27, 2009 7:04 pm

I have a three axis accelerometer that has a digital output (spi,i2c). I would like to calculate velocity along the z axis based on the readings using an 8 bit PIC and display it. To calculate the velocity I believe you would integrate the acceleration. It has been years since i have done calculus, and I'm at a loss how I would implement this. Also would be interested if any digital filtering would be required due to small movement on the other axis.

Thanks for any help

User avatar
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey

Re: velocity calculated from accelerometer

Post by MrAl » Thu Oct 29, 2009 7:02 am

Hi there,

I think this is usually done by doing something like this:

V is the currently computed velocity and
V(0) is the velocity calculated previously (and V(0)=0 at t=0) and
a is the acceleration and
dt is the time duration between samples.

In a sampled system this would look something like this:
might be the more suitable form.
You could work in whatever dimensions are the most convenient.

Working in three dimensions as you seem to need, you would have to calculate
the above for all three directions and then calculate the 3d vector to get the
final results.

I cant say too much about the accuracy of these kinds of techniques however,
as many things come into question like the basic accuracy of the sensor, the
basic resolution of the sensor, the error accumulations, stuff like that.
In control electronics (this isnt exactly that though) this would be a definite no-no,
as any little thing missed over and over again could accumulate to a huge error.
If that was a voltage regulator for example, the output would be anything but
regulated, with an almost unpredictable output.
You might include some kind of calibration phase into the algorithm too.
LEDs vs Bulbs, LEDs are winning.

User avatar
Posts: 1695
Joined: Sat Nov 08, 2003 1:01 am
Location: Phoenixville, PA USA

Re: velocity calculated from accelerometer

Post by CeaSaR » Thu Oct 29, 2009 7:37 am

If you can find the article(s) on the Balance Bot, you'll find code, possibly downloadable,
that will show you how to do what you want.

Hey, what do I know?

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests