Arduino With more then one I2C Device?

I have a project where I need to connect a Arduino R3 Uno as a Slave to an ESP32.
I do this over I2C and it works i can send a message to the Arduino.

Now i also need a GY-521.
That also uses I2C and if i connect them I can only use the GY-521 and the ESP breaks...

I need the GY-521 output on the arduino how do I do that.

  1. without using I2C on the GY-521
    2.haveing a second I2C buss (I tryed but i only get -1 Output from the GY-521)

Any help would be nice thank you fellas for reading.

I2C is a bus to which you can connect multiple devices, each of which must have their own unique address

Have the two I2C devices that you want to use got different addresses ?

1 Like

To which board is the GY-521 connected? ESP32 or Uno R3?

This is a contradiction as @sterretje points out.

My guess is that a) you have different voltage levels, or b) the two slaves use the same address.

If you are trying to use the GY-521 from the UNO (it is not clear from your post) that won't work. In this situation the I2C bus can only have one master, in this case the ESP32.

There is a multi master mode but it is more complex and not applicable here.

1 Like

I didn't see where you said that the GY-521 works when it is the sole I2C device connected to one Arduino board.

a7

thank you all for you answers i got it to work by using UART serial with the ESP and I2C with the Gy-521.

Thanks a lot form the local penguin

They didnt had the same address but @oldcurmudgeon is right I tryed having the ESP and the UNO to both be masters.

So that's it. Yeah only one master. :grinning_face_with_smiling_eyes:

Can I ask a favour of you? Since you acknowledged @oldcurmudgeon to have steered you on track here, please mark that post as solution instead of your own. Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.