santobedi - 5 months ago 121

iOS Question

I am trying to get smooth rssi value from Bluetooth low energy beacons deployed at ceiling of my lab. I used Weighted-mean filter and moving average filter but couldn't get good result. Through various journal papers I got to know that Kalman filter can be used for this purpose. But I couldn't get a proper mathematical equation to code with objective-c. Can somebody provide any hint regarding mathematical equation or Kalman filter implementation?Thanks a lot.

Answer

A one-dimensional case like this means that all of the matrices are actually just scalar values. You need to know two things:

`R`

, the measurement variance. You can directly measure this by recording a series of RSSI values (in a fixed location) exactly how you would normally and then measuring their variance. You can do this easily with Excel, or python, or even write your own code from scratch.`Q`

, the process variance. This is how much you expect RSSI to actually change in the same amount of time (between measurements). You can also measure this, or you can reason about it.

If you look at the Kalman Filter equations you'll notice that `P`

is not dependent on your actual measurements, only the two values above. As a result, since they are constant, `P`

will converge to a fixed value. And since `K`

(the Kalman gain) only relies on those values, it will also converge. For an application like yours, it is usually sufficient to find the steady-state `K`

and use it all the time.

This is now just a complicated (but optimal in a least-squares sense) way of creating a simple moving average filter.