Heating System Control with a Raspberry Pi, Part 1: The Build
I’ve had two Pi’s in my office for a couple years now. Other than being an intriguing little computer, and occasionally a “typing machine” for my young children, I hadn’t really found a good use for them… until a heating system upgrade made an unexpected little problem and the Raspberry Pi seemed a fun solution. Read on!
My house and office are separate buildings. Up until this year, an outdoor wood pellet furnace heated water for radiant in-floor heat for both buildings. The furnace was close to the office and pumped hot water through insulated underground piping to both buildings. With that system, the outdoor furnace and the indoor heating systems were independent of each other; no communication was needed between thermostat and furnace. The furnace simply maintained its water tank temperature in a preset range and had its own controls to do this. When the thermostat called for heat in house or office, a circulation pump started. With cool water flowing into the furnace, its temperature dropped rapidly and it lit itself and heated water. When it got ahead of demand and its water jacket reached the maximum set point, it shut back off. Simple.
This year, for a variety of reasons, we got rid of the outdoor pellet stove and installed a high-efficiency propane boiler in the house basement. Among other changes, this furnace now needs to know when a thermostat somewhere is asking for heat. No hot water is stored; water is heated on demand. When a thermostat calls for heat, we now need to cross two pins on the furnace to start it in addition to starting the circulation pump to send hot water through the pipes in the floor.
Why is this a problem? Because I only have one cable buried between the office and house—a Cat5 cable used for networking the two buildings together. And I didn’t feel like burying another cable for the thermostat wire. But winter was coming and I wasn’t going to work in a cold office either… so, we have to figure out how to tell the furnace to start from the office, utilizing the computer network.
Needing heat in the office, and not yet having a good way to turn it on (no time for the Pi-based controller right away), for several days I would run to the house basement to twist two wires together to turn heat on (see picture, above). When warm enough, I had to take another trip to the house, descend the stairs, and un-twist the wires again. Not an ideal solution—clearly, we need something better!
The Solution: Raspberry Pi
All right, with the history lesson done it’s time to eat some delicious Pi. We need to send a signal over the network to the house, and that signal is going to have to turn on the furnace and the circulation pump sending hot water underground to the office. I had a couple Raspberry Pis lying around that I had never found a really justifiable usage case for; this seemed a perfect opportunity to harness them for a project that should be educational and enjoyable as well as useful. And it’s a techy way to heat a techy office, which somehow seems fitting!
This project is going to have to happen in phases. The goal may be a bit lofty and I’m not sure if we’ll get all the way there or not, but I’d like to keep building on this concept (as time permits) until I have a little web page where I can log in and check building temperatures, system water temperatures, maybe get a graph showing furnace on / off times… and, of course, turn the system on and off and change thermostat temperature set points. (If you have any pointers on ways to do this: what Python-based web framework you’d use, what libraries may be handy, or anything, chime in with your comments below!) This setup offers the distinct advantage of being controllable from anywhere I can get internet access and connect to my VPN. I don’t think any ports will be directly forwarded to this, for security reasons. I don’t want hackers changing my office temperature–or somehow exploiting my humble Pi furnace control application as an attack vector to gain access to the rest of our network.
Step One: Collect Components and Build a control board
We need a relay board that is controllable from the Pi’s GPIO pins. I spent some time on Amazon and bought a couple relay boards. With optocoupled inputs, on / off indicator lights, and four 10-amp relays all for an unbeatable price, what’s not to like? These boards are also available in an 8-relay configuration if your project will involve more circuits.
Here’s the construction process in several pictures.
Next is the programming needed to make this work. This system has been saving me trips up and down the basement stairs for some time now–the wire twisting is long over! Look for Part 2, coming as soon as I have time to write, where we use a little bit of Python to make our Pi control the furnace!