domenica 30 novembre 2014

Remote heater - HW

This is an English translation of the original Italian post

I am doing that as some friends told me they would have been interested in the project but they cannot simply read Italian.

In this post I describe how I have built a simple remote control mechanism for my home heating system.

My objective here is to create a simple system which is capable to answer two simple questions:

  1. how do I switch on/off my heating system when I am out of home?
  2. how do I program my home heating system in a flexible way?

Currently the home heating system is controlled by a normal on the wall thermostat

That one doesn't give me the required flexibility necessary to satisfy above item #1 and #2.

One day I got in my hands a  raspberry pi model B  and then I have asked myself: why not replacing the on the wall thermostat with the raspberry?

This was the starting point of my small home project.

The first step has been to get the approval from my boss (wife??? ) :). She has immediately added a third requirement:

3. the on the wall thermostat should (must) always be working and should not be replaced by the raspberry one.

Well, now all the requirements are clear so I can start the implementation of the project.

Initial Circuit

The current circuit of the home heater is the following:

Final Circuit

In order to be compliant with requirement #3 I have modified the initial circuit in the following way:

This way I have realized a simple logical OR between the raspberry pi and the on the wall thermostat. This satisfies all the 3 requirements:

  1. through the raspebbry I can switch the relay and thus switching on/off the heating system from a remote location
  2. I can program the raspberry in a way that it switch on/off the heating system in a flexible way 
  3. in case the Rasperry will not be working (network down, hw failure, ...)  I can still operate the heating system from the legacy on the wall thermostat

Assembly of the project

In order to build and assemble this simple home project I have used the following components:

Step 1: Prepating the Junction Box
I have positioned the rapsberry in a corner of the junction box. Raspberry will be fixed in that position through a screw

As my junction box is not large enough to fully host the raspberry, I have signed with a pencil the place on the junction box in which to create a slot to allow the insertion of the power cable and the SD card.

As you can see the slots have been created with an electrical drill. I am not very proud of this part of the project :) . If you have better idea and better tools to create the slots let me know.

Step 2: Fixing the junction box to the wall

I have drilled a hole in the junction box so later I can apply a nut and bolt screw in order to fix and hold the raspberry pi.

Later I have applied some glue to the junction box and to the wall. This is how the junction box is hold on the wall. I have used glue to avoid drilling the wall.
Obviously this is my preference and you can select a different way to hold the box on the wall.

Step 3: Raspberry Wiring

The wiring is pretty straightforward. It is only needed:

  • VCC +5V
  • GND
  • 1x GPIO (#15) but you can use any other available GPIO on your board. I have used 15 just for wiring issues.

More in detail I have wired the raspberry in this way:

  • green wire    -> +5V  = Pin 2
  • white wire -> GND = Pin 6
  • yellow wire  ->  GPIO 15 = Pin 10

Those Pin numbers are valid for Raspberry model B revision 2. If you are using a different Raspberry model or revision make sure to select the correct GPIO layout in order to avoid issues.

Step 4: Wiring Relay module

As shown in the final circuit diagram above, I need to add a new relay which is controlled by a GPIO (#15) of the raspberry pi.

In the past I have bought a 5V relay module online from

As I had this module in my workbench I have decided to use it for this project.  Obviously you can use any other module or relay you want. In any case I really suggest to be sure to add the protection diode in order to avoid "surprises" with your raspberry. With no protection diode you can burn the GPIO line of your raspberry.

I have made the wiring as follow:

white wire ->  pin - of the module
green wire   ->  pin + of the module
yellow wire   ->  pin S of the module

Merely for assembly issues into the junction box I have used 3 pairs of wires. This way I have a longer wiring and an easier routing inside the box.
This is essentially needed as with short wires the connection to GPIO of raspberry is quite unstable. On the contrary with longer cables the connection to GPIO pins is more solid and stable.

I have then wired the wires from raspberry with the wires from relay module using a small "mammut" as shown in the picture below

This is obviously optional. Everyone can decide whether do it or not in this way.

Step 5: Fitting everything in the box

At this stage the wiring process is over. The relay module is properly connected to the raspberry. Now we only need to assemble and fit all the component inside the junction box.

I have fixed the raspberry to the screw previously added to the box. Make sure the glue is solid (I have applied it twice :) )

Now I have connected the  Netgear WNCE2001  to an available USB port to get power and to the ethernet port of the raspberry.
This way I have a stable and fast connectivity to my wifi network.

The wifi dingle I had was not reliable enough for a stable wifi connection.

As always the reader is free to select a different mechanism to gain network connectivity (wifi, wires, ...). Important is to get access to the Internet.

Now is the time to set in place the relay module.
In order to continue I had used a small trick to gain additional space in my junction box.
I have added a thin plexiglass layer on top of the raspberry and I have fix it to the only available screw in this project.

This way I have created a new empty layer on which I can position the relay module which it is also fixed to the same screw as before.

Step 6: Wiring to the heater and box closing

We have now reached the final stage.

  • Insert the SD card with Raspbian OS and custom control software
  • Plug of power cable
  • Wiring to the existing heating system circuit according to final circuit diagram

Now I have applied the cover of the junction box and fixed the screws.

If needed or preferred you can apply some sealant material to the slots. I have not done this as I am lazy :) and especially as my heater room is completely dry.

Obviously in the future (never :) ) I will apply some insulating tape to the blue and brown wire. In the end I am not very interested in the electrical part of this portion. The fun is with the control software....


Possible improvements that I have in mind for the future:

  • replacing the Netgear wifi module with a smaller USB wifi dongle which is properly working
  • replacing raspberry with model A+. smaller sizes and lower power consumption
  • replacing the junction box with a smaller one
  • replacing raspberry with arduino and RF receiver. This will reduce the cost of this project


In this post Controllo remoto per caldaia e raspberry I have described the control software for the raspberry server and for the client of this project.


I have had a lot of fun with this small home project. With just few Euro I now have a system which allows me to remotely control my home heating system in a way which is much more flexible than the legacy on the wall thermostat.

Obviously I could have found existing solution on the market and paid an higher price for it. However I would have missed the fun and the learning experience

Anyone which has improvements or new ideas for this project is welcome to share them. I will be more than happy to add it to my project.

Nessun commento:

Posta un commento