Just thought I would share my Raspberry Pi Thermostat Project with the community. I have been working on this since catching the Raspberry Pi bug back in October 2013. I was feeling a little rusty in the software department and decided I needed the incentive to learn. The Raspberry Pi seemed an ideal starting point and as winter was approaching a WiFi enabled Thermostat seemed the ideal project. Nothing better than a real project to set your teeth into none of this "Hello World" boring stuff.
I decided the first thing I needed was make the Raspberry Pi able to retain the time so I added a real time clock module which conveniently had a temperature sensor and EEPROM built into the same addon.
This killed 3 birds with one stone giving me a Real Time Clock a Temperature Sensor and a data store for configuration data.
I initially bought a Piface I/O board and had dabbled with using its input and output functions. I soon learned the basics with this and then became aware of the PifaceCad board and decided this was the way to go due to the display and built in keys plus the bonus of the IR sensor. Soon after finding the PifaceCad I was pleased to see custom cases being sold for it. This cemented my choice and as you can see it makes a good looking package.
I soon realised during the development of the project that the Pi gets quite hot at approximately 55°C this would mean that the temperature sensor would need to be external to the case. I had also bought a PifaceCam board and case and could see that the RTC board would fit inside the camera case and the hole in the front would allow air to circulate. This bolts nicely on the side of the case and gives an element of isolation from the Pi. I also added a calibration offset value in the software to take care of any temperature rise in the sensor due to the self-heating effect of the Pi.
To keep the power consumption down I decided to add a PIR sensor to the design which you can see on the right hand side of the Pi. To mount this I removed the Ethernet port to accommodate the sensor which is connected to the 5V supply and ground and its 3.3V output connected to a spare GPIO line. The PIR sensor was then used to activate the back-light on approaching the Pi.
In order to drive the central heating you will need to know the type of interface used by your boiler in my case this was a 240V powered thermostat with switched live signal to the boiler. If this is the case please make sure that any interface used is adequately isolated from the Pi and is also fitted by a qualified person. The circuitry for the interface resides in the separate enclosure below which contains an encapsulated mains powered 5V supply to power the Pi and a 5V powered relay with mains rated contacts in excess of the current switching specification of the original thermostat. Ensure that the mains supplies for the relay feed to the boiler and the supply to the Pi are fused accordingly. The relay is driven by and open-collector transistor drive circuit mounted on a vero-board in the Pi driven by a GPIO line.
The main display shows the actual temperature on the top line with the time and thermostat set-point on the second line. The top navigation switch alters the set-point or allows the user to scroll through menu settings if the bottom right key is pressed. The left bottom key is currently programmed for a boost function which overrides the timer functions for two hours. The timer settings, set-point and calibration offset are stored in the EEPROM on the RTC module. These are read on power up to restore the thermostat when the power is interrupted.
The software is written in Python3 and the OS is Raspbian Wheezy. I am looking to learn how to add web functionality so that I can stream data from the thermostat and control it remotely