Controlling Multiple MPU6050 with a single Multiplexer

Hi Community.

Please can I have your assistance. I am trying to extract readings from multiple MPU6050. Im am using a SN74HC138N multplexer inorder to control the extraction of readings. I have set it up so that I can extract readings from each MPU6050 every 5 seconds. I am using 5 MPU6050s in my project. Inorder to extract the values from the MPU6050, I have run the all the SCL lines in parallel and all the SDA parallel. The multiplexer then selects one MPU6050 at a time to extract the data using the ADO line.

The multiplexer that I’m using is a SN74HC138N

The problem that i am having is that when my readings are displayed, it displays all the readings but the readings are all coming from one MPU6050 and not each one. Here is my code for the project and my wiring sketch :

PS: There is a 5K resistor connected in parallel with the SDA and SCL lines. Both MPU6050 and Multiplexer are connected to a 3.3V and not a 5V sources

I also simplified the diagram and the code for just 2 MPU6050s

MPU6050 COde.pdf (98.8 KB)