Advanced thermostat for boiler

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
ncc1701
New user
Posts: 3
Joined: 18 Nov 2021, 08:42

Advanced thermostat for boiler

#1 Post by ncc1701 » 23 Nov 2021, 21:37

Disclaimer: I do not response for fails of your equipment.
Moreover: I just share my project for advanced users, who are familiar with:
- ESP Easy (flashing firmware; using web-UI sections: devices, rules, logging and other);
- Simple schematics.
I am too busy man, so:
- I won't teach any newbies and amateurs to basics;
- I will try to answer to questions, but I do not promise to do it very quickly.
And I apologize for by bad English: it is not my native language.

Before involving of ESP Easy, I've used a simple thermostat to control a gas boiler. My heating system has cast iron radiators, which have a significant heat capacity, comparable with heat capacity of floor heating systems. After years of using a simple thermostat, I found, that this kind of control is simple, reliable, but not always optimal:
- temperature variations could be significant (sometimes it reach about 1.0C) even with 0.1C hysteresis;
- duration of cooling (disabled state of boiler) could be too long, because of significant heat capacity: after 50 minutes of cooling, natural convection of air is almost lost. It is not comfortable, because of temperature gradient (legs begin to be cold);
- if suddenly outdoor temperature decrease and gas boiler power is not enough (or specified coolant temperature is not enough), a gas boiler can start to cycling: target temperature is not reaching; thermostat is locked to enabled state and after heating, a gas boiler disables gas burner itself, but circulating pump remain at enabled state. So, when gas boiler is cycling, some of heat energy is lost through a heat exchanger.

But, ESP Easy firmware with using rules (some kind of scripts), give an opportunity to make an advanced thermostat.

Goals of this project:
  • decrease temperature variations;
  • prevent cycling of gas boiler;
  • control duration of heat/cooling cycle (at least, make heating power of boiler match to summary cooling power of radiators by limiting duty cycle).
Algorithm of advanced thermostat based on prediction/calculation duration of heating for current target temperature and other environment condition: thermostat will disable a boiler before reaching the target temperature (it will be reached later, because thermal inertia of radiators). Perfect prediction is required several of thermometers (for room, outdoor, coolant temperatures and others). But... I try to use just a single thermometer for room temperature. So, my project does not imply of perfect prediction, but acceptable prediction in many cases is possible (at least, it will not be worse than a simple thermostat).

About project:
used hardware: Sonoff T10/T16 (based on ESP8266) + digital thermometer DS18B20 (you can use another one);
firmware version: mega-20211105_c79d675.

I've attached some files:
Archive "Rules.zip". It has two folders: "Advanced thermostat" and "Simple thermostat" (untested reduced project version without prediction, but with controlling of duration of heat/cooling cycle).
Each of folder has next files:
  • Rules.src - it is source of rules. I don't use web-editor, so this file has a lot of comments. Using of this files for uploading to your device is not recommended (instead of this, upload file "rules1.txt");
  • rules1.txt - reduced rules file (with deleted comments and empty strings) for uploading to your device;
  • Variables.txt - description of variables.
Make attention: there is a lot of initial settings. At the end of Rules.src and rules1.txt you can see section which is triggered on boot:

Code: Select all

on System#Boot do
  // Init HW...
  // Init global parameters...
Here you have to use initial parameters optimal for your heating system. For example, if your heating system has a little heat capacity, you may decrease values for duration of cooling:

Code: Select all

// Targeted duration of cooling
  TaskValueSet,DurOff,trgt,<YOUR_VALUE_BY_SECONDS>
  // Duration of cooling after T-sensor fail
  TaskValueSet,DurOff,fail,<YOUR_VALUE_BY_SECONDS>
Archive "Dashboard.zip". It simple dashboard for target temperature control and current state watching (just unpack it and upload to your device).

I've tested/debugged this project for enough of time. You can visit my channel at thingspeak.com.
Some explanations: I use more complicated configure with 2 thermometers. So, do not be confuse about gaps of current temperature chart: only one of thermometers can be used at the same time. Moreover, when used thermometers in the kitchen, there is too much things are happened (cooking, making tea and etc.).

I wish good luck to control your boiler!
Attachments
Dashboard.zip
(8.02 KiB) Downloaded 220 times
Rules.zip
(7.36 KiB) Downloaded 222 times
Last edited by ncc1701 on 24 Nov 2021, 12:00, edited 1 time in total.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Advanced thermostat for boiler

#2 Post by TD-er » 23 Nov 2021, 22:57

You know, this project of yours is basically the same idea I have had for years now.
I always wanted to make the "perfect thermostat", which in my opinion is a thermostat without a single button.
It simply must manage the perfect comfort in the house.

Of course for "learning" purposes (or the iterative process before it can become "perfect" it may need 2 buttons:
- Too much
- Too little
(for temperature/humidity/whatever)

The ideal setup would be a system which can predict units of measure which cannot be measured using a single sensor.
For example what we call in Dutch "waterkoud", translated to English as "water cold" is typical for the Dutch weather.
Outdoor humidity and low temperature may make it feel colder than it really is.
Take a foggy day, where the sun may not be able to get through the fog and thus it lasts for the whole day.
These days may happen in autumn or winter and they feel quite uncomfortable.
Good luck finding an of-the-shelve thermostat which may fix that for you.

I will try to look into your rules to see what you're doing and maybe get some ideas for extensions for ESPEasy that may ease the computations needed here.

User avatar
ncc1701
New user
Posts: 3
Joined: 18 Nov 2021, 08:42

Re: Advanced thermostat for boiler

#3 Post by ncc1701 » 23 Nov 2021, 23:06

TD-er wrote: 23 Nov 2021, 22:57 ...Outdoor humidity and low temperature may make it feel colder than it really is...
You are right: there are much of place to extent the project with other modules.
The main target variable [T_Trgt#T_CurrTrgt] can be changed somewhere:
  • at scheduler;
  • at another module, which analyze additional weather parameters.

User avatar
ncc1701
New user
Posts: 3
Joined: 18 Nov 2021, 08:42

Re: Advanced thermostat for boiler

#4 Post by ncc1701 » 11 Dec 2021, 19:35

Update:
for "Simple thermostat" added more control of duration of heat/cooling cycle:
  • added maximal duration of heat (it is necessary to make heating power of boiler match to summary cooling power of radiators);
  • added maximal duration of cooling and flag to start new cycle after exceeding maximal duration of cooling (just optional parameters).
Attachments
Rules_V1.1.zip
(7.54 KiB) Downloaded 227 times

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests