Saturday, 28 September 2013

Work in Progress: Controlling Drayton/British Gas boilers using a Raspberry Pi and a 433MHz sender:

I've been playing with 433MHz senders/receivers recently. See here for mains control. I got asked to build a system to first of all sniff the packets that a Drayton wireless thermostat sends to the boiler to switch it on or off and then hopefully to replicate this using a Raspberry Pi. British Gas use the same Rebranded Wireless Sender/Receiver.

The equipment used for recording the packets was a simple 433MHz receiver to Line in. Make sure you use line in - it will blow up Mic:

The boiler sends a packet train 3 times with a 1.5 second delay between each packet train. The below screenshot shows 4 traces recorded and Analysed in Audacity.

 The top trace is the ON packet train recorded from the boiler. The next trace down is the replicated ON packet train made using a Raspberry Pi and a £25 433MHz sender board.

 The third trace down is the OFF packet train recorded from the boiler and the final trace is the OFF packet train made using the Raspberry Pi.

The Thermostat sends 3 packet trains with a 1.5 second gap between each train. It does this every 4 minutes to ensure that the boiler doesn't switch off. If the receiver doesn't receive a packet from the Thermostat after 5 minutes it switches off whether it was previously ON or OFF. If we wish for the boiler to stay on longer than 5 minutes, it is necessary to send a packet train every 4 minutes to make sure the boiler stays ON.

Even if the Thermostat is set to OFF, it still sends a check in every 4 minutes to keep the receiver attached to the boiler happy.

The C-code which makes the Raspberry Pi send the traces is published here. It also includes all the plug socket work done for dbtech and homeeasy products:

Look for the heating.c and heating binary. The syntax is:

pi@raspberrypi ~ $ sudo ./heating on
pi@raspberrypi ~ $ sudo ./heating off

Next steps are to work on making the Pi into a Thermostat and automating the every 4 minute packet trains.

No comments: