How to/Should I implement a Kalman filter to get accurate Accelerometer data?

Kersch picture Kersch · Mar 24, 2014 · Viewed 24.5k times · Source

I want to get as accurate data from the built in accelerometer in an Android phone as possible. I want to track two dimensional movement in x and y axis and even the small movements must be registered.

When I look at the data from the accelerometer / linear acceleration when the phone is flat on a table it changes a lot when i should be zero.

I have looked at Kalman filters, it seems like a good approach but I am having problems setting up a model.

1. Is a Kalman filter the way to go to get as accurate data as possible from an accelerometer?

2. Will a Kalman filter work? Maybe i have misunderstood but it seems like the acceleration or the velocity must be constant?

3. How do I set up the model for using Kalman filter? I'm having trouble understanding (among other things) what the process noise is?

Answer

Stochastically picture Stochastically · Mar 24, 2014

A Kalman filter applies when all measurements (of acceleration in this case) are equal to the true value plus a measurement error. The measurement error is the process noise. For for the original Kalman filter to apply the noise must be normally distributed, i.e. sometimes the error will be positive, sometimes negative, and on average zero.

If you jerk your android phone quickly back and forth, there'll be large accelerations. I'd suggest recording the accelerometer readings in that kind of action, and reviewing by eye to see whether it looks like there's the readings are indeed subject to some kind of normally distributed process noise. My guess is that the answer will be "No", i.e. I expect they readings when plotted on a graph will be smooth-ish. But if they're not smooth, a Kalman filter could be useful.

If you're trying to use accelerometer readings to work out location, I think your project is doomed to failure. Acceleration is the 2nd derivative of position with respect to time, and I've never heard of anyone being able to integrate the readings with sufficient accuracy to be at all useful.

I have applied a Kalman filter successfully to GPS readings on an Android phone to improve the location estimate. See Smooth GPS data for code that implements a Kalman filter for that. I subsequently wondered whether velocity and perhaps acceleration data could be used to improve the location estimate. Although I never followed up on that idea, see https://dsp.stackexchange.com/questions/8860/more-on-kalman-filter-for-position-and-velocity for the maths that I was considering using.

The optimal way of using all the sensor inputs (GPS, accelerometer, gyroscope, etc) to get a good estimate of location is a very hard (and interesting) problem. To find out more, the key phrase to search for is "Sensor fusion". On this subject, there's an old youtube video at http://www.youtube.com/watch?v=C7JQ7Rpwn2k .