How to Ensure Your Heating System is Linked to an Atomic Clock

Quite some time ago, probably like a lot of other people, I converted my home heating system controller to an Atmel AVR circuit. For a whole lot of legacy reasons, I haven’t tended to use Arduino boards for this. I have a selection of Atmel ATmega8 designs for previous projects, and I have a collection of etched PC boards which I reuse for projects such as this. Some day, I’ll run out of etched boards and I’ll switch to Arduino boards. If for no other reason than they are surface mount unlike my own designs which are through-hole. Also, assembly is not required! However that, like everything else, is a project for another day.

First off, it’s worth mentioning how the system actually works, out of the box. My heating system is the of the OFCH persuasion, or “oil-fired central heating.” For those of you not in a cold climate, this involves a boiler and burner unit, which heats a recirculating closed water system, connected to a collection of radiators around the house. The burner has a blower and oil pump (as well as an electronic ignition). This is fed via a thermostat on the boiler to make sure the recirculating water is at a certain temperature. Above that temperature, the burner shuts off. There is also a pump which moves the hot water around the system and through the radiators. Along with this are two electrically-operated valves. One opens the system to the radiators downstairs and one for the upstairs radiators. Generally you never run the burner without the pump running, as this would just heat the stagnant water inside the boiler, to no effect. The thermostat makes sure that the water inside the boiler never gets too hot, cutting off the burner if and when that happens. Generally the return feed from the house will be below the cutoff so the burner operates. However, eventually the return feed will exceed the thermostat and the burner will switch off, leaving the pump to circulate the water until it drops below the low temperature threshold (hysteresis and all that). With both electric valves off, the boiler will heat the hot water system in the house by way of a heat exchanger in the hot water cylinder. Generally though, I run the burner, pump and downstairs valve together.

I tend to phase in my projects rather than try to swallow the elephant in one bite. The first phase was to remove the existing (dumb) unit and replace it with a bank of four solid-state relays. These Omron units are quite good. They operate off a 5 volt input so they can be connected directly to the Atmel chip (I use 5 volt Atmels - your mileage may vary). In order to isolate the AC power from the low-voltage systems, I mounted the four relays in a wooden box with a plexiglass front panel. As this was enough of a project to get me started, I then took a five volt power supply and connected it to another dumb timer. I fed the output to three of the four relays, ignoring the upstairs system to start with, as it isn’t used very often. At the appointed time, the dumb timer would energize, power up the 5 volt PSU which provided an input signal to the three relays, thus turning on the central heating system. The phase one version of things operated for quite some time!

The second phase introduced the Atmel circuit. I decided to simplify the programming and settled on a sixteen entry program table. Each entry specifies a start time (HH:MM), a duration in minutes (up to 255 minutes), a day-of-week mask, and a operation byte. The operation was one of {H,H+D,H+U,H+D+U}{I} where H was for hot water (just the burner and pump), D was for downstairs (burner, pump and downstairs electric valve), U was for upstairs and I was for an electric immersion heater, filed under TBD. I used a serial port to talk to the Atmel board, and wired that to the house server, temporarily. I built a sealed lead-acid (SLA) charging circuit, and mounted the Atmel board with the 12 volt SLA in another wooden box with a plexiglass cover. I put a 220 volt to ~15 volt AC transformer into its own sealed box and wall-mounted that as well. In addition, I put a separate unit with two circuit breakers on the wall. One breaker feeds power to the Atmel transformer and one to the bank of relays. The code keeps track of the exact time of day, and day of week.

This worked extremely well, but changes to the program schedule, or requests for a quick “burn” of heat, were tricky. There are times when you just want to turn on the heating system for an hour, without updating the program. I supported this option in the firmware, but it involved having to use /cu/ or /tip/ to connect to the serial port and send the command.

Some time after this, I came across a Grandstream Serial Concentrator from Perle. It has 24 serial ports available at the front via RJ45 sockets. You can configure the device in a number of ways, but for this I configured it as an outgoing raw port. It is set up to listen on TCP port 5024 and relay data to the serial port, and vice versa. If you happen upon one of these devices in your travels, they are well worth adding to your equipment rack. This allowed me to interface the Atmel board with the house network, and from there, I developed a small web server which allows me to control the heating and adjust the program. More on that, in a later posting.

As my main server (an HP Proliant Microserver naturally) runs FreeBSD and also is an NTP client, so it has a very accurate view of the date and time. I have a cron task which is responsible for updating the day-of-week and time on the Atmel board. This takes care of two things: Firstly, clock drift is eliminated as the time is updated every hour. Secondly, I don’t need to code for the abomination known as “daylight savings time” as the cron task will reset the hour shortly after the clocks change.

There is a smug self-satisfaction from hearing the heating system fire to life at exactly 0730 in the morning, knowing that the clock in the heating system had been corrected using an Atomic Clock reference, a mere 30 minutes earlier.

The system isn’t without it’s challenges, and I’ll cover those in a later posting.