Only 29Hz when using TCA9548A

Hi, I’m working on a project where we are supposed to log the input of 3 different MPU6050 with one arduino. I’m currently using a TCA9548A multiplexer for this to work as my arduino Mega couldn’t power each individual MPU6050 from digital pins (was going to switch adresses to read each MPU indicidually). My problem is that I only get 29Hz readings, and when the sampling window is 0,2s I will only get 6 readings which is not enough. Do anyone have an idea of how to solve or work around this problem?

Code si attached, it is a modified example: MPPU6050_DMP6, GitHub - jrowberg/i2cdevlib: I2C device library collection for AVR/Arduino or other C++-based MCUs

Gyro.ino (12 KB)

couldn’t power each individual MPU6050 from digital pins (was going to switch adresses to read each MPU indicidually).

Why aren’t you switching device addresses?

The first plan was to just switch between 0x68 and 0x69 with a high/low signal from digital pins, but the initialization failed when I did it this way. The mega seems to not be able to deliver enough power through the digital pins for it to receive the signal as high.

henrissl:
The first plan was to just switch between 0x68 and 0x69 with a high/low signal from digital pins, but the initialization failed when I did it this way.

Did you remember to set the address pins correctly during the three individual initialisations?

Yes, I tried first with only 2, one high and one low. With an I2C-scanner they were both identified as low even though there is 5v at ADO from digital pin. It works when I give it 5V directly from 5V-pin. I’ve also tried an external batterypack to help support enough current into the arduino.

Holy macarony... I forgot to set pinmode to output :sweat_smile: