Multiple MPU6050 not working

Hey,

We are trying to read the yaw, pitch and roll from 4 MPU6050 imus connected through an i2C bus to an Arduino MEGA.

HARDWARE

With out current set up we are connecting the INT pin of one of the imus to the Digital pin 2, whereas the INT pins of the other imus remain disconnected. The SDA and SCL are connected to the SDA and SCL ports of the Arduino.

In order to get the address of each sensor we connected each A0 pin to a different digital port. To identify the address we set the A0 pin to HIGH or LOW.
See picture for full set up.

SOFTWARE

Libraries we are using: "I2Cdev.h", "MPU6050_6Axis_MotionApps20.h", "Wire.h"
Full code is attached. Because of reoccurnig problems with "FIFO Overflow" we edited the "MPU6050_6Axis_MotionApps20.h" last value on line 305 (the FIFO rate) to 0x0.2.

Because our readings froze all the time, we researched a bit and as far as we understood 400KHz for the the Wire library generates a freeze in the reading, so we tried to change it to 100KHz.

In the pre set up for the imus, we are setting :

#if I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE

and then in the imu setup we set this:

I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(100, true);

PROBLEMS

Even after changing the FIFO rate and the frequency of the SCL we still have some problems.
When we upload the code we get values for a few seconds. These values are interwoven with "FIFO Overflows". After a few seconds we don't get any data.

Three of the imus are attached to a plate (see picture) while one is connected in a different way. When we move the plate, all sensor give the almost the same reading even the one that is not taped to the plate.

Could our problems be related with the fact that we just connected one INT pin? If not, any other suggestions to possible solutions?

b_read_imu.ino (1.85 KB)

a_IMU_Setup.ino (2.37 KB)

181105_MPU6050_DMP6_bus_02.ino (2.51 KB)

  pinMode(I1, INPUT);
  pinMode(I2, INPUT);
  pinMode(I3, INPUT);
  pinMode(I4, INPUT);

If you connect the A0 pin to these digital IOs you must not let them float but set them to a defined state. In your chosen setup exactly one must be LOW, all other pins must be HIGH.

You must not call any method on your "mpu" object while none of the digital IOs is pulled LOW.

Fix that and post your code again. And please format it correctly (the IDE has an Auto Format tool for that), it's horrible to view your code as it is.