Hi everyone! Recently I have gotten interested in communication protocols and have been looking for one (with little success, hence my question) which would satisfy the following requirements (in prioritized order):
• All devices should be able to initiate communication (not your typical master slave with polling)
• Devices should be able to address messages directly to one another without a single one permanently taking on some host/master/relay role
• Devices should be hot-pluggable (A new device may be connected to the network or removed from it without problems even when the network is up and running)
• The protocol should be stable and immune enough to noise so that it can be sent through wires up to at least 5 meters, ideally even up to 10-50 meters.
• It should be simple, implementable even on low-perfomance microcontrollers.
• It should have its maximum transfer rate in the kilobytes per second range or preferably even megabytes per second.
I have looked at I2C, which for the most part would be fine, but as far as I understand it was not meant to be sent through a wire and it would be quite vulnerable to interference. (It also is by default a master-slave protocol, but it also has a multi-master mode, so maybe making every device a slave and a multi-master master at the same time could work?)
The rest of the protocols I looked at were all master-slave, which, for my purpose, is unacceptable.
That being said, I would be grateful if you could give me some pointers as to what protocol may satisfy these requirements and perhaps even on what sort of wires and signals it would require (twisted pairs? Differential signal? Shielded twisted pairs? Could plain simple wire suffice? etc.)
MQTT?
MQTT isn’t peer-to-peer, it requires a centralized broker that all devices connect to.
If OP were looking at network protocols, CoAP would be the right option, but it looks like they don’t even want to bother with IP.
Sounds like you want ethernet.
Hmmm… It does tick a lot of the boxes, but the ethernet protocol is way too complex with all of its layers and not reasonably implementable on a low-power microcontroller. Also it requires separate hubs for connecting multiple devices together unlike i2c, which is daisy chainable.
A lot of microcontrollers, ESP32 or STM32F4 to give two examples, have the PHY built in.
But if that’s too much for your taste, then CAN bus might be what you’re looking for.