If we are hiring someone such as a carpenter or an auto mechanic, we always look for two things: what kind of tools they have and what they do when things go wrong. For many types of embedded systems, one important tool that serious developers use is the Kalman filter. It is also something you use when things go “wrong.” [Carcano] recently posted a tutorial on Kalman filter equations that tries to demystify the topic. His example — a case of things going wrong — is when you have a robot that knows how far it is supposed to move and also has GPS coordinates of its positions. Since the positions probably don’t agree, you can consider that a problem with the system.

The obvious answer is to average the two positions. That’s fine if the error is small. But a Kalman filter is much more robust in more situations. [Carcano] does a good job of taking you through the math, but we will warn you it is plenty of math. If you don’t know what a Gaussian distribution is or the word covariance makes you think of sailboats, you are going to have to do some reading to get through the post.

Perhaps the most fun implementation we’ve ever seen is [Richard’s] interactive Kalman filter simulation. You can set all the parameters (including random noise) and the web page will predict where your mouse cursor is as you move it. The purple dots are noisy input and the green dots are where the page thinks your mouse is. Or if you prefer videos, there is a series of seven videos from MATLAB about Kalman filters and you can see the first one, below.

This isn’t the first time we’ve looked at a walkthrough of the equations, but it has been awhile. Kalman filters show up in surprising places, like this camera autofocus mechanism.