• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

How to broadcast messages from a webserver to 30..40 connected ESP32 in a WiFi network?

Q&A Forum › Category: ESP32 › How to broadcast messages from a webserver to 30..40 connected ESP32 in a WiFi network?
0 Vote Up Vote Down
Michael Rogulla asked 4 years ago

Hi all,
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!
 

8 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi Michael.
 
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: 

  • https://randomnerdtutorials.com/what-is-mqtt-and-how-it-works/

 
Then, you can check all our MQTT-related tutorials here. 
 
I hope this helps.
Regards,
Sara

0 Vote Up Vote Down
Michael Rogulla answered 4 years ago

Hi Sara,
thank you for the super fast reply. Currently I am on the road but next week I’ll give it a try!

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Great!
Then, let me know how it goes.
Regards,
Sara

0 Vote Up Vote Down
Michael Rogulla answered 4 years ago

Hi Sara,
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.
Any suggestions?

0 Vote Up Vote Down
Steve Mercer answered 4 years ago

Have you tried ESP-MESH?

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
As Steve mentioned, you can try ESP-MESH, or ESP-NOW.

  • ESP-NOW tutorials

But, for your scenario, I still think that MQTT is the best choice.
Regards,
Sara

0 Vote Up Vote Down
Michael Rogulla answered 4 years ago

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.

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

OK.
Then let us know how it went.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.