**Sensors/MEMS??**

# What you need to know about sensor fusion

**Keywords:sensor fusion?
gyroscope?
micro-electro-mechanical systems?
MEMS?
Kalman filter?
**

Inside a drone, there are at least three tiny gyroscopes, set to measure any angular change along the orthogonal axes. All three of them are most likely contained within a single package that's the size of the tip of your pinky; this was made possible by the introduction of micro-electro-mechanical systems (MEMS) technology, which enabled the production of unbelievably tiny components thus reducing the size of the gyroscope. Why is it important, you ask? Quite simple: this is what allows us to keep the drone stable.

We can think of a naive model where we integrate each axis along the time domain, thus obtaining a single angle for each gyro. Knowing three orthogonal angles provides us with full three-dimensional orientation. Tracking this orientation can help us keep the drone stable by detecting when the orientation begins to change in an unwanted direction and fixing it by adjusting power distribution in the motors to get back to the orientation we want to maintain.

To summarise:

Assuming ? to be an orientation angle, ¦Ø_{?}, to be angular velocity around corresponding axis, and *t* to be time, in our simple model

therefore making our "tracking model" to be the good old motion equation

or in our case (since we deal with angles)

This model is very simplistic and does not account for second order effects. As one example of a serious problem that this model introduces, the gyro is not a precise instrument, so each and every sample we read from it contains a tiny error. The error is negligible in itself, but when something negligible gets integrated, bad things happen. Assuming the angular velocity remains constant over a small period of time, the equation now becomes:

In other (human) words, we integrate the error function *e(t) *or (simply put) accumulate the error over time! In this way, a small error becomes a big error and is responsible for a property of a gyro known as a "random walk."

To recap, a gyro can be a very precise mechanism over a short period of time, but becomes increasingly unreliable as time goes by. Some methods can be used to overcome this: one (which I will only mention briefly, because it deviates from our subject) may include using raw angular velocity without integrating it to simply try and keep the angular velocity at zero across all axes, thus ensuring a stable drone. Another (and more interesting) method involves compensating for the random walk periodically by introducing a secondary source of information¡ªone that is less precise but more stable over long periods of time, or (in other words) relies on sensor fusion.

Depending on the sophistication of the drone¡ªI'll pretend the boy in our story got his hands on a very serious piece of equipment for his amusement, so I hope you don't mind¡ªwe can easily think of at least two very stable sources of information which could be harnessed here. One is our good old friend gravity, measured in the form of a three-dimensional vector, and is a shiny arrow that always points downwards and has an approximate magnitude of 9.8m per second squared. The other is Earth's magnetic field, which (unlike gravity) tends to shift over time, but at such a slow speed that (for our purposes) we can consider it stationary; this second friend is essentially the red and blue arrow of a compass pointing to magnetic north. (To be fair, I would say that relying on a compass is fairly difficult, because of the sensitivity of the former to any sort of magnetic disturbance or presence of ferromagnetic substances.) Having one or both of these sources harnessed can give us a reference against which to reduce the accumulated error. The device which measures linear acceleration is known as an accelerometer. Our little drone will have three of those as well, one for each cartesian axis.

Related Articles | Editor's Choice |

Visit Asia Webinars to learn about the latest in technology and get practical design tips.