I live in a house that is over 100 years old and when we first moved in a couple of years ago it was like going back in time. The house had no central heating system, brittle old electrical wiring and gaps and holes in the window frames through which you could stick your finger.
We have gradually been renovating the house, including a complete re-wire, new double-glazed windows, loads of insulation and the installation of a gas-fired central heating system.
The price of electricity and gas in the UK has risen almost 100% over the past 7 years and it shows no signs of coming back down. Although we have a new and efficient condensing boiler, the fuel bills are still eye-wateringly high. So I decided to look into ways I could optimise the heating system in the house.
Price of gas in the UK since 2005
A typical central heating system in the UK consists of a boiler and pump, one or more radiators in each room and a thermostat in the main hall. The thermostat can usually be programmed to switch on at certain times of the day, and it will switch off the heating if the temperature in the hall reaches a certain level. Ideally the radiators are fitted with TRVs (thermostatic radiator valves) that allow you to adjust the desired temperature on a room-by-room basis. However these valves are a quite crude and not very effective. For example, using TRVs you are still heating unoccupied rooms (e.g. bedrooms) during the day. What’s more if all the valves are closed due to the temperature being at the desired level, the boiler pump will continue to push water around the system.
I wanted a way to ‘zone’ the heating such that different rooms will not be heated when they are not in use. The main criteria for the solution were it had to be relatively simple to install, and of course as inexpensive as possible. Given my work in webinos and interest in all things IOT, if I could find a solution that allowed me to control it programmatically, even better.
The FS20 system
After looking at various options on the market I finally settled on the FS20 system. A wireless system that is fairly inexpensive and although the protocol used is proprietary, there is quite a lot of information about it available on the web. A ‘saver set’ is available that consists of a thermostat for each room that talks to an actuator which simply replaces the TRV head on the radiator valve (most TRVs use a standardised screw-on attachment).
The ‘FHT80B’ thermostat heating control measures the room temperature by means of an integrated sensor and transmits the corresponding control data to the ‘FHT8V’ valve operating mechanism. From the manual:
“The room temperature is measured and compared to the target temperature in the ‘FHT80B’ heating control (set via the time program or manually). The difference is used to calculate how far the valve has to be opened or closed to obtain the desired temperature. Within a time period of approx. 2 minutes commands are then radio transmitted to the ‘FHT8V’ valve operating mechanism that is mounted to the radiator. The valve operating mechanism then reduces or increases the heat accordingly.”
Installing these units in each room was a five minute job and gave me the flexibility I required in being able to set a target temperature on a room-by-room basis, as well as being able to set the time periods at which the room should be heated. However I still needed a way to switch the boiler on and off automatically based on whether any of the rooms were calling for heat. Fortunately the FHT 8W, a relay that monitors the demand of each actuator and switches the boiler when demand exceeds a (configurable) threshold, came to the rescue.
The diagram below illustrates how the whole system operates:
FS20 system diagram
After replacing the thermostat in the hall with the FHT 8W relay, the system was up and running. The entire installation took less than 2 hours.
I want data!
So far so good. The new heating control system appeared to be working well. The FHT 8W has small indicators that show when a thermostat is calling for heat. The boiler appeared to be on far less than usual and was hopefully reducing my gas bill. But I wanted to be sure – I wanted to be able to see easily which room was heating and what the temperature was in each room. It is possible to set a threshold for each valve such that the boiler will not switch on until the valve opening reaches a certain percentage. I wanted to be able to experiment with these thresholds and find how I could optimally configure the system.
Enter the Raspberry
Like many of my contemporaries, I had eagerly placed my order for a Raspberry Pi the minute it became available. After waiting impatiently for a few months my RPi finally arrived. I plugged it in and fired it up and had a quick play and then thought “Hmm, now what shall I do with it?”.
This seemed like the perfect opportunity – maybe I could hook up my RPi to somehow monitor and eventually control the heating system. What’s more, webinos was the perfect platform to achieve this goal – a lightweight framework enabling applications and services to be shared between devices. If I could get a PZP running on the RPi it would act as a proxy, exposing the data from the heating system to the other devices in my personal zone via the webinos sensor and actuator apis.
Busware COC extension board
After a bit of investigation I came across the (unfortunately named!) COC extension – a transceiver that slots on top of the RPi and is capable of operating on the same 868 MHz frequency as the FS20 components.
The RPi with COC extension
A patched build of Raspbian is available that also includes a version of the popular (but horribly unintuitive) home automation software FHEM. I rebuilt the SD card using this patched version and fired up the RPi. The pre-installed FHEM software immediately recognised the FS20 devices broadcasting in my house.
The next step was to prove that it was possible to communicate with the FS20 system via the COC board using NodeJS – the platform on which webinos runs. I began by installing nodejs on the RPi. The Raspbian Wheezy distribution does include a version of nodejs but it is quite old, so I opted to build a more recent version from source. This was just a matter of downloading the archive for version 0.8.17 and then running the usual configure and make commands.
Next, I needed to be able to communicate with the COC board, which appears as a serial port on the RPi at /dev/ttyAMA0. I installed the serialport module which built with no problems on the RPi and I was able to connect to the COC board.
So now it was time to get my hands dirty. I needed to develop a nodejs module that could send and receive data from the FS20 components. I could then use this module to develop a driver for the webinos sensor API that would expose the data broadcast by the thermostats. There followed a lot of work reverse-engineering the FS20 protocol and writing the driver that would interface with the webinos sensor API.
After a few days of coding I had a working nodeJS module along with a test harness in the form of a NodeJs Express web app that logged the various data received in real-time from the thermostats and actuators in my house and displayed the results using HTML5 canvas.
Test harness built using NodeJS and running on RPi showing live data from the FS20 components
webinos on the RPi
Everything was working well in my test harness, but I wanted to be able to see and use the data from outside the firewall. I didn’t want to open up my firewall and fiddle around with static IPs or DNS to expose my RPi to the web. If I could integrate the nodeJS module I’d developed with webinos, I would be able to access the services from any of my devices in any location and in a secure way.
The next step was to see if the webinos core would run on RPi. Luckily the webinos partners at the University of Oxford were one step ahead of me, and posted a blog detailing the steps needed to get webinos running on the RPi. Sure enough, an hour later I had a PZP running on my RPi, and after a bit of tweaking the PZP was listing a sensor service for each thermostat in my house!
I registered the RPi PZP with my zone hub – lo and behold I could discover the temperature sensors on the RPi from my laptop in the office, and even from my mobile phone.
The excellent webinos IOT Dashboard app automatically picked up the sensor services advertised by the PZP running on my RPi and I could see real-time visualisations of the data as it was broadcast.
This blog is already far too long so I will blog more later about some of the more technical aspects. I’m currently working on being able to control the system via webinos too, i.e. set target temperatures and switch the heating on and off from a webinos widget running on my phone or PC.
In the meantime, here are some screenshots of the work in progress…
Log showing the PZP starting up and registering the FHT sensors
Screenshot showing the available temperature sensors on the PZP
The webinos IOT Dashboard app – running on my Windows PC and showing temperature sensors from my RPi
The IOT dashboard showing live updates from the thermostat in my bedroom