# How to decompose raw acceleration signals into gravity and dynamic acceleration?

I have a data from $3$-axis $50$ Hz accelerometer, acceleration over each of $3$-axis: $acc_X,\ acc_y,\ acc_z$.

I want to decompose acceleration into gravity and movement components.

First question:

Should I introduce some notation of magnitude, for example $mag = \sqrt{acc_x^2 + acc_y^2 + acc_z^2}$ and then apply all transformations to the magnitude rather than component-wisely?

The second question is the decomposition itself.

One solution I've found is to apply lowpass Butterworth filter. However, I don't know how to interpret ButterWorth filter return values, namely numpy arrays $a$ and $b$, in terms of gravity and movement component.

So, how can I implement decomposition using the Butterworth filter?

• Does your platform rotate? Or is the z axis always pointing strictly down? Commented Jun 21, 2018 at 17:11
• @Juancho the platform doesn't rotate. The z-axis is pointing strictly to the front. Commented Jun 21, 2018 at 17:15
• @FalsePromise: Could you please share: How did you solve your problem? Thank you! Commented May 7, 2020 at 19:54

Assuming the platform does not rotate, then the gravity component will always point in the same direction.

Let's say $acc_x = A_x + g$ assuming that the $x$ axis is pointing upward, and $A_x$ is the acceleration due to motion relative to Earth's surface in the vertical direction.

So it's just a matter of estimating $g$ and subtracting: $A_x = acc_x - g$.

To estimate $g$, if you can place your platform in a motionless state, then measure and average several (hundreds) samples.

If you can not set your platform in an motionless state, but you know that the platform will only vibrate and never drift away, then you can still estimate and cancel out $g$ during sampling, since $g$ will be the 0-frequency component of the acceleration.

You can use averaging (moving window) or, as you suggest, any low-pass filter (such as Butterworth). E.g. if your platform vibrates at frequencies greater than 10Hz, then design a filter with cut-off frequency of 1Hz. And discard the first 10 seconds of sampling as the filter output converges to $g$.

Make sure that the cut-off frequency of your filter is way below the smallest frequency of your motion, so that you don't filter out your signal.

You can use this method independently on the 3 axes, so you also cancel out any DC offset of your sensors, or any misalignment of your platform.