The Due used with the MPU6050 needs minor mods, as follows:
PROBLEM:
Compile error
MPU6050_DMP6.ino: In function 'void setup()':
MPU6050_DMP6:165: error: 'TWBR' was not declared in this scope
ANSWER:
Amend a line of the I2C code as follows:
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE Wire.begin(); // TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz) commented out for due R3 <<<commented out Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficultie <<<< added - speed setting
----------------------------------------------------------------------
PROBLEM:
No data returned from FIFO.
ANSWER:
The correct interrupt signal on the DUE is "RX0 < 0" in other words, pin zero.
Wire this to INT on the MPU6050
-----------------------------------------------------------------------------------
PROBLEM:
The serial monitor does not scroll yaw/pitch/roll results until four keyboard entries are sent to flush the FIFO.
ANSWER
Initialize with four inputs (not yet executed).
-------------------------------------------------------------------------------
PROBLEM:
Want to run multiple MPU6050 etc....
ANSWER:
rig a digital output wire to each MPU6050 (or other compatible device) address zero
Select one digital output to HIGH to transfer data between a specific MPU6050
and the DUE in turn with the I2C library set to an address with bit zero HIGH
Here is the code passage:
// class default I2C address is 0x68 // specific I2C addresses may be passed as a parameter here // AD0 low = 0x68 (default for SparkFun breakout and InvenSense evaluation board) // AD0 high = 0x69 MPU6050 mpu; //MPU6050 mpu(0x69); // <-- use for AD0 high <<<< ACTIVATE THIS LINE
----------------------------------------------------------------------------------------------
PROBLEM:
Values drift with time
ANSWER:
It's worth noting that on a first drift test of my DUE & MPU6050 & MPU6050_DMP6 sketch,
the initial values of less than 1 degree each axis had changed to
-147.5, -1.07, 0.91 nearly ten hours later. This seems to be a phenomenally low drift rate when stationary.
--------------------------------------------------------------
Brian Whatcott