lektor January & February 2021 49
by the Wi-Fi module and the power supply.
Conclusion
This article showed how an existing “dumb” thermostat can be replaced
by a home-made smart and connected one suitable for home automa-
tion. Cobbling up a prototype that roughly does what it is supposed to
do was not too difficult; turning it into something that can be used by
anyone at any time and that is aesthetically acceptable required some
more effort. No doubt the new thermostat will need some fine-tuning,
but since it can be programmed remotely (in-the-field, as they say),
this is easy to do.
200519-01
on_value:
then:
- lambda: |-
static float x_last = 0.0;
if (x<x_last-0.1 || x>x_last+0.1)
{
x_last = x;
auto call = id(t_controller). make_call();
call.set_target_temperature(x);
call.perform();
}
The small hysteresis on x (±0.1 in this case) improves the immunity of
the automation to sensor noise.
The Delta Filter
Another — nicer — solution is to use the delta filter on t_target. This
filter only passes a new value if it differs from the previous value by
an amount of plus or minus delta. So, if delta = 1 and the last value
was equal to 20, then the next value will only be passed on when it is
either lower than 19 or higher than 21.
- platform: adc
name: “Target temperature”
id: t_target
...
filters:
- multiply: 25.0
- offset: 6.75
- delta: 0.2
...
Filters are executed in the order they appear in, meaning that the
delta filter operates on the value converted to degrees Celsius, and
not directly on the input voltage. Its value should be small, otherwise
it is difficult to nudge the thermostat up or down just a little bit, which
makes all the difference in user comfort.
Finalising the Device
With the YAML configuration file ready, the firmware can be uploaded
to the Wi-Fi module. The first time (i.e., with a module that is not yet
running ESPHome-compatible software) the serial port must be used
for this (available on header K2). Refer to [3] for the exact proce-
dure. Once the device is executing ESPHome with Over-the-Air (OTA)
programming enabled (when the YAML file contains the line ota:), the
thermostat can be reprogrammed without being physically connected
to the development system. In other words, it can be installed in place
of the existing thermostat.
The thermostat is mounted so that its temperature sensor is not heated
[1] R. Aarts & C. Valens, “Wi-Fi Desktop Thermostat,” Elektor, Jan/Feb 2018: http://www.elektormagazine.com/160269
[2] C. Valens, “Wi-Fi Thermostat at Elektor Labs,” Elektor Labs, 2018: http://bit.ly/wifi-thermostat
[3] C. Valens, “Home Automation Made Easy,” Elektor, Sep/Oct 2020: http://www.elektormagazine.com/200019-01
WEB LINKS
Questions or Comments?
Do you have questions or comments about his article? Email
the author at [email protected] or contact Elektor
at [email protected].
Contributors
Idea, Design, Text and Photographs: Clemens Valens
Schematic: Patrick Wielders
Editor: C. J. Abate
Layout: Giel Dols
related products
> ESP-12F, ESP8266-based Wi-Fi module
http://www.elektor.com/esp-12f-esp8266-based-wi-fi-module-160100-92
> Wi-Fi Desktop Thermostat - bare PCB (160269-1)
http://www.elektor.com/wi-fi-desktop-thermostat-bare-pcb-160269-1
> NodeMCU ESP8266 microcontroller board
http://www.elektor.com/nodemcu-microcontroller-board-with-esp8266-and-lua
> H. Henrik Skovgaard, IoT Home Hacks with
ESP8266 (Elektor, 2020)
http://www.elektor.com/iot-home-hacks-with-esp8266