Using an A3010 as a central heating controllerBy Dave Higton. Published: 17th Oct 2005, 12:25:58 | Permalink | Printable
Should have used an Intel processor to heat the water, snickerMany people rely on RISC OS and its software to look after their email and browse their favourite websites. But could you trust RISC OS to make sure you wake up to a warm shower every morning? Electronic engineer Dave Higton describes his RISC OS powered central heating system.
I've often felt that the central heating controller I had could be improved on. It turns the heating and hot water on and off, with different times available for each day of the week; but the central heating and hot water tap go on and off together. The only choice I get is Off, Twice, Once and On, with an override available if they are set to Once or Twice.
I started to build a controller based on a simple, single-chip microcomputer, although after a while I gave up because it became obvious that I'd not chosen an appropriate one. I was programming in assembly language, and it was obvious that I was going to need a lot more memory to hold the program - and a lot more time to write it.
There's still life in an A3010
After abandoning the first approach, I received a telephone call from someone who had two old Acorn computers to sell, and asked for my advice on where and how to sell them. My advice was to give them to the charity stall at a forthcoming RISC OS show, and so I duly collected them. Later, while examining them, I realised that one of them, an A3010, had two joystick ports, a parallel printer port, and a serial port. Later still, it dawned on me that this was close to an ideal embedded microcomputer system for the heating controller, as it is also silent in normal operation (no fans), has its operating system in ROM, has an excellent BASIC interpreter in ROM, and has a floppy disc drive for storage of my program and its non-volatile data. The joystick ports not only provide obvious interfaces for switches, but also provide a +5 volt supply that could be used by external relays and a display. The parallel port has enough data and strobe pins to drive a display module and some relays. It also has an expansion port that could have an Ethernet interface fitted. This was the only bit that I wanted that wasn't supplied.
I donated £5 to the charity stall at a show - when I consulted the people running it, this was the maximum they expected to make - kept the A3010, and gave them the other computer. I bought an Ethernet interface on eBay and a 4MB RAM expansion card from a RISC OS company.
I made a control box as the 'human interface' part. This is a black plastic box from Maplin that has five switches to navigate through the menus (up, down, left, right and enter), two switches for override (heating and hot water), a 24 character x 2 line LCD module, and two relays to control the boiler's components with an LED each. I spent a long time searching for components and a layout that would provide excellent electrical safety. The main contributors were relays with large spacing between the coil and contact pins, and a cover (made by sawing a similar but much smaller box into a complex shape) over the mains wiring. When the control box front is removed, it isn't possible to touch any live wiring or parts - in fact you can't get anywhere near them. This is in stark contrast to the original controller; when the front of that is removed, several large brass contacts at mains voltage are completely exposed.
The joystick interface is wired directly to the buttons. The LCD module is driven by the parallel port, which is also wired to a digital latch that enables and disables the relays. These control the boiler to begin heating the hot water tap supply and central heating.
The A3010 in the utility room: The cables through the wall go into the back of the control box.
I began writing the software in BBC BASIC. It turns out to be quite extensive - far bigger than I had expected for what I had regarded as a simple task. Of course, when all the requirements are taken into consideration, it isn't such a simple task after all. What matters is that it is simple to use, and reliable. You don't want to wake up in winter with no heating on. I can have any reasonable number of on and off times per normal day of the week, with central heating and hot water times separately controllable. I can have special days (specified by year, month and day) on which the times are different, and this can include having neither service turned on or all on. So, if I need to be up early one Tuesday morning, I can set the heating and hot water to come on early that day, but on all other Tuesdays, everything happens at the ordinary times. We can go off on holiday, and the house will be warm on the morning we leave and the evening we come back, but with everything off to save money in between - or on a special programme to make sure the house doesn't freeze, perhaps.
I made it possible to control it remotely via TCP/IP over a network. This was primarily so that I can do testing and upgrades from my normal desktop computer, but it also means that I can access it over the Internet, subject to the router being switched on and allowing traffic to and from it. Now, if we are away and change our plans, I can connect via a laptop and mobile phone and change the on and off times to suit the new time we're coming back. I use my Acorn A4 laptop - 1992 vintage, although I've only owned it for a couple of years - to access the Internet. I divided the software into client and server sections. The client is much simpler, really just a specialised intelligent terminal, is much smaller than the server, and only needs a much smaller Wimp slot.
Putting it all into place
I ran the software on test for some months before finally installing the whole system over the Christmas 2004 break. The control box goes on the kitchen wall where the original controller went. On the other side of the wall is the utility room, which was probably originally built as a coal house but now houses our washing machine and the A3010. I had to install an Ethernet cable from the network switch in the computer room; this crosses the loft and drops down the cavity of the back wall of the house, and was very much the most difficult part of the installation. The A3010 will boot and run entirely independently of the network, of course, as the network connection is mainly there for the optional extra of remote control. It does allow a refinement, though; the A3010's software real time clock, in common with that of many other computers, is not very accurate - this one loses several seconds a day. My program makes it attempt to connect to an NTP time server once a day to correct the RTC, at a time when the router is usually on, so the error never grows to a significant value.
As for backup: the A3010 is long obsolete; I can't expect it to run for ever, and when it fails, there's no guarantee that spares will still be available - although, they are at the moment, but who knows what the situation will be some years from now? So, I bought a second A3010 as a spare, and as a test bed for software upgrades. If all else fails, I could fit the original controller again - I haven't burned any bridges. When all is said and done, all my new control system does is to switch the central heating and water heating on and off, subject to the same thermostats they have always had.
To the future
I can already see a couple of possible enhancements. I would like to change the meaning of 'Off' to 'Don't allow the place to freeze'. I would like to do this with a variable temperature setting. This needs a thermometer that the A3010 can read periodically and turn the heating on if the temperature falls below the setting. Since the logical place for this electronic thermometer is nowhere near the A3010, and I don't want to install another cable over this route (which would make the difficulties of the network cable seem easy by comparison), I could use data transmission over the mains with a small box in the hall. The A3010 has a spare serial port that would be perfect for the interface to the master mains modem. And since the A3010 is permanently on and connected to the master modem, it might as well become the 'Home Automation Gateway'. It could turn anything on and off, or up and down, either from stored timed commands, or by translating commands from the Internet arriving over Ethernet, and delivering commands over the house's mains wiring.
What do you use RISC OS for?
Previous: Running a fashion label with RISC OS
Next: A9home compatibility list open for all
DiscussionViewing threaded comments | View comments unthreaded, listed by date | Skip to the end
Please login before posting a comment. Use the form on the right to do so or create a free account.
Search the archives
Today's featured article
Software hosted by Drobe: Your guide
A round-up of users' mini-websites on drobe.co.uk
12 comments, latest by neilwhite on 17/11/07 9:57AM. Published: 5 Nov 2007
Judge this! Read our spoof injunction letter
Were you fooled? Some were..
Discuss this. Published: 1 Apr 2007
News and media:
RISCOS Ltd •
RISC OS Open •
MW Software •
Advantage Six •
CJE Micros •
Liquid Silicon •
Chris Why's Acorn/RISC OS collection •
The Register •
The Inquirer •
Apple Insider •
BBC News •
Sky News •
Google News •