I2C - Delay with Master & multiple slaves

Dear all,

I’ve read a couple of topics about I2C and using it to let 1 master control multiple slaves. My idea is to have one Arduino Mega control 6-8 arduino nano’s, with the option to increase that number to 10-12. My big question before I order these is if there is any delay between the different slaves.

Basically the master sends a singal to all slaves who then start doing a measurement. After the measurement the slaves send back their data to the master. The delay with sending back data is not a big problem, but it is a big problem if the slaves start doing a measurement at a different time. I am aiming at no more than 0.01 second difference between the start of the measurements on all slaves. Do you guys think this is possible?

Another option is using 2.4GhZ chips, but i’m scared that these will not be as reliable as a wired connection. Or is this just as reliable?

Thanks in advance!

Hi, welcome to the forum.

The I2C bus with long wires is not reliable. What is the total length of all I2C wires together ?

I think 10 Slaves within 10ms is possible, if addressed one by one.
There is a "broadcast" message to start all Slaves at the same time.
Broadcasting is explained here : Gammon Forum : Electronics : Microprocessors : I2C - Two-Wire Peripheral Interface - for Arduino

An extra wire could be used to start the Slaves.

How do the Slaves send back the data to the Master ? Is it okay if the Master requests the data from the Slaves ?

Wireless can be just as reliable (almost).

Normally when using I2C, the master sends a signal over the wire, asking for one slave to respond. The master waits for a response (for a certain amount of time). If the addressed slave responds, then the master will take the reading, and then may (or may not) ask for another slave to speak.

I2C wires should be fairly short (2 meters), if not enhanced.

Thanks for the reply guys!

@Peter_n
Broadcasting is indeed the idea, requesting the data is an option. I think it might be the only option if you use a broadcast, it would be ideal if the slaves send back their data once the measurement is done, but I think that's not possible with a broadcast, since the master would then be listening to all slaves at the same time..

Do you think broadcasting, instead of via I2C, is also possible with using cheap 2,4GhZ chips like nrf24l01?

@jack wp
Distances will be from 2m to 5m, so you think I2C is not the best option?

By the way what's your opinion about just using one line from the master to all slaves which is HIGH or LOW. HIGH means start measuring. Communication back should then be done via another way, but that's not an issue.

Is that 10-12 Slaves, each with 2 to 5 meters ? The total is about 38 meters ? That is 37 meters too much.
The I2C broadcast is something special.
With I2C and many Slaves, then Slaves don't send data to the Master. The Master requests the data from one Slave at a time.

The transceivers like the nRF24L01+ can address other transceivers one by one. I think there is no common command for all receivers. But the communication is fast.

A single trigger wire for all Slaves seems to be the safest option.
How much data should be send to the Master ? Perhaps some kind of serial communication is good enough.

"Distances will be from 2m to 5m, so you think I2C is not the best option?"
At 5m, it is really pushing it, but you may pull it off with I2C, if you have heavier wires, and keep them away from each other. It is really iffy.

It's 2m to 5m from the master to every slave. Do you think a single wire which just activates all slaves to start the measurement is reliable enough, communication back is another issue, but just for triggering? I really can't have accidental triggering in my setup by the way.

The amount of data that all slaves are sending back is in the range of 100-150 bytes, so not that much. It's the delay between the different slaves what i'm worried about.

I've read at some forums that you can set all receivers at the same address (nRF24L01+ chips), so they will get triggered at almost exactly the same time. Do you guys think this will work with 6-8 receivers in a room of 6m x 6m?

"I've read at some forums that you can set all receivers at the same address (nRF24L01+ chips), so they will get triggered at almost exactly the same time. Do you guys think this will work with 6-8 receivers in a room of 6m x 6m?"

I think NOT.

Since all devices are on the same wire, you can't expect them to all start talking at the same time. The master must ask each slave to answer, and during that time, no other slaves are allowed to answer.

Are you needing a really fast response from many slaves? I2C is pretty fast. What timeframe are you requiring?

Sorry for my late response!

The time between the start of the measurement of all slaves can't be more than 10ms. I read some things about multicasting with nrf24l01+. Is this possible in my setup? Another thing, even if I wouldn't have multicasting, is it possibile to communicate with all slaves separately within 10ms?

Maybe use a digital pin from master to all slave nanos, to instruct them to start their measurement.
Then master delays an appropriate time, and then starts querying each slave (one at a time) by I2C for their results.