Saturday 4 July, 2009.
08:53:52
Home »
Projects »
Boiler
|
the Gray family
mucking about with the web |
Boiler Control
Back in 1993, my boiler time switch packed up. It was one of those nasty devices which offers very little control or flexibility. Nevertheless, it would cost £60 or so to replace. At the time, I had an old MS-DOS laptop computer lying around doing nothing, a Clipper compiler, and a soldering iron, so I thought "why not?". Several years later, in 2002, my central heating & hot water are still controlled by that old 1993 Clipper program. We have better control, 7 day programming, and reduced heating bills as a result.
Hardware - the computer
An old Toshiba T1000. Mounted in a custom "sliding mount" againt the side of the chimney breast, under a shelf in the living room. The shelf itself is cleverly cut just too short, thus leaving a gap for the power and control cables.
Operating system: MS-DOS 2.11, on ROM-Disk. 640k RAM, plus 640k extended RAM, configured as a ram disk.
We've only had one hardware problem with the computer. We found after a few years that it wouldn't last long on its NiCDs if we switched off the mains... then it refused to work at all. The problem was the internal battery pack. Naturally, buying a genuine Toshiba battery pack looked pricey and difficult, so I bought some rechargeable AAs, put them in a plastic holder, and elephant tape'd them to the inside of the case. I needed to do a bit of soldering work to the connectors, but it should be good for another 8 years or so.
Interface - getting a signal out of the computer
The serial port is the obvious choice. The clever way of dealing with it would be to send commands out the RS232 port, and use an external UART to decode them. This would give great flexibility, and allow expansion to cover a variety of controlling applications, and the possibility to accept sensor input etc. The "bodge" method is to say "hey - I only need to switch two wires; I could just use the DTR and RTS pins and control those two signals directly in software; that way I wouldn't need to worry about UARTs, timing etc.". Naturally, I chose the latter method as simpler and having a lower component count.
Hardware - controllers
A look inside the original controller revealed that it was switching two wires at mains voltage - one for hot water, and one for the central heating pump. My main paranoia was dealing with the mains absolutely safely. There are a couple of opto-isolators in the box. The neons on the front tell you whether the CH and/or HW circuits are switched on. The switch was designed to allow manual override, but I never actually wired it in.
Software
Good old-fashioned procedural code this. Written in Clipper (anyone remember that? a compiled language derived ultimately from dBase). It's almost event driven, but not quite. Have a look at the Clipper Source Code and marvel at the rich and informative in-line documentation. It's copyright © James Gray 1993, but you may use it under the terms of the GPL if you really, really want to.
A lot of the code is to do with screen painting, particularly diplaying the time in nice big block characters, showing a "ticker" so you can see it's operating, displaying the current state, and showing where we are in the current time slot, and what's due to happen for the rest of the day. (Note - must include a screen shot sometime).
Underneath, it's quite simple. The day is divided into 15-minute time slots. You can turn heating and/or hot water on or off for any of those slots.
There are two modes - Edit and Run. In Edit mode, you can move along the main time display, turning water/heating on/off. In run mode, it just loops the main loop, checking for keystrokes, and updating the time.
You are visitor number 
|