Acceleration to Displacement

  1. Does any one know of a simple algorithm for converting a time based series of accelerations from a single axis accelerometer to displacement?


    I understand that double integration is the way forward ... but what am I double integrating? and how can I do this say in Excel or Visual Basic ?

    The accelerometer is recording motion of a wave bouy and all I need is a mean displacement.


    Drift of the result is not so much of an issue.
     
  2. jcsd
  3. russ_watters

    Staff: Mentor

    Just apply s=at, and d=st in separate columns in excel.
     
  4. George Jones

    George Jones 6,384
    Staff Emeritus
    Science Advisor
    Gold Member

    You need to use a routine for numerical integration, like the the trapezoid rule or Simpson's rule.

    You also need to know the initial speed of the buoy (zero?).

    These don't work that well in this case, because neither speed nor acceleration are constant. Also, a sum (of rectangles) has to be taken, and the t is the time interval between readings, not the time of the readings.
     
    Last edited: Jun 7, 2006
  5. Gokul43201

    Gokul43201 11,141
    Staff Emeritus
    Science Advisor
    Gold Member

    George, if suitably modified, Russ' approach will work. Given accelerations and an initial velocity, you generate a column of velocities, [itex]v_n = v_{n-1} + a_n(t_n-t_{n-1})[/itex], with vo given. If the time intervals are all equal, you can simply repeat this procedure to generate displacements. If they are not, you generate new time intervals (that are connected) whose median values are the original set of times and proceed as above.

    This, I imagine, will get you the same result as a trapezoidal summation.
     
    Last edited: Jun 7, 2006
  6. George Jones

    George Jones 6,384
    Staff Emeritus
    Science Advisor
    Gold Member

    Yes, I wasn't mathematically explicit, but this is what I meant by

    Your iterated formula treats the acceleration as constant over each each time interval, and thus finds velocity as an area inder the acceleration-time graph by summing a bunch of rectangles, each having acceleration as height, and a time interval as width.

    Yes, this will work, but it would be more accurate to do as much as possible analytically first.

    For example, for example, consider the rectangle rule and one time interval, so a is constant over the time interval, i.e., something like the following. I haven't been particularly careful, so I might have screwed it up a bit

    Integrate:

    [tex]v_{n} = v_{n-1} + a_{n-1}(t_n - t_{n-1}).[/tex]

    Integrate again:

    [tex]x_{n} = x_{n-1} + v_{n-1}(t_n - t_{n-1}) + \frac{1}{2} a_{n-1} (t_n - t_{n-1})^2.[/tex]

    Of course, this just results in the standard constant acceleration formulae.

    A third integration is necessary to calculate the mean, but, if equal time intervals are used, I guess a good approximation would be just to take a mean as finite sum.
     
    Last edited: Jun 7, 2006
  7. Thank you all

    Hey ... If only i'd given it a little thought.



    Thank you all !
     
  8. russ_watters

    Staff: Mentor

    My approach is a numerical integration approach using Excel, but I was in a hurry and didn't elaborate. Let me elaborate now:

    The colums are iteration, time, acceleration, speed, and distance.

    Iteration, time, and acceleration are provided by the accelerometer - probably already in spreadsheet form (or iteration is just row number in Excel). Speed takes the time interval (actually 'dt' - I didn't specify that) times the acceleration, plus the previous speed. Distance is calculated the same way.

    Caveat - I'm not sure if this works with a mixture of positive and negative acceleration. I think it would.

    I'm so lazy when it comes to math, I rarely solve an equation that can easily be numerically integrated with Excel.
     
    Last edited: Jun 7, 2006
  9. As you suggested this approach sort of works, as does simpsons (using 5,8,-1 rule)

    But does not seem to handle negative acceleration well.

    I tried a simple dataset ( moving the accelerometer vertically over a known distance)

    and all of the proposals seem to work for +ve accelerations but as the accelerometer slows, -ve accelerations appear as could be expected, summing the integrated velocity results in excell itteratively the velocity rapidly becomes negative. I know this is not the case as the accelerometer only had positive displacemnt and therefore positive velocity.

    any suggestions as to where to look ???
     
  10. George Jones

    George Jones 6,384
    Staff Emeritus
    Science Advisor
    Gold Member

    These routines shouldn't have problems handling negative acceleration.

    If you haven't already done so, you should use Excel to plot the acceleration data versus time. Just by eyeballing this plot, you might be able to tell whether the cumulative area under the graph becomes negative.

    How big is your "simple dataset?"

    If you want, I could have a look at the test data, but I might not be able to take a serious look until Friday.
     
  11. Hi i quickly read over this post that was made a long time ago I saw the formula for to calc the acceleration to displacement :


    Integrate:

    [tex]v_{n} = v_{n-1} + a_{n-1}(t_n - t_{n-1}).[/tex]

    Integrate again:

    [tex]x_{n} = x_{n-1} + v_{n-1}(t_n - t_{n-1}) + \frac{1}{2} a_{n-1} (t_n - t_{n-1})^2.[/tex]



    I did some acceleration collection on a person walking 20 meters down a hall and in the graph attachement the displacement and velocities looks weird. I sampled the acceleration data 2khz and it's in G-forces. the person is walking about 1-2 hz. Does this calc work for my acceleration data values?

    Thanks!
     

    Attached Files:

  12. Hi all

    I'm glad I came across this thread as I have a similar problem.

    I am trying to get a sensible graph of velocity and displacement out of a force time graph of the forces applied to a force plate while walking. I've used integration methods, which are the same as those mentioned above but they don't return a graph that means anything intuitively.
    The graph needs to reflect the change in velocity and displacement of the body's Centre of Mass relative to the ground. The absolute velocity is not required and at present I dont have a starting velocity. It is neccesary to see the velocity and the direction of displacement relative to the ground. I think the problem is that at initial foot contact (start) the CoM velocity is toward the ground and slowing down as the force / acceleration increases then at the propulsive stage the velocity is away from the ground as the acceleration increases. I can't work out how to change the signs to accomodate this. Anyone like to help?

    Cheers Dave Smith
     

    Attached Files:

    Last edited: Jan 14, 2010
  13. Wow, you really: do not want to use the formulas mentioned in this thread. Integrations of accelerations are susceptible to drift and notoriously horrible because you are integrating noise.

    There is away to do this by fusing the sensor data with periodic measurements from other sources. I forgot the name of this thing......I'll post it when I remember.
     
  14. Double integration of raw acceleration data is a pretty poor estimate for displacement. The reason is that at each integration, you are compounding the noise in the data.

    If you are dead set on working in the time-domain, the best results come from the following steps.
    1. Remove the mean from your sample (now have zero-mean sample)
    2. Integrate once to get velocity using some rule (trapezoidal, etc.)
    3. Remove the mean from the velocity
    4. Integrate again to get displacement.
    5. Remove the mean. Note, if you plot this, you will see drift over time.
    6. To eliminate (some to most) of the drift (trend), use a least squares fit (high degree depending on data) to determine polynomial coefficients.
    7. Remove the least squares polynomial function from your data.

    A much better way to get displacement from acceleration data is to work in the frequency domain. To do this, follow these steps...

    1. Remove the mean from the accel. data
    2. Take the Fourier transform (FFT) of the accel. data.
    3. Convert the transformed accel. data to displacement data by dividing each element by -omega^2, where omega is the frequency band.
    4. Now take the inverse FFT to get back to the time-domain and scale your result.

    This will give you a much better estimate of displacement. Hope this helps..
     
  15. I'm looking for suggestions how to convert acceleration into frequency?
    We attached 2 3-axis accelerometers to 20ft. tower to monitor vibrations,however output in fractions of g.How can I get Hz values?
    I attached a file- first column is seconds of measuring,next 3 are original data from DAQ, next 3 I multiplied by g(9.8m/s2) and last 3 I offset to plot a graph.
    Do you also have an idea why is acceleration keep increasing?
    thanks
     

    Attached Files:

  16. Interesting, nice advice!
     
  17. Look up discrete FFT (Fast Fourier Transform). There are algorithms out there in most languages and even books called Numerical Recipes that will give you FFT algorithms. As for the increasing function...it's called "drift". Try looking for "accelerometer drift" in google.
     
  18. ...and one more thing. If anyone is wondering where the -omega^2 is coming from, try taking the analytical second derivative of a simple sine wave, say "sin(wt+phi)" and see what you get....interesting, huh?

    f(t) = A.sin(wt+phi)
    f'(t) = -Aw.cos(wt+phi)
    f''(t) = -Aw^2.sin(wt+phi)
     
  19. Actually, I was wondering. Thanks for this post. :wink:

    I found out the name I was looking for earlier: complimentary filter.
     
  20. Good point. Estimation filters also will help your results. Look up Kalman filters in particular. (EKF, UKF, etc.) Thanks for the reminder.
     
  21. very interesting method...using FFT. We've been using the standard double integration with nominally good results (using filters, , removing bias, etc), but would like to try the FFT approach. FYI, we are looking at (very low velocity/energy) impacts on previously damaged composites (honeycomb sandwich and solid laminates), where we know the velocity just before impact, with the end result measuring contact stiffness and impact energy loss to characterize the pre-existing damage.

    How would the process steps listed change if there is an initial velocity?
     
Know someone interested in this topic? Share a link to this question via email, Google+, Twitter, or Facebook

Have something to add?