The Kalman Filter Exposed

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.

Continue reading “The Kalman Filter Exposed”

An External Autofocus For DSLRs

Most modern DSLR cameras support shooting full HD video, which makes them a great cheap option for video production. However, if you’ve ever used a DSLR for video, you’ve probably ran into some limitations, including sluggish autofocus.

Sensopoda tackles this issue by adding an external autofocus to your DSLR. With the camera in manual focus mode, the device drives the focus ring on the lens. This allows for custom focus control code to be implemented on an external controller.

To focus on an object, the distance needs to be known. Sensopoda uses the HRLV-MaxSonar-EZ ultrasonic sensor for this task. An Arduino runs a control loop that implements a Kalman filter to smooth out the input. This is then used to control a stepper motor which is attached to the focus ring.

The design is interesting because it is rather universal; it can be adapted to run on pretty much any DSLR. The full writeup (PDF) gives all the details on the build.

Kalman Filter Keeps Your Bot Balanced

If you’re looking to improve the stability of your self balancing robot you might use a simple horrifying equation like this one. It’s part of the journey [Lauszus] took when developing a sensor filtering algorithm for his balancing robot. He’s not breaking ground on new mathematical ideas, but trying to make it a bit easier for the next guy to use a Kalman filter. It’s one method of suppressing noise and averaging data from the sensors commonly used in robotic applications.

His robot uses a gyroscope and accelerometer to keep itself upright on just two wheels. The combination of these sensors presents an interesting problem in that accelerometer input is most accurate when sampled over longer periods, and a gyroscope is the opposite. This filter takes those quirks into account, while also factoring out sensor noise. Despite the daunting diagram above, [Lauszus] did a pretty go job of breaking down the larger function and showing us where to get the data and how to use it in microcontroller code.