Wifi thermometer - NodeMCU in AP mode
Wifi Thermometer is a project where NodeMCU is used in AP mode, it's actually a hotspot to which you connect, and then you can view the temperatures or the magnitudes of other sensors that you connect to the NodeMCU. Values are viewed through a web browser on the page that NodeMCU generates. It is located on the same IP / DNS flag as the gateway (NodeMCU). This solution demonstrates two DS18B20 sensors using OneWire protocol.
parameters:
The data is updated whenever the client refresh the page. This means that it always has the current temperature.
Support me and find interesting solutions at: https://arduino.php5.sk
Source code:
parameters:
- NodeMCU in Access Point (AP)
- Custom SSID and WPA2 PSK encryption
- Custom IP (static) / DNS flag
- Secure web site accessible from home network
- Always when loading the page, the current info (informative character)
- Graphic depiction
The data is updated whenever the client refresh the page. This means that it always has the current temperature.
Support me and find interesting solutions at: https://arduino.php5.sk
Source code:
OneWire oneWire(ONE_WIRE_BUS); //ONEWIRE ČÍTAŤ IBA NA PORTE DEFINOVANOM VYSSIE DallasTemperature sensors(&oneWire); const char *ssid = "ESPap"; const char *password = "thereisnospoon"; ESP8266WebServer server(80); /* IP stranky je 192.168.4.1 (predpísané kniznicou) */ void handleRoot() { sensors.begin(); sensors.requestTemperatures(); server.send(200, "text/html", "<!DOCTYPE html><html><body><table><tr><td>Cidlo</td><td>Hodnota</td></tr><tr><td>DS18b20 - dnu</td><td>"+(String)sensors.getTempCByIndex(0)+"</td></tr><tr><td>DS18b20 - von</td><td>"+(String)sensors.getTempCByIndex(1)+"</td></tr></table></body></html>"); } void setup() { delay(1000); Serial.begin(115200); Serial.println(); Serial.print("Konfigurujem access point..."); /* You can remove the password parameter if you want the AP to be open. */ WiFi.softAP(ssid, password); IPAddress myIP = WiFi.softAPIP(); Serial.print("IP adresa pristupoveho bodu je: "); Serial.println(myIP); server.on("/", handleRoot); server.begin(); Serial.println("Webserver bezi"); } void loop() { server.handleClient(); }
Comments
Post a Comment