Raspberry pi, central heating system

Sometime ago I built my own “mancave” where I can work, go mad with my hobbies and store my motorcycle. This place was heated by an electric heater. Not very efficient and it was clumsy to turn it on and wait some time to heat the place up.

My mancave is build against an existing shed where we do the laundry, this place is heated by a gas heater.

My first plan was to transport hot air from the gas heater into my mancave. The concept I worked out worked pretty well, but it took me a lot of work to make it efficient enough to quickly heat the place up to a nice temperature.

2014-01-13 22.08.28 2014-01-11 20.31.19

Necessary stuff

  • Special air tube with heat resistant isolation
  • Silent and powerful fan
  • Raspberry Pi
  • 8-way relay board
  • 3 digital temperature sensors
  • Breadboard
  • Some resistors and other electrical parts
  • Case for all the parts

I started to get the heating system to work without automation with the raspberry. I created a ventilation system for continuous air circulation and hoi air intake from the gas heater.

2014-01-14 20.21.24

This took me some weeks to get it to work as I had in mind. Problems with the fans (the first one melted after one week), loud noise by the air movement and isolation of my mancave.

After all the issues were solved I began to work on the Raspberry Pi. The relay board that I bought required an extra board to control it with the Raspberry Pi. Next time I would use solid state relays, they can be controlled directly and don’t make a clicking noise when switching.

Here are some photos developing the relay control board.

2014-02-03 15.30.29 2014-02-12 21.50.40 2014-02-16 15.22.23 2014-02-16 16.26.29 2014-02-20 20.19.56

I connected the relays, temperature sensors and infrared module, installed drivers and made a jump start with Python, Node.js and bash.

2014-03-16 15.00.50 2014-01-17 21.33.37

I started with code from an existing project, because my Python knowledge was too poor to start from scratch. The Raspberry Pi had to watch the temperature in my mancave and turn on the fan when needed. Additional issue was that the gas heater is thermo controlled and turns off automatically. I worked out all these requirements and began developing.


  • Reads the temperature sensors and writes the values to a MySQL table.
  • Reads a relay table with the relay values and turns the relays on or off when necessary.


  • Reads the current temperature and gets the temperature set via the interface. If heating is necessary and the gas heater is hot enough, it enables the right relay value in the MySQL relay table.
  • The PHP part also contains a web interface to easily control the temperature and current preset (home, away, night or comfort). Some presets are automatically selected, depending on weekday and time of day.


  • When changing the preset or temperature via the web interface the Node.js instance will take direct action (instead of waiting for the cron job that is polling every minute). The instance also updates the web interface when there is new data to show.

Update 2015-02-28

Today i updated my pi to the newest version of Raspbian and all my thermometers did not give readings. I thought that they where broken…
But after some research the new kernel of Raspbian requires an extra line of config to /boot/config.txt After adding this line “dtoverlay=w1-gpio,gpiopin=4” it worked again.

Luckily i was quick enough with fixing this issue so that none of my toes were frozen… :’)

2014-02-16 17.52.13 2014-02-20 21.42.30 2014-03-16 15.06.54 IMG_20141025_225004 IMG_20141023_233622 image