logo elektroda
logo elektroda
X
logo elektroda

ESP8266 - How to send temperature data from one module to another via UDP?

krzysiekwfd 6324 33
Best answers

How can I show the temperature measured by one ESP8266 on the web page served by another ESP8266?

The simplest solution is not UDP: either make the first ESP8266 display the second ESP8266’s page in an iframe, or have the first ESP fetch the second ESP’s temperature over HTTP and then show both values on its own page [#16492987][#16493226][#16498691] If you choose the HTTP approach, let the second ESP expose the temperature in a URL parameter and send a GET request such as `GET /data.php?value=... HTTP/1.0` with the appropriate `Host:` and `Connection: close` headers [#16503319][#16503408] The first ESP should store the received temperature and include it in the HTML it returns when the browser asks for port 80 [#16498691] If you use direct communication between modules, a fixed IP in the same subnet is important so the first ESP can always find the second one [#16499833][#16499868]
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #31 16503443
    krzysiekwfd
    Level 11  
    Posts: 105
    Rate: 1
    such as
    Code: C / C++
    Log in, to see the code


    or so
    Code: C / C++
    Log in, to see the code
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #33 16506657
    krzysiekwfd
    Level 11  
    Posts: 105
    Rate: 1
    Is this correct?

    Code: C / C++
    Log in, to see the code
    .

    I also tried the 2nd way with this displaying a frame of 2 pages, but that does not work either because it shows me the same page in a frame
    the code looks like this
    Code: C / C++
    Log in, to see the code



    the best thing is that I tested it by pasting another page and everything works then??maybe someone knows how to remedy it
  • #34 16512067
    krzysiekwfd
    Level 11  
    Posts: 105
    Rate: 1
    I managed to do the whole thing another way.

Topic summary

✨ The discussion addresses how to transmit temperature data between two ESP8266 ESP-01 modules, with one running a web server on port 80 displaying its own temperature and the goal to also show temperature from the second module on the same webpage. Initial suggestions include embedding the second module's webpage via an iframe in the first module's HTML, avoiding direct UDP communication. Challenges arise in assigning static IP addresses to the modules, especially when using a Windows 10 mobile hotspot as the network, which complicates fixed IP configuration due to subnet mismatches and lack of router access. Solutions involve correctly setting static IPs within the hotspot's subnet range (e.g., 192.168.137.x), specifying gateway, subnet mask, and DNS parameters in WiFi.config(), and ensuring the order of WiFi configuration and connection calls is correct. For inter-module communication, a recommended approach is to have the second ESP send its temperature to the first via HTTP GET requests with parameters, which the first ESP stores and displays alongside its own data. The first ESP's web server then serves a combined page with both temperature readings. Code examples illustrate HTTP GET request formatting, proper URL parameter passing, and HTML iframe embedding. The discussion also highlights common pitfalls such as incorrect IP subnet settings, improper HTTP request formatting (e.g., misuse of Content-Length), and network conflicts when static IPs are assigned without router control. Ultimately, the solution favors HTTP GET communication between ESP modules over UDP for simplicity and reliability in this context.
Generated by the language model.
ADVERTISEMENT