Measuring Acceleration from 3-Axis w/ PIC Microcontroller

  • Thread starter Thread starter mx tommy
  • Start date Start date
  • Tags Tags
    Acceleration Axis
AI Thread Summary
The discussion focuses on measuring acceleration using a 3-axis accelerometer with a PIC microcontroller, specifically for a vehicle that may not be mounted level. The user seeks guidance on determining the sensor's tilt to accurately calculate forward acceleration and deceleration, as well as understanding how to differentiate between the two. They express confusion over the equations needed to compute distance traveled based on acceleration readings taken multiple times per second. Suggestions include implementing a calibration procedure for the accelerometer and using a running integration of acceleration to update velocity, while considering potential errors and noise in the measurements. The conversation highlights the complexity of accurately measuring acceleration and position in a dynamic environment.
mx tommy
Messages
7
Reaction score
0
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. :cry:

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 :confused:



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 relevant math :D

Thanks, Thomas
 
Physics news on Phys.org
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:
ok, maybe forget the whole trying to find position... how about just the raw acceleration value? (IE my first problem)
 
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.
 
I have recently been really interested in the derivation of Hamiltons Principle. On my research I found that with the term ##m \cdot \frac{d}{dt} (\frac{dr}{dt} \cdot \delta r) = 0## (1) one may derivate ##\delta \int (T - V) dt = 0## (2). The derivation itself I understood quiet good, but what I don't understand is where the equation (1) came from, because in my research it was just given and not derived from anywhere. Does anybody know where (1) comes from or why from it the...
Back
Top