-->
Page 1 of 1

choices do I have for communication between multiple esp8266

PostPosted: Sun May 16, 2021 1:31 am
by jesse_12
Hello, everybody!

I'm working on a project that will need many esp8266 and esp32-based devices to communicate with one another (possibly more than 15).

In the past, I've used a Raspberry Pi as an entry point, running Mosquitto, and configuring it to communicate through MQTT with ArduinoJSON, but this seems like a more substantial approach.

What more choices are there for anything like this?
The below are the requirements:

    In the event of a break, the ability to reconnect is needed.
    The ability to submit data in "near real-time" is needed (sub-second latency and multiple messages every couple of seconds, so LORA etc is out)
    It must be secure (encrypted traffic or at least only accept connects from trusted hosts)
    It's much cooler if it would "self-configure" or "self-discover."

Thank you very much in advance!

Re: choices do I have for communication between multiple esp

PostPosted: Sun May 16, 2021 4:55 pm
by davydnorris
I would say MQTT is still your best bet, based on your requirements.

- MQTT brokers have auto reconnect and Last Will and Testament LWT so you can detect broken clients
- MQTT can be secure and can also be open but trusted
- MQTT can be easily set up so clients can self discover and configure, but then that becomes more fiddly if you are trying to only allow trusted clients

The one sticking point is that any messaging protocol is designed for asynchronous comms so latency might be an issue, but it depends on what you are trying to do. In every case, your clients will be set up in a polling mode of some sort and so that's where your response time will be determined. In MQTT, clients will check to see if there are any messages published on the topics they are subscribed to. For web sockets, clients poll as well.

Probably the fastest approach would be to have a multicast socket, but your clients will still need to listen to it and be polling at the network layer, and will then need to determine if the data is for them. If you separate this out into a control layer over MQTT and a data or broadcast layer over multicast then that would possibly be the fastest comms across lots of devices.