Now that I have a low-cost, low-power web server (made from a Current Cost bridge board) I wanted to make a better programmable thermostat. The standard product you can get from any good plumbing supplier incorporates timers and a thermostat and links wirelessly to a boiler relay. These cost between £50 and £120 and do the job – sort of. However, like conventional video recorders, they are hellish to program. As a result, they are often not set correctly so your home is over or under-heated.
The objective of this project was to create a plug-compatible alternative that would be easy to program as well as more flexible. The end goal was to use less energy without loss of comfort. We’ll achieve this in two steps: firstly to make programming easy and then to automate it as far as possible. This post is about ease of programming. I wanted to use a web browser of this as these are ubiquitous in many homes now, certainly ours. The initial control panel looks like this:
It’s laid out in this way to make it compatible with any browser, from smartphones to desktops. The version shown is for central heating only. We have four presets for weekdays and another four for weekends. I plan to add a set for hot water when I get another relay for that. This version also has Advance and +1 hour buttons just like the timer it’s replacing in our home. Changing the code is as easy as editing the Arduino sketch and reloading it. It would be even easier if we had an Ethernet bootloader (instead of USB). Anyone done that?
Not-so-obvious features of the software include the approach to power-up where the unit functions as a network client to pull settings from a cloud-based server. When testing this my initial code ran out of RAM and behaved badly. The solution was a slight redesign which includes a test to raise an alarm if available RAM runs too low. Pretty obvious for embedded software but something you can easily forget if you are used to the resources of a conventional web server.
This version is under test at the moment and I’ll open source the software when I’m happy with it. There are a few assumptions behind the code so testing is absolutely necessary. I need to be sure that this will run indefinitely and will recover properly from mains outages etc. Batttery operation would be nice but this Arduino configuration is not well suited to that.
In a future version I’ll also be adding compensation for outside temperature so that the system can adjust itself to weather fluctuations.
If I can find a way to fund it I get a specific PCB developed so others can do this more easily, unless of course the London Hackspace team gets there first.