I am looking for suggestions: I want to use 30..40 ESP32 boards (each controls some LEDs), they are connected to one WiFi network. I want one central ESP32 (or maybe a PC?) also be connected in this network. This central machine should be able to push “messages” to all ESP32’s. A decentral ESP32 should be able to respond something like status updates.
I played around with firebase_ESP32_client, and it worked, because here all ESP32 (even the central one) talk to a firebase database, and the firebase library supports triggers when data changes. But the problem is, that there is always a delay, because the firebase is hosted in a remote location. Now I am looking for an alternative approach where the messages can be send and received in a local network. The decentralized ESP32s should use a library where incomming messages trigger some action.
ESPnow seems not suitable because it is limited to max. 20 clients in one location, and websockets are limited to 4 connections at a time (AFAIK). Regularly pulling a database from each of the ESP32 also doesn’t seems to me as a good solution.
Maybe I don’t see an obvious solution, would somebody point me to a possible way? Thanks!
If I understood well, the best approach for your project is using MQTT. You can have multiple boards communicate with each other via an MQTT broker:
If you’re not familiar with MQTT, you can start with this tutorial:
Then, you can check all our MQTT-related tutorials here.
I hope this helps.
thank you for the super fast reply. Currently I am on the road but next week I’ll give it a try!
I looked at several documents, and it looks like the basic structure consists of many (in my case 30..40 ESP32) clients, and I need a machine (like a Raspberry PI or a laptop) that runs a “broker”. The broker handles all messages and decides which client get which message and also can be controlled by a third kind of device, a dashboard like Node-RED. Ok, so it may be possible to use an API of a broker to broadcast and receive messages to and from the clients, but this all looks a little bit oversized, I think there must be an easier way to send and receive messages in a network. The clients are ESP32 in my case, and the central device could be also an ESP32 or even a more powerful machine.
As Steve mentioned, you can try ESP-MESH, or ESP-NOW.
But, for your scenario, I still think that MQTT is the best choice.
Hi all, thank you for the hint to ESP-MESH, I didn’t know this kind of network!
I experimented with ESPnow and there we have a limit of approx. 20 clients in one ESPnow area. I am very curious if ESP-MESH allows more devices, my project need 30..40 clients. I’ll give it certainly a try.