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?

Gerben
11.3k3 gold badges22 silver badges34 bronze badges
asked Nov 23, 2020 at 11:27
6
  • 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. Commented Nov 23, 2020 at 12:33
  • @Juraj I2C allows for multiple masters. Though it's rarely used, and requires some extra work to prevent collisions. Commented Nov 23, 2020 at 15:50
  • @Gerben that would be really very useful Commented Nov 23, 2020 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 Commented Nov 23, 2020 at 17:47
  • @Gerben hello? I have a question that can a slave send data to master? Commented Nov 25, 2020 at 15:28

2 Answers 2

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.

answered Nov 23, 2020 at 11:33
13
  • OP doesn't understand I2C and wants to connect Arduino 3 to Arduino 2, not to Arduino 1. Commented Nov 23, 2020 at 12:19
  • 1
    I have to connect master arduinos scl and sda using same wires for all other slaves scl and sda ? Commented Nov 23, 2020 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. Commented Nov 23, 2020 at 12:54
  • 1
    And adding pull up resistance means that 2 1k resistors will be needed per scl sda connection? Commented Nov 23, 2020 at 13:06
  • 1
    And final question, can I call Arduino 3 from master Arduino when the Arduino 2 is acting as a slave? Commented Nov 23, 2020 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.

answered Nov 24, 2020 at 1:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.