Elektor-TV-WiFi-Desktop-Thermostat
Cold Spray was used to freeze the sensor
This DIY project was published under the title WiFi Desktop Thermostat in the January & February 2018 issue of Elektor Magazine. It's not only a flexible and programmable temperature control, but also an ideal project to learn a lot from, as well as to experiment with communication through WiFi.
The project offers 6 presets and 3 custom (user) programs for switching a 250 VAC, 10 A load through a relay with both normally-open (NO) and normally-closed (NC) contacts.
The Wi-Fi network connectivity permits control of the load through an interactive user interface on your smartphone, tablet or computer.

Highly Integrated Wi-Fi-Capable System-on-Chip ESP8266

At the heart of this Wi-Fi controlled temperature activated relay sits an ESP-12F module built on the famous ESP8266EX, flanked by a 4-MB serial flash memory.
This ubiquitous ESP module takes care of practically everything:
  • reading the four pushbuttons;
  • controlling the three LED;
  • communicating with the temperature sensor;
  • switching the relay on and off.
 

The program for the interactive thermostat was written as an Arduino sketch with setup and loop functions. It is quite a large program due to the inclusion of a web server and a Wi-Fi access point. The thermostat functionality is implemented in the function loop and this is where you can add custom presets. All pretty straightforward indeed.
If you prefer to think of the integrated web server and WiFi functionality as more than "black boxes", this project is a great way to learn about the intricacies of the communication between the main program and the webpage that provides the user interface on the remote device.

Four programming & scripting languages

Elektor-TV-WiFi-Thermostat-Four-programming-languages
The thermostat is the server while the client is
the phone, tablet or computer that displays the
 webpage.
The thermostat is essentially a web server that responds to so-called HTTP GET requests. Such requests expect an answer in return, an HTML file or an image for instance, but it can also be data.
The image opposite shows a graphic representation of the mechanism. More detailed info can be found in the well documented and onthe related Elektor LABs web page.
 
Although it is presented here as a thermostat, nothing should keep you from making something enterily different of this Wi-Fi-controlled relay simply by creative substitution of the temperature sensor.