Jeff Rowberg has written an excellent library for the MPU-6050. It encapsulates the basic functions and hides all the I2C traffic management. You can download the code directly from github. You’ll need the I2Cdev files and the MPU6050 stuff. Copy the files to Arduino’s workspace’s “libraries” directory (for example “My Documents\Arduino\libraries\“) under directories I2Cdev and MPU6050. If the “libraries” directory doesn’t exist, you need to create it.
Basically there are two ways to use the MPU-6050 with this library: 1) Include the “MPU6050.h” header for all the basic functionality that is also documented by the official Register map or 2) instead include the “MPU6050_6Axis_MotionApps20.h” header to gain access to the reverse engineered DMP (Digital Motion Processor) functionality.
The library’s code is documented in a way from which you can generate a nice HTML documentation using Doxygen. It looks a lot like JavaDoc. (The Doxygen installer puts the Doxygen user’s guide in HTML-format into program’s folder. For example in my case the folder “file:///C:/Program%20Files/doxygen/html/doxygen_usage.html“) In short: To create documentation from the code you’ll need to type two commands from the command line: “doxygen -g configFile” and “doxygen configFile” (replace configFile by name of choice).
That, or you might just look at the readily available MPU-6050.h documentation online.
I think the best (and only) way to explore the DMP-functionality is to examine the Teapot demo. Just upload the example code to an Arduino. When connecting the MPU-6050 to an Arduino, remember also to connect the interrupt signal (INT pin on the MPU-6050 to Arduino Diecimila or UNO’s digital pin 2) as the MPU-6050 with DMP is set up to fire interrupts whenever it has data ready.
To visualize the Teapot on the PC, you’ll need to have Processing installed and copy an additional toxiclibs library into Processing’s workspace’s libraries folder (much like you had to add the MPU’s libaries to the Arduino IDE’s libraries folder). If the folder “Processing\libraries” doesn’t exist, you’ll have to create it. Then save the Teapot demo “MPUTeapot.pde” under “Processing\MPUTeapot” (or the Processing IDE will later ask you to move the file to this directory).
I made a few changes to the MPUTeapot demo as it – in my opinion – didn’t properly catch the data packages sent by the Arduino..
InvenSense also has an official Teapot demo. I tried to run it, but it seems I’m missing a winusb.dll and didn’t really bother to investigate further. It should work though – I’ve seen it on youtube🙂