Communicate digital data between an Arduino and a MPU6050 inertial motion sensor an I2C bus.
Please be sure to review the general information about I2C and SPI in the previous exercise prior to starting this one.
This exercise will use a MPU6050 I2C Accelerometer/Gyro inertial sensor module from Sparkfun. This modules is based on the InvenSense MPU-6050 Motion Processing Unit. Example Arduino code is available from github as part of the larger i2cdevlib, which provides drivers for many I2C devices.
MPU6050_DMP6
sketch included with the exercise. This is an
example from i2cdevlib, reorganized into a self-contained sketch.
If you have cloned the course materials from github, it will be in the same folder as this page, or it can be
downloaded directly. Be sure to fetch all top-level
files.Send any character to begin DMP programming and demo:
ypr -87.92 74.39 1.85
The sketch is a relatively complex piece of software for a microcontroller, and it uses more than half of the available Arduino Uno program space. But it is also solving a complex example of processing 3D motion data.
For a challenge, clone the original i2cdev library from github and install it in your Arduino IDE libraries path, then try compiling the original unmodified example.