Which software I2C multiple networks would be best?

So I need two I2C networks - one that will connect several Arduino boards, and second one to connect one of these boards to external devices (i2c lcd screen for example).

The idea is that Arduino A is heart of whole system, it sends info about starting whole system, finishing it, time remaining etc. So I guess it has to be master, as it will be sending these information to rest or boards.

But each other board can have other i2c external devices - let's say Arduino B has LCD screen that communicates over i2c. So Arduino B has to be both master and slave - master for LCD screen and slave for Arduino A.

Of course I could probably do it on single network, but I don't want for other boards to have access to LCD that is strictly connected to Arduino B. (Also, sooner or later there would be address collisions, so... just no.)

I found some libraries like SoftI2CMaster, SoftWire or Software_I2C, but as I'm pretty new to I2C I come for help and advice, which would be best for my problem?

Also, I'd rather not use I2C multiplexers as well, I would need to buy them, which is not that simple and quick.

Sorry to disappoint you:

  • The I2C bus is not supposed to go through a wire or cable to another board.
  • The I2C bus was not meant as a communication bus between processors.
  • The I2C bus is not a network.
  • The I2C bus is a multi-master bus, but don't try that with Arduino boards.

This is the list of hardware and software I2C libraries for Arduino: https://github.com/Testato/SoftwareWire/wiki/Arduino-I2C-libraries

What kind of Arduino boards are you going to use ?
Can you tell what kind of wires or cables that you have in mind for the I2C bus ?
How long are the wires ? and how many boards do you want to connect ? Are there pullup resistors ?

As soon as you add a device to your main I2C bus, you must be very careful at what voltage that device runs. For example adding a OLED will disturb a 5V I2C bus, because the OLED runs internally at 3.3V.

If the wires are short and are suitable for the main I2C bus, then that part might work. You have to do everything right for a reliable I2C bus. If you do everything wrong, the wires of 20 cm can already be too long. If you do everything right, then 2 meters might be possible. That is 2 meters total length. If you have ten Slaves, then they all can be at 20 cm distance from the Master for a total length of 2 meters.

You can create a software I2C bus for local devices. This is often no problem. You probably have to change its library to use the software I2C bus, instead of the hardware I2C bus.

Please don't use the word "network" when talking about the I2C bus, it makes my hairs stand up.

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