How do I us a TCA9548A Multiplexer to connect more 3 x MPU6050 to a Maga2560

I attempted using a TCA9548A multiplexer to connect 3 x MPU6050 to a Mega2560. I get to change the port of 2 : 0x69 and 0x68 and obtained all the values available from the MPU6050 not using the TCA9548A.

When connecting the TCA9548A and using the I2C scanner I do get the results as per Wiring & Test | Adafruit TCA9548A 1-to-8 I2C Multiplexer Breakout | Adafruit Learning System

I followed : Adafruit customer service forums • View topic - Using Adafruit i2c multiplexer with mpu6050 (or imu9150) but still no luck. :confused:

My code is the same as in the site above.

The scanner also shows the TCA9548A to be connected to 0x70

My questions are:

  • How do I get the MPU6050(1-3) to be connected to port 0x71, 0x72, 0x73 respectively?
  • How do get read the x,y,z values from each MPU6050 using the TCA9548A Multiplexer?
  • Do a use the MPU6050 “getvalues” or do I read for the registers of the TCA9548A

How about ditching the mux, and instead use I/O pins to switch the address select pins on the 6050s?

(Disclaimer: I haven't tried this)

Thanks for your reply. I was thinking of doing that but I need very quick response from any of the 3 MPU6050's.

I will give your suggestion a good try tonight.

It will however be great if I can get the mux to work via the I2C bus as it should.