Toto je starší verze dokumentu!
Vypracoval: Martin Ptáček
The project should make use of: DHT22 (digital temperature, humidity sensor), Relay switch (output for the boiler), LCD HT1621 (7-seg display; create new universal library), Photoresistor (for brightness settings), Quadrature encoder and capacitive buttons (for control; create custom library for ESP32), Connectivity with Home Assistant IoT platform. The final solution consisting of hardware, electronics & software should be compliant with the CALM Concept, namely with regards to reliability, easy and logic of use.
Thermostat is an electronic appliance which almost everybody has at home. The main requirements on these devices are simplicity and reliability. In recent years there is a call for additional features like remote control and watch of a building temperature. There are already many commercial solutions with highlights like Netatmo and Nest. The downside of these thermostats is, except from the price, the IoT smart home integration restrictions of each platform. The aim of this project is to introduce a custom programmable thermostat solution, which can be made by everyone for the price of a fraction of commercial products.
After many tests using ESP8266 Wemos D1 Mini Lite microcontroller I changed for a more expensive but radically more powered ESP32 DevKitC. Although ESP8266 is cheaper and its performance is more than sufficient, I had a lack of GPIOs and I found an expander not to be an efficient solution.
For temperature sensing I have chosen DHT22 module. Even though it is definitely not the cheapest solution, it provides sufficient temperature accuracy, +- 0.5°C as advertised. Moreover, it provides also relative humidity measurement, which is very handy. The boiler that is connected to thermostat is controlled by simple relay links two wires together. For control of desired temperature in the old-days way I used a standard quadratic encoder, the same that is today often used in 3D printers. There is a necessity of putting a capacitor at least on the CLK signal (but better both quadrature signals) because the testing of software filtration didn't succeed and I reckon it's not worth the work.
A lot of attention was placed on choosing the right display for the thermostat. The HT1621 LCD Display is not only reasonably priced but also provides conveniently large digits. The downside is the software available for the IC. Unfortunately none of the few available libraries possessed the necessary features I demanded, therefore I started the development of my own (not from scratch).
Main project repository CalmFire_IoT_thermostat
In the software development of the CalmFire thermostat I tended to use open-source libraries when their quality was adequate because the amount of work to be done without them would be enormous and not necessary. As mentioned I created a library HT1621_universal for displaying temperature in Celsius on the LCD display. Then I used an OnOffRegulator class to take care of the boiler regulation with some hysteresis. Moreover, I altered and utilized an Encoder class created for Míčkoflus project where it measured DC engine revolutions using ESP32 PCNT module.
Originally I used a MQTT broker-client architecture using flespi.io. The problem with this solution was an inconvenient scalability and user interface solution. Then I noticed a very elabora project of Home Assistant that provides many problems elegantly solved. On the other hand, it has also some downsides. At the end, I was using a combination of MQTT client (ESP32) that is connected to Home Assistant centre (Raspberry Pi 3).
Many of the problems of CalmFire thermostat were solved in this project and the thermostat is already in the state of capability to regulate temperature in a building. On the other hand, there are still problems to be solved and especially, to concentrate to fulfil the CALM technology resolution, which has so far not been deeply considered.
In the future development, there will be a construction of a PCB board (probably DIY to be accessible to everyone) and construction of a 3Dprinted/laser cuted case and mounts.
- https://github.com/Brunez3BD/WIFIMANAGER-ESP32 - https://github.com/adafruit/Adafruit_Sensor https://github.com/adafruit/DHT-sensor-library https://github.com/knolleary/pubsubclient https://github.com/skorokithakis/kicad-lib https://hackaday.io/project/13483-esp32-kicad-library http://www.14core.com/wiring-the-6-digit-7-segment-2-4-inch-ht1621-lcd-display-module-on-microcontroller/