4
\$\begingroup\$

I am using a Freescale 3 axis accelerometer to build a model that flies and would like to log and calculate angles during a flight. My model can both hover and move up to 40kph as well as rotate on any axis 360 degrees. I have done some basic calculations on angles using raw data sent back but the data looks kind of weird with spikes.Right now I am just using Excel to do the calculations until I get the formulas correct for the software I'm developing. I am using: X-data = column B Y-data = column C Z-data = column D pitch = ATAN(B3/SQRT(C3^2+D3^2)) roll = ATAN(C3/SQRT(B3^2+D3^2)) theta = ATAN(SQRT(B3^2+C3^2)/D3)

The questions I have are: Is there a way to calculate speed from the data? Can I filter out the spikes using some sort of software filtering without skewing the data?

Thanks,

JB

\$\endgroup\$
  • 1
    \$\begingroup\$ How big are your spikes relative to your "signal". I would look into what is causing the spikes before you go trying to remove them. There is a possibility that in flight you actually have bumps. It is also possible that you have a programming error. Or even a hardware error. If you rule out all of those option, then a low pass filter can be used. \$\endgroup\$ – Kellenjb Jul 4 '10 at 21:35
  • \$\begingroup\$ Don't have any idea what's causing the spikes. I've tried different methods of moving the board in a lab environment to minimize vibration and still see the spikes so it appears to be an inherent anomaly. I guess my solution is going to have to be a filtering algorithm of some sort. Thanks for the response! Joe B \$\endgroup\$ – Joe Banko Jul 6 '10 at 16:48
4
\$\begingroup\$

In general, you can integrate acceleration data to obtain rates, and further integrate rates to get position/attitude information. This is known as dead-reckoning.

The model you described has what's known as 6 degrees of freedom. The six degrees are three translational: the north-south axis, east-west axis, up-down axis, and three angular: roll, pitch, and heading (and/or yaw).

Translational accelerations will show up directly as changes in one or more of the three channels. You can get angular orientation by isolating out the 'bias' acceleration due to gravity.

As for noisy spikes in the data, the easiest approach is to run a low-pass filter (LPF) of some kind on the data. This can be done in software with a moving-window time average of the last N samples. You have to be aware though, that since your speed and position data is an integration of the raw data, that any errors also get integrated. In other words, your sensor-based estimate of the vehicle's position, speed, orientation all become less accurate as time goes on, so the better you can remove the noise, the better your navigational solution will be.

\$\endgroup\$
  • \$\begingroup\$ Thanks JustJeff. I have a general idea of what you're talking about but am a little confused by "bias" acceleration. Is there any site you could suggest to get me a little less confused? Thanks, Joe B \$\endgroup\$ – Joe Banko Jul 6 '10 at 16:51
  • \$\begingroup\$ most of these accelerometers detect not only the obvious acceleration caused by visibly moving the sensor, but also the acceleration due to gravity. If you keep the sensor in a fixed position, with one axis exactly vertical, this will show up as a constant value on the vertical axis. In different orientations, the value due to gravity will map to each axis by the cosine of the angle of that axis with respect to vertical. \$\endgroup\$ – JustJeff Jul 6 '10 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy