Connect 4 MPU-6050 with Mega 2560 via I2C

Hello,

I have an Arduino Mega 2560 and four MPU-6050-sensors. Reading the RAW-values of one sensor is successfull. But I try to connect all four sensors while using the i2C-bus. Is it possible to open a second I2C-bus to use 2 Sensors a bus? Or is there an other possibility to connect all 4 Sensors for example in one I2C-Bus?

Thank you

MPU5060 has it's own I2C controller so it can read and control other I2C sensors - they have to be connected to lines marked as XSCL and XSDA. So you can connect two sensors to arduino's I2C ( set A0 on one of them LOW and the other HIGH to give them different adresses ) adn two others connected to auxilary I2C line of MPU5060. I newer done that mysfelf but saw an example somewhere - I'll try to find it.

waski: MPU5060 has it's own I2C controller so it can read and control other I2C sensors - they have to be connected to lines marked as XSCL and XSDA. So you can connect two sensors to arduino's I2C ( set A0 on one of them LOW and the other HIGH to give them different adresses ) adn two others connected to auxilary I2C line of MPU5060. I newer done that mysfelf but saw an example somewhere - I'll try to find it.

That seems to be a good solution. But who is the auxilary SPI line? Is it right, that I have to try to connect two sensors on a line with xcl and xda. And the other two sensors at the same line with scl and sda?

No, connect two sensors to Arduino's I2C pins. Give those two sensors different addresses by connecting their A0 pins to VCC or GND ( 3,3V ! ) Then, to each sensor ( XSCL , XSDA lines ) connect one of the others MPUs . But I can't help you with the code for reading those auxilary sensors as I never tried it...

You can connect multiple devices to the I2C bus, but the devices need to have different I2C slave addresses.

Some chips and breakout modules have ways to do this, some don't. And in most cases, only 2 addresses are possible.

I don't think that the suggestion to use the "auxilliary I2C bus" of the MPU 6050 is really practicable. You still have the problem that the slave of the slave is using the same I2C address.

michinyon: You can connect multiple devices to the I2C bus, but the devices need to have different I2C slave addresses.

Some chips and breakout modules have ways to do this, some don't. And in most cases, only 2 addresses are possible.

I don't think that the suggestion to use the "auxilliary I2C bus" of the MPU 6050 is really practicable. You still have the problem that the slave of the slave is using the same I2C address.

So it would be better to create a second I2C-bus. But how can I do it. Is there a possibility?

here comes something really useful for you :): http://playground.arduino.cc/Main/SoftwareI2CLibrary you need 2 I2C port, one hardware i2C and one softwareI2C, each port can communicate with 2 MPU6050, with different AD0 setting!~

Elecrow:
here comes something really useful for you :):
http://playground.arduino.cc/Main/SoftwareI2CLibrary
you need 2 I2C port, one hardware i2C and one softwareI2C, each port can communicate with 2 MPU6050, with different AD0 setting!~

That seems to be the solution! Wonderful! Thank you.

hi~ did you resolve the problem? i'm also finding the solution T.T can you show me your source?