The WiFi_Thermostat and WiFi_Thermostat_mDNS firmware is available in English language for the ESP32 and ESP8266 microcontrollers (Espressif Systems). Experimental version of basic Thermostat firmware with manual output control is only available in the Slovak language.
Support the WiFi thermostat project via PayPal. Support will allow you to add new features in the future and open the source code of the application: PayPal donate
ESP8266 ESP32 WiFi DS18B20 OneWire Dallas HTML Webserver WebSocket JSON mDNS UART

WiFi Thermostat - ESP8266 / ESP32


The WiFi thermostat is a highly efficient system designed for microcontrollers from Espressif Systems, featuring seamless integration with ESP8266 (12E, 12F, Wemos D1 Mini, NodeMCU v2/v3) and ESP32 platforms. This system enables reliable WiFi connectivity, enabling easy access to configuration via an intuitive web interface. Note: ESP8266-01/ESP8266-01S and earlier microcontrollers are not compatible with the project due to limitations in firmware upload methods. ESP32 microcontrollers, including ESP32-WROOM-32, ESP-32S, and associated DevKits, are fully supported.

Hardware Requirements

  • ESP8266 / ESP32 microcontroller
  • DS18B20 temperature sensor (OneWire interface)
  • Relay: SRD-5VDC-SL-C / OMRON G3MB-202P for boiler switching (Active-LOW signal)

Web Interface Pages

  • / - Root page displaying form, current relay output, target and current temperature, and hysteresis settings.
  • /action.html - Processes form data, updates EEPROM, and redirects to the root page.
  • /get_data.json - Shares temperature data in JSON format, suitable for third-party systems (e.g., MQTT brokers, home automation).
  • Other system pages for control and configuration adjustments.

Sensor and Relay Details

DS18B20 Sensor: This temperature sensor provides 12-bit resolution, offering accuracy in 0.0625 °C increments. The OneWire bus allows for fast data transmission (500-1000 ms).

Relay Options: The SRD-5VDC-SL-C relay can handle up to 10A at 230V AC (2300W). For DC circuits, it supports up to 300W. Alternatively, the OMRON G3MB-202P SSR is designed for AC circuits with non-inductive loads (up to 460W).

Features and Functionality

  • Automatic boiler control with real-time temperature adjustment and hysteresis
  • Configurable target temperature and hysteresis
  • Boiler ON/OFF control with automatic mode
Important: The automatic mode implementation is experimental and may have some limitations.

The thermostat can also serve as a WiFi thermometer when not controlling the boiler, providing temperature data without active heating control. It operates independently of the web interface every 10 seconds.

Boiler control with hysteresis

Web Interface and User Experience

The thermostat's web interface adapts for both desktop and mobile devices, ensuring a responsive and user-friendly experience. It uses Bootstrap CSS for optimal performance, reducing load on the microcontroller. The configuration is stored in EEPROM memory to persist settings after power outages, ensuring reliable operation.

Important Notes

To prevent EEPROM wear, configuration data (reference temperature and hysteresis) are only updated when the form is submitted. The web page refreshes every 30 seconds to update the status, with a warning for users to save their changes before the page refresh.

Disclaimer

Warning: The author of the WiFi thermostat is not responsible for any damage caused by improper installation or operation. The thermostat is provided under the MIT License.

Main Page for Modifying Target Temperature and Hysteresis

Example of Switched On Output:

Sample Data:
  • Target Temperature: 22.75 °C
  • Hysteresis: 0.25 °C
  • Measured Temperature: 22.49 °C
  • Output Status: ON

The thermostat activates the heating process when the measured temperature drops to 22.49 °C or lower. Once the temperature reaches 23.01 °C, the output is turned off, the signaling relay opens, and the gas boiler stops heating, initiating the cooling phase in the room. The thermostat remains inactive until the temperature falls to 22.49 °C or below, at which point a new heating cycle begins. This precise temperature regulation helps maintain the desired room temperature while optimizing energy efficiency and ensuring comfort.

Main page for target temperature and hysteresis modification: WiFi thermostat - Main overview with modification of target temperature and hysteresis Processing of datas that user entered by HTML form: WiFi thermostat - data processing from HTML form JSON web server output in browser / client via websocket:
WiFi termostat - JSON output
Output to UART monitor - system logic + set IP address, mDNS record:
WiFi termostat - UART output with mDNS record, IP address of thermostat

Available libraries for microcontrollers (ESP)


Library archive (.zip) expand to C:/Users/[User]/Documents/Arduino/libraries
Library name Library function Download
Dallas

Library for ESP8266 and ESP32 microcontrollers. It allows communication with the Dallas DS18B20 sensor on the OneWire bus. Possibility of communication after normal or parasitic connection.

Download
WiFiManager

Library for ESP8266 and ESP32 microcontrollers. Creates an access point (AP) and Captive portal for configuring a WiFi thermostat on a home WiFi network.

Download
DNS Server

ESP32 microcontroller library. Required for WiFiManager library to work properly.

Download