How do you feel about this article? Help us to provide better content for you.
Thank you! Your feedback has been received.
There was a problem submitting your feedback, please try again later.
What do you think of this article?
Adding smarts to a not-smart combi boiler, enabling remote heating control and scheduling flexibility.
As winter is rapidly approaching here in the UK, usage of heating is beginning to increase. Most central heating installations can be as simple as a combi boiler controlled by a fixed timer or can be as involved as using COTS “smart” heating controls, such as Google’s Nest thermostat or British Gas’ “Hive” product offering.
Room thermostats and programmers boil down to nothing more than a dry contact that is closed with heating demand, with the boiler usually providing a 230V mains output and an input that is connected to the contacts.
Currently, the controls for my heating system consist of a combination timer and room thermostat, which leads to a number of frustrations – only two programmable time slots with no option to run only one and the temperature of one room is monitored. There is also no option of “boosting” for a time period which would be beneficial for doing things like drying washed clothes.
After having my patience tested one final time dealing with the rigidity of the timer, I set out to build a replacement control box that would interface with the boiler. Other devices around my house are controlled from Home Assistant as I prefer to keep more critical controls and services local rather than relying on a cloud, so building a system that integrates with this was a no-brainer.
DISCLAIMER: This article is not intended as a how-to guide and nothing in it constitutes professional advice regarding working with mains electricity. Mains electricity and wiring issues can easily kill, and work on mains equipment and associated wiring should only be carried out by a competent person.
The controls required to interface with the boiler are simple: a switch capable of handling 230V, a suitable microcontroller and a power supply. Additional components were chosen to allow for a fall-back mode of operation that relies on the existing room thermostat to take control, should either the WiFi connection become unavailable or Home Assistant crashes.
As the microcontroller needs to be capable of communicating over a network connection to be able to interface with Home Assistant, I settled on using an ESP8266 which is supported by ESPHome. For ease of use, a development board manufactured by DFRobot was selected; this features the ESP-12F module paired with 16MB Flash, an on-board lithium-ion battery charger and voltage regulators to deliver the necessary voltage rails.
To mount the microcontroller board on DIN rail an interposer plate was laser-cut from acrylic sheet, then fastened to two Hammond clips. These clips provide an ideal solution for attaching non-DIN rail compatible parts.
The breakout board accepts a 5V input on the “Vcc” pin which makes selecting a power supply easy. I settled upon the RS Pro 5V, 2.4A DIN rail-mounted power supplywhich features a slim design, saving space that was already at a premium.
A relay was required to bridge the gap between the microcontroller GPIO pins that operate at 3.3Vdc and the 230Vac used by the boiler. To avoid having to build an interface circuit to drive a relay coil, a suitably rated Solid State Relay was chosen. Crydom produce a slim “interface” SSRthat nicely fits this bill, featuring a maximum output current of 2A at 230Vac, which is plenty for my application.
One thing to note even with using an SSR is the required input current to turn on the output. Crydom quotes the “typical input current” as being 15mA at 5Vdc, with an input impedance typically of 333 ohms. At 3.3Vdc this gives an input current of 9mA, which is just within the maximum permissible single-pin GPIO current of the ESP8266, at 12mA.
The front panel controls consist of two rotary switches and two LED indicators. Both rotary switches are Siemens parts, one a three-positionto give auto-off-manual control and a two-position that switches between the existing thermostat output and an always-on “hand” position – providing a backup control should the ESP8266 become inoperable. A white and green LED indicator reflect the status of the incoming mains supply and heating demand on the control output.
A compact steel enclosurewas selected to house all the components. Steel was the preferable choice to using a plastic enclosure for fire safety reasons should anything fail within the enclosure. It feels more “correct” using a steel enclosure when 230V mains supplies are involved, but this is a matter of preference. Steel enclosures such as the one selected also tend to feature permanently affixed hinged doors which is ideal for controls installation, as plastic enclosures tend to have loose lids.
To round off the component selection process, a number of terminals from Phoenix Contact’s PTFIX series were selected from our stock. These terminals feature push-fit connections that make wiring quick and easy, plus the ability to connect terminals together with shorting bars means that large terminal gangs are easily made.
Assembling the Control Box
The first step was to assemble two sections of DIN rail onto the mounting plate included with the enclosure. Two sections were used to provide enough space for the power supply, microcontroller, relay and terminals. Due to the mounting plate being retained with nuts that tighten onto studs within the box approximately ten millimetres at either end of the rail cannot be used – sufficient clearance is required to be able to get a nut driver in.
With both DIN rails in place, terminals and the relay were snapped onto the lower rail. Eight terminals were grouped together into four sets of two – one for mains live, neutral, earth and the boiler thermostat live output. The thermostat return was connected to a terminal on the heat demand indicator.
The front panel was removed and four 22mm holes were drilled with a step drill bit to allow for installation of controls.
A laser-cut and etched sheet of IPI Laserables II was used to label the front panel controls. This material consists of a thin layer of acrylic bonded to a thicker sheet, once the top layer is etched through the colour underneath shows through. Using this material produces a high quality and robust label and lately has become my favourite way of marking panels.
Moving back to the internals, the power supply was clipped in and wired to the mains distribution terminals. A quick power-on check was done so that the output voltage could be set correctly, as a small potentiometer permits adjustment within a 4.5-5.5Vdc range.
Before installing the microcontroller board some minor modifications needed to be done. Given the steel enclosure selected, the ESP8266 would be unable to receive any WiFi signal at all and the stock ESP-12F module does not have a footprint for a u.FL antenna connector. Some careful modification with a scalpel and soldering iron permitted a connector to be soldered and the on-board antenna disconnected.
A quick test using an Arduino sketch proved that the modifications were successful and WiFi networks could be received with the board mounted inside the box.
Connecting the ESP8266 to Home Assistant
As the initial setup of ESPHome requires a USB connection to the microcontroller to flash firmware, just before final installation was the prime time to do this. Once the firmware is installed over-the-air updates can be performed and configuration remotely downloaded.
ESPHome has an easy-to-use onboarding tool that prompts for access to the device, using WebUSB to access the serial port presented by the microcontroller board. With the board successfully connected, the firmware is installed then a prompt appears to enter WiFi credentials. This builds a basic configuration that is pushed to the device, containing nothing more than the board type, an API key used by Home Assistant, an OTA key used by ESPHome and WiFi settings (including a fallback hotspot mode should the connection fail)
switch: - platform: gpio pin: 12 name: "Boiler thermostat input"
The configuration was then updated to have the correct board type (the ESP-12F module appears to be compatible with the NodeMCU v2 modules) and a “switch” component configured connected to GPIO pin twelve. Creating a switch component in ESPHome exposes a switch entity within Home Assistant.
With the configuration created this was updated using OTA to verify the microcontroller was properly connected and communicating. Through the magic of Home Assistant device discovery, the new entity is found and a notification delivered prompting for final configuration.
At present, I have the entity connected to a button control on my dashboard, but I plan to connect this to a generic thermostat control in combination with a scheduler to allow me to fulfil my goal of flexible heating controls.
Progress on the final wiring continued once the microcontroller was installed, which consisted of connecting the GPIO output to the SSR and adding the external connector plate. This holds two five-pole connectors in maleand female variants to allow the boiler and thermostat to be plugged in. The external interfaces were wired using Igus chainflex PVC control cable, which provides four numbered conductors and a green/yellow earth conductor.
Connections inside the boiler were bought out to a fused terminal block. Live, neutral and earth had to be combined with the existing supply that comes from a plug and the replacement thermostat live output and input are connected on their own. The same was done to the room thermostat, with the existing cable disconnected and replaced with the control cable leading to the interface box.
A final set of checks were done, including checking for any dead shorts between the mains connections, and the thermostat output connections. Plugging the mains connection in resulted in the boiler powering up and the interface power indicator illuminating. Toggling the switch within Home Assistant resulted in the heat indicator lighting and the boiler starting up.
In this article, we’ve taken a look at the process of building a custom relay interface box to connect to a traditional combi boiler. We’ve also taken a look at how easy it is to build custom peripherals that can integrate with Home Assistant using the ESP8266 or ESP32 series of microcontrollers.