# 3 axis Acceleration

1. Jul 17, 2006

### mx tommy

Ok, Not sure which forum this would fall under, so if it's the wrong one feel free to move it.

I'm currently involved in a project that involved measuring acceleration from a 3 axis accelerometer using a PIC microcontroller. And I only have high school physics.

I have 2 problems I need help with...

I want to measure foward acceleration and decceleration (it's going to be mounted on a vehicle). If the sensor was mounted level, I could just read the value of the coressponding axis and be done, but the sensor will never be mounted that way. It will most likely be mounted tilted either forward or back a bit, possibly somewhat side to side, etc...

My sensors read -1.5 G's to +1.5G's, Z should always be positive as the sensor will always be mounted upright, X is positive when accelerating, and Y is side to side (though I'm not really interested in it, but I'm guessing it's needed to find the devices "tilt" or something)

So, from what little I understand, I need to find out the tilt of the sensor, by reading how strong gravity is on the Z-axis (less measured gravity = more degrees off axis) Then somehow use that and the information from the other 2 axis's (X and Y) to find out the total speed of accelration. I also need to know if it's acceleration or decceleration, IE I know decceleration is just acceleration in the opposite direction, but I need some value to "test" to to see which of the two it is... I mean if I just plug the X,Y, and Z values into an equation and get a value with no sense of direction, I don't know if it's acceleration or decceleration (If THAT makes sense :P )

Now, as to the actual equations to do any of this, I'm totaly lost after 5 hours of google

Second problem is this, once I have the "corrected" acceleration value, it's only for that one "point" in time... I'll be taking a reading about 100 times a second, and need some help trying to figure out how much distance is traveled. I found the equation

s = ut+1/2at^2

where
s = distance
u = initial velocity
a = acceleration
t = time

however, I'm not seeing how to use this (I guess you could say "repeatedly") because after the first one, the initial velocity would be other then 0, and I don't know how to get the "new" initial velocity

Basically, I need to measure the time it takes to travel 50 feet (or like 15m) with a highly variable acceleration rate (which will sometimes be deceleration as far as the sensor is conserned, because of bumps etc,)

Any help will be most appreciated :) even a link to a page with some relevent math :D

Thanks, Thomas

2. Jul 17, 2006

### Cyrus

If I recall correctly, I remember someone who had a program to try and back out the displacement by integrating the acceleration directly. The problem was that you need to do a lot of fancy filtering to get rid of noise and other associated problems if you want to get a half descent position estimate. You can try to integrate it directly, but I'm afraid you will get anwsers that are incorrect.

You're going to need a kalman filter, and that requires graduate level controls theory.

Last edited: Jul 17, 2006
3. Jul 18, 2006

### mx tommy

ok, maybe forget the whole trying to find position... how about just the raw acceleration value? (IE my first problem)

4. Jul 18, 2006

### Staff: Mentor

On the first problem, I'd recommend that you come up with a calibration procedure for each axis of the accelerometer in the vehicle. Do you have data aquisition capability from the speedometer or other velocity sensor? If tilts can be an issue, you need to store non-volatile calibration info in the PIC.

On the use of the equations, you will need to keep a running integration of the accelerations and the velocities. You will need to have an error budget, and you may need to make your integrations "leaky" with a small leak of the integration value to keep the value from pegging out due to accumulation of small errors. If you have access to speedometer information, you can use that to help you leak your straight-line velocity from the value the accelerometers give you back to the speedometer value over some time interval. The vertical and horizontal values should most likely leak back towards zero, unless your vehicle is a plane or something.