Introduction: Wifi Thermometer With ESP8266 in STA/AP Mode

This tutorial is based on ESP8266 and its application as WiFi thermometer that is running HTTP webserver.
There also available 2 modes STA as client or AP as Access points.

Step 1: Introduction of Thermometer

Today I will briefly introduce the project of wifi thermometer. The thermometer uses the ESP8266 wifi chip on the NodeMCU v3 Lolin development board. In addition to data logging, the Wifi chip also holds a web server where it outputs measured data. Data is measured every time a page loads. No data is recorded when idle. Web server allows to run HTML + CSS code, which allows to some extent make a nice graphical interface to plot temperatures to the user for example in a table. Javascript can also automatically update the data on the page, but I did not use this option.

Step 2: Versions of WiFi Thermometer

There are two versions of this project, the functionality of the website as such is the same. In both cases, the ESP8266 runs a web server that draws temperatures in a table. Connectivity is differentiated in versions. In one case it is possible to use an existing LAN network to which the board connects and holds a webserver on a static or dynamic IP address. After entering IP in the browser window, the user receives a request from ESP with temperatures on request.

In the second case, the board transmits its own SSID in the AP mode as an access point. The user accesses the board by entering the network password (included in ESP8266). The board transmits SSID with WPA / WPA2 PSK encryption, or it is possible to broadcast an open wifi network. Data is accessible only within the reach of this wifi network outside the LAN network of the home. The DHCP server is also running on the ESP, which after successful user authentication assigns an IP address from the range. The website is located at the gateway IP address - ESP.

Step 3: OneWire - Diagrams and DS18B20 Sensors

Temperature data is recorded from a pair of DS18B20 temperature sensors that are connected to the OneWire bus, which allows data to be collected by one conductor, with the possibility of pulling the conductor to tens to hundreds of meters. DS18B20 are produced in two main versions - so-called. indoor sensor in transistor case or in waterproof - outdoor design in aluminum tube. OneWire is suitable for interference environments and can accommodate up to 256 sensors. Individual sensors are divided by their factory address - serial number. There are 2 main sensor connection options. Normal connection and parasitic, both can be powered at 3.3 - 5.5V. The differences are evident from the OneWire wiring diagrams.

Step 4: Schematics for All (AP/STA Mode) ESP8266 Thermometers

Step 5: Source Codes

Available at: https://arduino.php5.sk/wifi-teplomer.php?lang=en or: martinius96@gmail.com
Ask for your mode --> AP for access point, or STA for client on existing WiFi network. Both versions are using webserver running on ESP8266.