If you've followed my other projects you know I am working on monitoring the energy usage of my house. The long-term goal is to model the energy usage so that it can be predicted using environmental variables. The idea is that once you can predict energy usage you can reduce usage by intelligently curtailing it when you know comfort won't be affected. For instance, if you turn the thermostat down at night modeling would allow you to pick the proper time, given the outside temperature, to turn it back up so that it's at the right temperature when the building's occupants are active. If you log the actions of the thermostat it also allows you to collect detailed statistics about energy usage and temperature conditions.
A piece of this project is having a thermostat that can be controlled by the ioBridge. Conceptually this is very simple. The simplest thermostats -- like the round Honeywell units you see in a lot of older houses -- are just a switch that closes at a certain temperature and opens at a slightly higher temperature. This is very easy to model with the ioBridge: take a temperature sensor and a relay board, and write a simple script that monitors the temperature sensor and opens and closes the relay board appropriately.
However, there is a serious problem with this approach: reliability. In my testing I found that it was very difficult to make a program monitoring the ioBridge reliable. There are just too many points of failure between my computer, my web server, ioBridge's servers, the ioBridge, and all of the network connections in between. Having a thermostat fail is bad news; at best it means you waste energy and at worst you could freeze your pipes or damage your heating system.
(I'll throw in a plug here that if ioBridge had HTTP GET on events, monitoring programs like this could be designed in a much more reliable way.)
I came up with a simple solution to provide a fail-safe. I added a second relay card to my design. This relay would switch control of the heating system between the installed thermostat and my ioBridge-based thermostat. If my thermostat failed, I could just switch control back to the wall-mount thermostat.
OK, but how do I know when my thermostat has failed? How can the ioBridge know that the control program has stopped? I modified my program to send a "keep-alive" message every time it checks the temperature. The keep-alive is turning one of the digital output pins on and off again. I then put a circuit between the control relay and the digital output pins that turns the relay on when it gets a keep-alive, and turns it off it doesn't get another keep-alive within five minutes.
I implemented the circuit using an arduino board, it's very simple, about a dozen lines of code. I did it that way because that's what I had around, there's a million ways you could do a circuit like this. I wanted to do an even simpler circuit using a transistor and a resistor/capacitor network, but I just didn't have the right pieces in my junk box. I also thought about using a 555 timer, but I had the arduino.
The fail-safe thermostat is connected to the normally closed part of the relay so that if the ioBridge loses power altogether we go back to manual control.
OK, so that's the basic setup for heat. What about cooling? Most thermostats control three things: heat, cooling, and fan. The ioBridge supports four relays, so you can use one for the fail-safe, one for heat, one for cooling and one for the fan. In some systems the power supply for the cooling is different than for the heat, but since the relay board is DPDT it can control two circuits at once, and one fail-safe can control both heat and cooling power. Being able to control the fan intelligently would allow you to do clever things like detecting an imbalance in the temperature between rooms and running the fan to even things out.
Let me know what you think.
Nick