Hello, I am doing one project in which I have one ESP32 as the main controller connected with multiple ESP8266 with PIR, Magnetic Switch and Flame Sensor. ESP8266 and ESP32 working in STATION MODE. All ESP8266 sending their respective message to ESP32 like Motion Detection, Gate open and Fire. Now I wish that ESP32 should send the Message to all ESP8266 to activate the Buzzer after getting the messages like Motion Detection, Gate open and Fire. How to send the message to different ESP8266 as they have different IP addresses? Please Help me with this. How to do this. Link of Block Diagram is given below:
How are you exchanging data between your boards? Can you provide more details about the setup you have already?
Using MQTT can be one of the best choices. You can also use ESP-NOW. But you need to know the MAC address of each board to send data.
I am just using <WiFi.h> library. I am connecting all the ESP8266 by ESP32 through the IP address of the ESP32. Means, I am just feeding the IP address of the ESP32 to ESP8266. And doing by client-server model.
The ESP32 can have a variable that changes if you need to activate something. For example, in case of the flame sensor:
armFlamesensor = 0;
In case of fire, the ESP8266 sends something to the ESP32 (the ESP32 receives a request on a specific URL, for example /firetrue) to tell that there is fire and the armFlamesensor variable is now:
The ESP8266 with flame sensor and buzzer makes requests on that specific variable path every x number of seconds, and if that variable is 1, it activates the buzzer.
Then, if the flame sensor is not activated, the first ESP8266 makes a request on something like /firefalse, and the ESP32 changes the armFlamesensor variable to 0 again.
With this approach all ESP8266 are clients making requests on different paths of the ESP32 server.
I don’t know if I explain myself clearly, just let me know.
Take a look at these projects that might help you understand what I’m talking about:
Let me know if this helps.
I don’t know what your current scenario is, so I don’t know if this will be easy to fit in.
Thank You, Mam, for your elaborated answer, and I will try as per your answer and let you know if this helps. Thanks again.