This past school vacation, I both went to Martha’s Vineyard, and slaved away at getting the dmp of the Mpu6050 to work. Since this blog is about rockets and not my trips, I’ll only talk about the Mpu.

As mentioned in a previous post, I had previously been using Jeff Rowburg’s i2c device library. While it was great to use as a starting point, it had a couple of flaws that were inhibiting in it’s use. The first of all and biggest was that all the information and code in the library that used the dmp on the Mpu6050 was gotten by using a logic sniffer. They used the program that invensense gives it’s developers and reverse engineered the protocols. It works ok, but it doesn’t tell you what anything is for, and only implements some of the possible functionality of the dmp.  I was determined to find something better.

I asked my dad, and he told me that the quadrocopter code used the full functionality of the dmp. After downloading that code and searching through, I found that they were in fact using far more functions than I had previously known about.

After searching some more, I noticed something strange: at the top of the code where the dmp functions are defined, it said “copyright Invensense 2013.” This code was written by the people at DiyDrones. Was it possible that invensense gave them something they hadn’t given the general public. It turns out that they hadn’t. The name of the place where that particular code was stored was called the MotionDriver library.  I remembered that I had seen that name before. After going onto the Invensense downloads page, I found that they had something called the MotionDriver 5.1 I downloaded it and found the same code that was in the Ardupilot code.

Now that I had a library of functions, all I needed was to find someone that had implemented them for arduino. On the Sparkfun product page for the mpu9150, I found a guy saying that he would release a working arduino solution that used the full power of the dmp, and that did some pretty advanced things with magnetometer integration. Since that post was six months old, I went to check out If he had in fact released it. It turned out that he had, another lucky find for my project.  The place to find the solution was on the Pansenti Blog. It was exactly what I was looking for.

Their code has functions that do everything that we would ever need to do, including full control of the DMP, and code for integrating the values from the magnetometer into the output values. They also have a couple of functions dedicated to calibrating all the sensors. All in all, it was a great find.

There is only one problem with it. It is either meant to work on the MPU9150,9250, or the MPU6050 with a certain magnetometer on the auxiliary bus (In fact, that is exactly what the 9150 is.) That means that I’ll have to convert the magnetometers part of the code to work with the HMC5883L magnetometer.  That could either be extremely easy or insanely difficult.  When I have the time to do that, I’ll update on my progress.

Until next time, Max Tepermeister

About these ads