I am busy trying out the following:
I have a Master Arduino Uno which will have to connect through I2C to 2 or more other Arduino boards. The Wire functionality allows to connect these arduinos using a unique address for each. However, the problem is that I want to define the unique address by the Master Arduino, once a new device is connected to it.
I tried the following: - The Master Arduino listens to a default address (eg. 11). - The new device gets its power from the 5V of the master module. - Once a new device is connected, I push a button. - The master will send a request through the default address. - The new device will return a GUID. - The master will send back the GUID + a unique address. - Both master and slave will now switch to the unique address and continue communications.
This seems to work with only one device connected. However, once you connect more than one on the default address, this will not work anymore.
Is there any way to "dynamically" attach an address (communication channel) for the I2C communication, so I can connect as many devices as I want to this bus (naturally limited to just a few).