Arduino Uno and the InvenSense MPU6050 6DOF IMU

A while back I bought the InvenSense MPU-6050 sensor in a “GY-521” breakout board from eBay. For a long time it sat quietly in my box of “possibly cool things to check in the future”. Recently, I decided to finally get to building a self-balancing robot and dug it out. As with almost anything from eBay, it came with no documentation.The MPU-6050 breakout boards are quite popular in the Arduino community and information was  easy to find. Even too easy: it took me a while  to sift through many partial, or "almost" working implementations before I found a relatively easy to use, clean and reliable set of instructions and Arduino sample code. So here it is documented for future reference!

MPU-6050 Overview

According to the InvenSense MPU-6050 datasheet, this chip contains a 3-axis gyroscope and a 3-axis accelerometer. This makes it a “6 degrees of freedom inertial measurement unit” or 6DOF IMU, for short. Other features include a built in 16-bit analog to digital conversion on each channel and a proprietary Digital Motion Processor™ (DMP) unit. (more…)