2

I was just learning about I2C between 2 Arduinos, one as sender and another as a receiver

So I have got curiosity to know how many Arduinos can be connected to I2C connection in serial?

I mean,

Arduino1 --> Arduino2

Then can I connect Arduino3 to Arduino 2 then again Arduino 4 to Arduino 3? Till how many Arduinos can I continue this connection?

  • you can't connect Arduino 3 to Arduino 2 as slave to master, because the MCUs you tagged have only one I2C interface and Arduino2 is already a slave. but you can connect many slaves to Arduino1 because I2C is a bus. – Juraj Nov 23 '20 at 12:33
  • @Juraj I2C allows for multiple masters. Though it's rarely used, and requires some extra work to prevent collisions. – Gerben Nov 23 '20 at 15:50
  • @Gerben that would be really very useful – Subha Jeet Sikdar Nov 23 '20 at 17:38
  • @Gerben, the question describes a chain where 1 and 3 are connected only over 2. I only tor OP to realize the difference – Juraj Nov 23 '20 at 17:47
  • @Gerben hello? I have a question that can a slave send data to master? – Subha Jeet Sikdar Nov 25 '20 at 15:28
4

The limiting factor is the bus capacitance. This is the limit of the total capacitance of the bus from all devices connected to it plus the capacitance of the wires used.

It is also affected by the value of the pullup resistors.

The limit, according to the specifications, is 400pF. An Arduino has an input capacitance of 10pF. So ignoring the wires that's an absolute limit of 40 Arduinos all connected together.

Reduce that a bit for the wires, so say 30 is a reasonable estimate. Then reduce that again if you're using the internal pullups which are about 10x bigger than they should be. That gives you a guestimate of 5-10 devices.

Use proper pullups instead of the internal ones (why oh why oh why did Arduino ever encourage and even make default such a stupid option?!?!?!) of say 1kΩ and keep wires very short and you'll probably be OK up to 20-25 devices.

  • OP doesn't understand I2C and wants to connect Arduino 3 to Arduino 2, not to Arduino 1. – Juraj Nov 23 '20 at 12:19
  • 1
    I have to connect master arduinos scl and sda using same wires for all other slaves scl and sda ? – Subha Jeet Sikdar Nov 23 '20 at 12:52
  • 1
    @SubhaJeetSikdar You can connect it how you like. You could go SDA/SCL on 1 to A4/A5 on 2, then SDA/SCL on 2 to A4/A5 on 3, etc. A4/A5 and SDA/SCL are directly connected to each other inside the Arduino's PCB. It's the same as connecting all the A4s together and all the A5s together, or connecting one A4 to another A4 to another A4 etc. – Majenko Nov 23 '20 at 12:54
  • 1
    And adding pull up resistance means that 2 1k resistors will be needed per scl sda connection? – Subha Jeet Sikdar Nov 23 '20 at 13:06
  • 1
    And final question, can I call Arduino 3 from master Arduino when the Arduino 2 is acting as a slave? – Subha Jeet Sikdar Nov 23 '20 at 13:08
1

The number is as many as you want. There are switches that allow you to select different busses and each buss supports its full complement. From my point you are trying to use a solution before you have defined the problem fully. I have a feeling they will not be within a few inches of each other so consider an alternative designed for this type of use. CAN, RS485 and other interfaces would work much better with a lot less effort on your part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.