Electronic – Acceleration when device is on tilt

accelerometergyroscopemagnetometermathphysics

I'm currently working on device that uses always-on 3D accelerometer(using scale +-2g) and 3D gyroscope(using scale +-250g) -sensor.

I can read every possible vector (X,Y,Z) and their acceleration (g's) and angular rate (dps) and also the angle where the device currently is. But my problem is that when the device is on tilt (0g when no tilt) the acceleration is between (downward) 0g->-1g or between (upwards) 0g-> 1g depending on what angle the device currently is. Below is picture that hopefully clears the idea.

Hopefully this helps

The device will located in a car and should measure acceleration when car is slowing down (brake) . However if the device is already on tilt the accelerometer will measure some acceleration that tilt causes which makes it hard to tell if the device has truly some acceleration or is it just the tilt that causing the acceleration.

X and Y -Axis produce 0g and the Z axis is 1g when device has no tilt and is on flat surface. The tilt causes the reading of X axis to go towards 1g if tilting is towards up and to -1g when downwards. The +-1g is reached when the device is on 90* degree from original position

I have been thinking my head off how to eliminate that acceleration that tilt causes and only measure the real acceleration of the device but just can't think way out from this problem with the following data that i can produce.

Basically i think that if i could only measure the X axis acceleration (picture) even if the sensor is in tilt like in picture.

Hopefully this message isn't too hard too understand because of my english skills and the way I'm trying to explain my problem.

Best Answer

Only a sketch of a solution.

Take all 3 axes into consideration.

Acceleration due to gravity, regardless of tilt, will always be 1G, as a vector sum of X,Y,Z, no matter what the tilt. You can picture the acceleration at rest or steady motion as a point on a sphere with radius 1G. (If you are perfectly horizontal, that point will be (0, 0, -1) i.e. directly below you).

Acceleration due to braking will distort the sphere itself; the vector sum of X,Y,Z will no longer be 1G.

So

$$A = \sqrt{X^2 + Y^2 + Z^2}$$

gives you the total acceleration. If it equals G you are at rest; otherwise you are accelerating, and \$A\$ is the vector sum of G and the true acceleration.

You now have to find the true acceleration which will normally be a vector in the forward (or rearward) direction which explains the difference between \$A\$ and G. You need to subtract some point on the G sphere from \$A\$, to find a (hopefully unique solution) vector with only an X (forward/backward) component. That is your acceleration. (I'll leave the trigonometry as a simple puzzle, hopefully the idea is clear).

Unless you are also turning or skidding, so you need inputs from steering wheel and ABS to be sure; that becomes a data fusion problem. This approach will provide an estimate of acceleration. To sanity-check and refine that estimate, combine it with other (also unreliable) data sources, as in Phil Frost's answer, using a Kalman filter.