I've been working on a wireless thermostat for a while now after the one I had fitted a few years ago crapped out. The old system comprised of a battery powered thermostat with LCD which sent messages via RF to a mains powered receiver which in turn switched the boiler heat demand on or off. Unfortunately it always a bit crap. The battery powered bit only ran for a max of about 3 of months at a time on 4 AA cells which in itself is pants, but then to top things off the mains powered bit died (suspect its a cap that's aged as its uses them to drop the mains down to power the receiver and relay).
So, I figured I could do better, and since I work with 802.15.4/ZigBee stuff on a daily basis that was an obvious choice as a starting point. Over the course of a weekend I knocked up a hasty prototype using evaluation boards to get the heating back on and keep the Mrs happy
The results of that can be seen below:
Eval board running the prototype code (old thermostat below it in its usual state, wanting more batteries
)
Botchtastic mains powered bit to switch the boiler on/off. A bit rough but it worked fine for a few months until its replacement got built.
I then started designing some boards to tidy things up a bit. All boards done in Kicad. The boiler control board was sourced from Mitch at Hackvana and the Thermostat board from seeedstudio. Didn't have a problem with either and quality was fine.
Thermostat board. Not many parts, just reverse polarity protection, a navigation switch, TMP102 temperature sensor, NXP wireless module and an LCD module. Dropped a bit of a clanger with the connections to the LCD module, but a bit of work with the scalpel and some thin wire soon sorted that
Mounted in its case. Its an odd shape since the battery compartment occupies much of the interior when the 2 halves are joined, not much room for the LCD module:
All together with a couple of keyhole slots cut into the back for wall mounting:
and a laminated legend to finish the front off:
Fitted to the wall and running the heating:
Boiler controller board in its enclosure (the buttons are for manual override of heating control):
And finished off running the heating:
There is also an external temperature sensor (another wireless device) which is currently another eval board. I've designed another board for that but not received it yet.
I went through a few iterations of the software, ultimately settling on the following scheme which just uses the basic 802.15.4 MAC features, its not running ZigBee though I might switch to it one day, or I might write my own stack (already done one partially but not yet finished):
The boiler controller acts as the network coordinator since it is always on and mains powered. It also makes the decisions about boiler on/off. It doesn't do any fancy PID control, just a simple 1 degree deadband control. I'm happy to put up with the temperature in the house fluctuating a bit to reduce the time the heating is on and save money for more toys
.
The external temperature sensor wakes once per minute sending its reading to the boiler controller.
The thermostat sleeps mostly, waking up briefly once per minute to send its temperature measurement to the boiler or is woken on DIO state change if the navigation button is moved to change the setpoint. It also requests in return the average internal temperature (the system can cope with >1 thermostats), the external temperature, the demand state (heating on/off cooling on/off), the setpoint (if changed by another thermostat), and the percentage of time that heating or cooling has been demanded in the last 24 hours (handy for seeing if any changes done around the house affect the gas use). The current consumption is dominated by the LCD module which draws about 500uA I think. Both the wireless module and temperature sensor combined consume less than 5uA less when sleeping. With the 2Ah batteries, life should be a far bit better than in the system I replaced.
I then decided to add some datalogging so finally found an excuse to get a RaspberryPi and do another board:
This requests the temperatures and demand state once per minute and logs them in an SQL database. I then added a web front end to the data logged using all this new fangled Javascript and JSON stuff which really hurts my head which functions much better with C. The results of that can be seen here. If you click on the bit that says Heating Demand, it overlays the plot with the periods where the heating was on:
http://indigopepper.com:8800/daily.htmlEventually I plan to add more sensors (have already designed a board with footprints on for a multitude of other sensors) and also add web/internet control and time scheduling to the heating system (may involve doing another rev of the boiler control board with a real time clock on it).