Search code examples
androidsmoothinglowpass-filter

How to determine ALPHA, smoothing constant, of a Lowpass Filter


There are a number of posts about Android sensor data being very noise, and suggestions on implementing a smoothing algorithm such as low-pass filter. I am reading low-pass filter and I found that I have to calculate the smoothing parameter ALPHA. Everyone comes with different ALPHA. However, I am so confused because there is not consistent between wiki and Android developer website.

Two formulas will produce two different ALPHA. This make me so confused. Which formula is correct? Everyone could give me the explanation?

Thank in advance.


Solution

  • A lowpass filter is supposed to let in low frequencies and elimiate high frequencies. So the wikipedia version looks right to me- for a low frequency, dT should be big, for a high frequency it should be small.

    However, I'd really suggest either hiring someone who knows DSP or doing some more research before blindly implementing a filter. These things are quite complex and a simple filter will often have negative side effects. You spend a year or so studying these if you become an electrical engineer. Odds of getting it right the first time on your own are fairly low, unless you use a library. And then the risk changes to using the wrong type of filter or configuring the constants wrong.

    The filters shown by Wikipedia are about the simplest possible and have the most side effects, FYI.