For my project I think I am putting an Arduino through a big workload, so I'm looking into splitting the task between multiple arduinos. At the moment I want to have a single master and a few slaves.
What is the optimal communication protocol in this case? I assume SPI is the fastest? I2C has the advantage of less wiring, but it seems slower. UART can't work here because I have more than 2 devices.
Correct me if I'm wrong; but afaik I should use SPI for fastest transmission. But use I2C when there are too many devices. (SPI requires an extra pin on the master for every slave)
I2C and SPI intended for device to device communications over short distances, such as on a single PCB and are unreliable, and/or don't work at all with long cables.
Sorry I don't understand what you mean. Can you please elaborate?
jremington:
I2C and SPI intended for device to device communications over short distances, such as on a single PCB and are unreliable, and/or don't work at all with long cables.
In my case my devices are on the same board; which comms protocol would you recommend?
ningaman151:
I'm not sure tbh. I guess as fast as possible. Probably 1 master and 2 or 3 slaves at most.
AS fast as possible leaves NO time to process the data. Get realistic and give some thought as to how fast you can process a message and then you will know how many bytes per second you have left for communication.
Paul
ningaman151:
For my project I think I am putting an Arduino through a big workload, so I'm looking into splitting the task between multiple arduinos. At the moment I want to have a single master and a few slaves.
What Arduino are you using and what is that big workload?
The computational differences between the Arduino compatible microcontrollers are significant.
Hardware UART supports as high as 2 Mbit/sec; where, 10-bit makes a frame. So, you can send 200 000 characters (usually ASCII formatted) in one second, which is 100 000 bytes/sec of information. On the other hand, 400 000 bits/sec (50 000 bytes/sec) could be sent using I2C and 8000 000 bit/s (1000 000 bytes/sec) could be sent using SPI Port. Build the project and check which protocol works reliably and robustly.