Heating controller with multi zone scheduling

This guide details how to build a heating controller based on a raspberrypi a control node and a room temperature node. A heating scheduler interface is explored for providing multiple day heating profiles for different zones in a building.

Parts you will need:

  • EmonTH, room temperature and humidity
  • RaspberryPI
  • Relay node (in development)

Setting up the raspberry pi

Download the raspbian image and write to the SD card and Harddrive.


Once uploaded to the SD card, insert the SD card into the raspberrypi, powerup and then login with ssh username:pi, password: raspberry.

Install emoncms following the installing emoncms v8 on linux guide:


Install the add on modules: raspberrypi and packetgen

cd /var/www/emoncms/Modules
git clone https://github.com/emoncms/raspberrypi.git
git clone https://github.com/emoncms/packetgen.git
git clone https://github.com/emoncms/scheduler.git


Configuring scheduler

1) The first thing to do is set up the zones:

a) Open the scheduler interface file /var/www/emoncms/Modules/scheduler/scheduler_view.php.

b) Navigate to line 164:

var zones = ['Kitchen','Room1','Zone3','Zone4','hotwater'];

These are the names of the example zones, change these to the zone names you wish to have.

If your temperature feeds have the same names as the zone names, the scheduler interface will automatically pick up the temperature value and display it next to the zone name in the scheduler interface.

If there is a feed called outside, its value will also be picked up and displayed. The name of the outside feed to pick up can be set with: var outsidetempname = 'outside';

If your zone name's dont change you will need to force the interface to rewrite the configuration by setting: (line 160)

var overwritedb = false;


var overwritedb = true;

2) Run scheduler_run.php

Note: Its possible to set the position in the packet gen packet that the schedule variables get written too. The default position is to start at the 4th variable, to change it open scheduler_run.php and change the $start_variable = 4; at the top of the script

In a terminal window open cron:

$ sudo crontab -e

add this line:

* * * * * php /var/www/emoncms/Modules/scheduler/scheduler_run.php

Running the script via cron in this way will guarantee that the script restarts if it for any reason crashes and exits. Cron will try to run the script once every minute but the script has an inbuilt check to ensure that only one instance of the script runs at any given time.

3) Navigate to the PacketGen module in emoncms: Extras > RFM12b Packet Generator

You should now see the zone set points and zone states in the packetgen interface, the temperatures are multiplied by 100 so that they can be sent as 2 byte integers.



Things to do

  • Ensure that first heating period in a day cannot end later than the start of the second heating period.
  • Switch from defining time in hours and minutes to decimal time (ie hours:2, minutes:30 to time: 2.5), simpler to make time comparison.
  • Implement boost functionality: +1h, +2h
  • Implement changeable temperature targets.
  • Add set able off temperature
  • Configure how room temperatures are included in interface for each zone.