# Acceleration compensation (3 Axis accelerometer)

1. Jan 16, 2014

### mitchjp

Hi all,

I am currently working on a project and have a problem. I am using a 3 axis accelerometer and attempting to measure distance with it. (Yes, I know, the double integration of doom..)

My problem is not with the integration so to speak but is just with some compensations.

The accelerometer will be mounted so that the x axis is always pointing in the direction of motion. The y and z axis will be subject to angle changes up to about 20 degrees. Similar to mounting in on top of a car. (X is forward, Y is side to side, Z is up and down).

Obviously if the car was driving up a hill the acceleration you read in the x will be different as there is now a gravity component involved. I can calculate this using the Z axis to find the tilt angle and then some trig to remove the gravity component from the x axis.

But if the car was driving on a cambered road up a hill, then the y axis will have a gravity component, as will the x and the z axis will be some amount with its angle being a combination of the two. This is what I am having trouble with.

How can I decide which part of the z axis accel is caused from the y axis tilt, and which is from the x axis?

An example:

Car going up a hill on 10 degree slope. No camber in the road.

Z axis now shows an 80 degree angle, and the acceleration in the x direction will just be whatever it is measured and then minus/plus(depending on the sensors config) the sin(10 degrees).

This is working in g's then multiply through to get to m/s/s.

Now if you add cambered road, the z will show the y tilt and the x tilt and I can't work out how to do it.

Any ideas?

And yes I am aware tracking distance with accelerometer is frowned upon, but it is most likely just going to be used for short intervals between gps locks.

Also, is there an easy matlab function for integrating the acceleration in 3 axes with respect to time?

Thanks

2. Jan 16, 2014

### voko

There is no simple solution to this problem. Your integrator must know the orientation of the sensor with respect to the local field of gravity. A single accelerometer cannot do that unambiguously. To see that, imagine the car is in free fall. The sensor will register zero in all directions.

3. Jan 16, 2014

### mitchjp

Thanks for the reply. I do understand this.

However, as mentioned this is just an interim measurement. So we can assume that I will know the starting velocity.

For now I am testing on a skateboard-like thing, so I can say that initially there is no movement and distance is zero.

4. Jan 16, 2014

### voko

Even if you know the velocity, you still cannot detect rotation about the axis parallel to velocity. As far as I can see, you need an additional input for that. Don't you have a gyroscope in your setup?

5. Jan 16, 2014

### mitchjp

I can add a gyroscope if needed. This whole thing was to eliminate using an optical shaft encoder in calculating distance. (Removing the shaft encoder reduces cost, vehicle installation etc etc). So if we had a gyro in there which was high enough spec to be useful it may end up costing a similar amount.

However, it is definitely possible to whack one on there.