MPU-6050 Redux: DMP Data Fusion vs. Complementary Filter

MPU-6050 on GY521 breakout board.
MPU-6050 on GY521 breakout board.

I’ve been using the GY-521 IMU breakout board containing Invensense’s MPU-6050 IMU to compute orientation in my self-balancing scooter (the “Halfway”). I’d like to improve the scooter’s performance on hills and uneven surfaces.  I thought I’d revisit the fusion algorithm which combines gyroscope and accelerometer data to compute the scooter’s tilt angle.  The initial code for the Halfway used a complementary filter algorithm, explained in an earlier blog post.  Accelerometer data is noisy on short time scales, and gyroscope data drifts on longer timescales, so the complementary filter combines both for greater accuracy.  However, the MPU-6050 contains a digital motion processor (DMP) which can perform the data fusion on the IMU chip iteslf.

Read moreMPU-6050 Redux: DMP Data Fusion vs. Complementary Filter

MPU-6050: DMP Data from i2cdevlib

In March, I posted on experimenting with the MPU-6050 IMU chip (mounted in a GY-521 breakout board).  It seems that many people are using the MPU-6050, and I wanted to follow up with some more information, because there are better ways to access and process the combined sensor data than were demonstrated in that post.  The previous experiment compared the raw data from the 3-axis accelerometer and 3-axis gyroscope sensors to the results when the raw data are combined via a complementary filter.

For the comparison, I had adapted a program from the Arduino Playground Wiki on MPU-6050 to pull the raw accelerometer and gyroscope data from the MPU-6050,  The program calculated pitch, roll and yaw (rotation about the X, Y and Z axes, respectively, also knows as Euler Angles).  These calculations were limited by certain properties of both the accelerometer and gyroscope.  Gyroscope data has a tendency to drift with time, and accelerometer data is noisy and makes it difficult to calculate rotations over ranges greater than 180 degrees.

Read moreMPU-6050: DMP Data from i2cdevlib

Gyroscopes and Accelerometers on a Chip


The interior of a 3-D MEMS Gyroscope Sensor is intricate and tiny (the width of this structure is only about 800 micrometers).
The interior of a 3-D MEMS Gyroscope Sensor is intricate and tiny (this structure is only about 0.08 cm wide).

My last two blog entries discussed demonstrations of gyroscopes and angular momentum conservation at our school’s science fair. One of the demonstrations I put together takes a look at how really small gyroscopic sensors, such as those in many smart phones, video game remotes or quad-copters provide information about their changing orientations. This information can be used as feedback for self-balancing (e.g. a two-wheeled scooter), navigation or as input to other applications like video games.

I didn’t want to sacrifice my smart phone for this experiment. Fortunately, chips containing gyroscopic sensors are relatively cheap. In reading up on gyroscopic chips, I found that orientation data from gyroscope sensors is prone to drift significantly over time, so gyroscopic sensors are frequently combined with additional sensors, such as accelerometers or magnetometers to correct for this effect. This combination of sensors is frequently referred to as an IMU, or “Inertial Measurement Unit”, and it is used in  airplanes, spacecraft, GPS navigators (for use when GPS signals are unavailable) and other devices.  The number of of sensor inputs in an IMU are referred to as “DOF” (Degrees of Freedom), so a chip with a 3-axis gyroscope and a 3-axis accelerometer would be a 6-DOF IMU.

Read moreGyroscopes and Accelerometers on a Chip