This is in continuation from my earlier post. As I mentioned, I will be connecting Multiple IMUs on the same I2C bus. Now the problem is this: The IMUs are by default shipped with 0x68 as the I2C address. Common logic says that we can not have multiple slaves on the I2C bus with same addresses. However, as always there are hacks around this too:
One of the most common hacks is to use software and create a switcher. Switch between the IMUs. Put one IMU on sleep and access the other one. Technically at any given point of time, you will be having only slave device active and talking to the arduino ( here master device ).
Hardware connections: Connect the two slave devices ( here MPU 6050 Breakout Boards ) in parallel, ie SDA and SCL is common to both which is connected to Arduino Pin 4 and 5.
Pseudo Code: Randomly select one IMU. Put the IMU to sleep. Now make the connections as said above. Access 0x68 on the I2C bus. Read the sensor values. Toggle the IMU. Repeat for the other IMU.
I will shortly write a code for the same and upload it here.
Another existing hack is as follows: Have a look here ->
The AD0 pin can be very handy in this application. According to Jeff’s library, switching AD0 from the default ground connection to VDD connection changes the address of the IMU from 0x68 to 0x69. Voila! now you can pass this as an argument in your code and use it! 😀