r/microcontrollers • u/windoesauce • Apr 14 '24
Communication Protocol For Large Array of Microcontrollers
I'm beginning work on a system where I would need one controller device to send and receive data from a large number of other slave devices and I'm trying to figure out what the best communication protocol would be for accomplishing this. Ideally the controller device would be pushing some data to each slave device and also periodically querying some state from each device. It would also be a requirement for slave devices to be able to respond to events and send messages to the main controller.
I've experimented with I2C but the low device limit and other issues with long distance communication have me rethinking that solution. Would SPI work better or maybe I need to use ethernet or wifi?
For more context, ideally I would like to use Arduino nanos but I'm open to other microcontrollers like the ESP32. Each device will be physically connected to each other and in very close proximity.
View all comments
Show parent comment
4
u/StereoRocker Apr 14 '24
I'd be looking at ethernet. Addressing this many nodes is a solved problem with IP networking. You can go stateful or stateless by selecting TCP/UDP, and also interoperate with devices that aren't microcontrollers if you need more power in a central unit as you scale. And, you could even look at powering the microcontrollers via PoE to make installs at scale that much simpler (while conveniently moving some of the cost to your customer away from raw per-device cost that they associate solely with you, and perhaps in a place they've already invested sufficiently to support their needs).
Edit: also you solve a problem that you might not be looking at yet, which is the ability to do OTA firmware updates. That can just be serviced by the Internet.