logo elektroda
logo elektroda
X
logo elektroda

Temperature measurement from two DS18B20 sensors using EPS8266

kisoft 2376 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16885410
    kisoft
    Level 14  
    Hello All.
    At the outset I would like to point out that I am not even a beginner when it comes to the C language or Arduino . However, I would like to measure from two ds18b20 sensors connected to the common port of the ESP module, the second port possibly for voltage measurement. I would like to do this via UDP on a broadcast address and only locally over my network. I will use a simple smartphone or tablet app to read the data. I can configure the module myself, I just need an ESP batch or at least some guidance. Any help is welcome.
  • ADVERTISEMENT
  • ADVERTISEMENT
  • #3 16885761
    kisoft
    Level 14  
    Thanks for the link but it's via http , I'll work something out there . I have the latest ardino 1.8.5 but I don't think it sees the dallas libs I still need to figure it out .

    I have tested this solution and it works very nice , it can run on battery sends the measurement from the buffer one time after a browser request . Someone has done a good , well thought out job .
  • #4 16891239
    kisoft
    Level 14  
    I've taken care of the UDP, the ESP8266 sends a string to the app every so often for now, but I think I'll do an activation of sending packets when any phone or tablet makes a read request.

    The problem for me is still reading the DS and forming the string for transmission , I found an example on the forum (even in this section) how to do it but there you have to specify the DS serials in the code . I found an example on the forum (even in this section) how to do this but there you have to specify the DS serials . In the link provided by my colleague Zielonek the program reads the serials itself but I do not know how to do it yet. I'm counting on the help of more knowledgeable colleagues , if I succeed, I will post the whole thing on the forum .
  • #5 16891511
    maly_13
    Level 20  
    Interested in easyesp very cool software for esp and has many features
  • ADVERTISEMENT
  • #6 16891674
    kisoft
    Level 14  
    thank you for the hint but i will stay with the arduino (i am slowly starting to get to grips with the cuvette). I need to solve the measurement problem from ds.
    Added after 13 [hours] 43 [minutes]: .
    I made up such a code
    Code: C / C++
    Log in, to see the code
    .
    the code works and sends the temperature one after the other (a bit uncool) . The best thing would be to convert temp1 and temp2 to strings and,combine into one string and send the whole thing , I tried to do that but I get errors .
    Code: C / C++
    Log in, to see the code
    .
    Eventually I will embrace this in the app some subtitles or signs of the degree of purpose . this is also already done in the app . I would like to finally do the measurement of the temperature inside and outside the house because I am tired of replacing batteries in the pseudo weather station and so each of the household members will check the temperature on their phone (I know, I know you can do it over the internet through some services but I do not want to do it that way).

    I would like to ask my colleagues to take a look at the code and give me some suggestions, hints and help would be appreciated.

    P.S. Recently I wanted to buy an outdoor thermometer in a supermarket, on the same shelf stood about 20 different thermometers and each showed a different temperature .
  • ADVERTISEMENT
  • #7 16896669
    kisoft
    Level 14  
    I changed my approach, I found a code which listens on a specific port and if a UDP packet arrives (locally via Wifi of course) it sends back information to the address from which the packet arrived, I checked it and it works very nicely. After launching the application on the phone, a command will be sent via UDP to the ESP8266 address and the module will respond by sending temperature measurements. The application will send the command every e.g. 2 seconds and the module will respond by refreshing the measurements. The module only responds when it receives a packet, when the application is silent , the module is silent too.
    Code: C / C++
    Log in, to see the code
    .
    the problem is that i don't know how to fill this buffer with data. does anyone have any suggestions?

    Successfully, I am uploading the correctly working code
    Code: C / C++
    Log in, to see the code

    All in all, I've learned something, when I get the app up and running, I'll post everything on the forum, maybe someone will find it useful.
  • #8 16902955
    kisoft
    Level 14  
    Hello again and welcome here
    Link .

Topic summary

The discussion focuses on measuring temperature from two DS18B20 sensors connected to a single data line on an ESP8266 module, with an additional port intended for voltage measurement. The user aims to transmit sensor data locally over Wi-Fi using UDP broadcast, accessible via a smartphone or tablet app. Initial challenges include handling DallasTemperature library integration in Arduino IDE and dynamically reading sensor addresses without hardcoding serial numbers. Solutions shared involve using the OneWire and DallasTemperature libraries to request temperatures from sensors with known addresses, and implementing UDP communication to send temperature data upon receiving a request packet from the app. The approach evolved to a UDP listener on the ESP8266 that responds with temperature readings only when prompted by incoming UDP packets, optimizing network traffic and power usage. Code snippets demonstrate Wi-Fi connection setup, sensor initialization, and UDP packet handling for local network communication.
Summary generated by the language model.
ADVERTISEMENT