Home » Flight control » MPU9250


The MPU9250 is a inertia measurement (IMU) system. It represents a gyroscope and a accelerator sensor on ne chip. In the same chip package there is a magnetometer integrated as well.

The number of sensor inputs in an IMU are referred to as “Degrees of Freedom” (DOF). So a chip with a 3-axis gyroscope and a 3-axis accelerometer would be a 6-DOF IMU. With additional 3-axis magnetometer you get a 9-DOF IMU. Often a pressure sensor on the same sensor pc board system is adding, as an additional “Freedom”, the altitude measurement to the entire measuring system, so some people call this a 10-DOF system.

An accelerometer measures the g forces detected on the sensor chip. In a horizontal steady state position on the z-axis measures the earth gravity of -g. The x and y axis do not measure any g force so the output is (ideally) zero. You start tilting the sensor and the g vectors x, y and z components do get measured. Nice. But you can not fly with this sensor alone. First of all the sensor is very sensitive to all kind of vibrations and you will never get a steady stable signal well enough that you could use as reference. Then in the air you do not have the earths gravitation force g alone as a force on the sensor. You do have centrifugal forces as well that result in measurements not representing the Euler angles alone.

A gyroscope on the other hand measures the change-rate of the motion (Euler angle). No matter how the sensor is positioned, as long as the position does not change, the output is zero. The gyro measures the derivative of time  of an angle (d_angle/d_time). Now by integration over time of (d_angle/d_time) you do get the desired angle values. Lets say you flip the sensor 90º to one side and then back again you would first integrate the output up to 90 and then back to zero. However since in a practical microcontroller application you do the integration in time discrete samples the integration is not performed perfectly but with a small error. If you perform this flip example several time in a row you will find, that the sensor shows after the procedure not zero degrees as it should but shows a small error of a few degrees. This error increases over time. The sensor values do drift over time. You can not fly with this sensor as well.

Both sensors, the accelerator and the gyro have benefits and drawbacks. The combination however would be great, because the accelerator always shows the correct angles without drift and the gyro sensor is immune to vibration and additional in flight force vectors. What you have to make sure is, that you only use the low frequency signal part of the accelerometer and only the high frequency part of the gyro sensor.

This can be done by use of a complementary filter (easy to calculate, low CPU load) or a Kalman filter (more complex to calculate, more CPU load). Also Madgwick and Mahony are two sensor fusion algorithm often used (calculates quaternions, three dimensional angle representation as complex numbers).