Boiler control using URF

26 replies [Last post]
allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011

I don't know if this will be useful to anyone else but I have for some time been interested in using the HAH to control my central heating boiler via a Drayton Digistat RF2 wireless boiler thermostat. I hope to be able to more closely control gas usage by doing so.
 
I posted a question about using URF to send the boiler on and off codes some time ago and Brett gave a tutorial on the procedure for encoding the pulses into the URF output. Unfortunately I could never get it to work and was uncertain whether I would be able to achieve what was required.
 
The problem, it turns out, was that I was not using the right code because the Digistat transmitters have different ID's and I had gleaned the code from a source on the internet. Not being the possessor of such a thing as an osilloscope I was at a loss as to how to find the codes from my own transmitter. The solution which I reached was to buy a cheap 433 mhz receiver which I linked to an audio cable with a couple of 10k resistors in the lines. I was then able to grab the output of the receiver using the audio manipulation software "Audacity" (available as a free download) by connecting the audio cable to the line-in socket of my computer. The RF bursts are then able to be viewed as "osilloscope-like" traces and the pulse lengths measured for translation into the URF helper.
 
Happily by following Brett's tutorial I now have my central heating boiler under the control of the HAH using a simple lua script to sample temperatures and send the appropriate signals to the boiler. Another triumph for the HAH! 
 
If anyone is interested I can post the Digistat codes (bearing in mind that the may be different on your system) and the lua script (which is fairly simple).

Unfortunately due to a massive C*ck up by my telephone provider I have been without phone or broadband for a couple of weeks now. It's not looking good for an early resolution Grrrrrrrrrrrr!  

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
Fantastic solution!  Well

Fantastic solution!  Well done, I love Audacity and use it regularly, I read of something like this on Hackaday, and it's great to see such a solution being used to solve a problem like this.  Thanks for sharing.

mike6
Offline
United Kingdom
Joined: 1 Mar 2011
Draytton Boiler Control

I would be very interested to see your script and codes. I have had it in mind to tackle this for sometime now but have struggled to find a way to see the codes from the thermostat. Looked at using a germanium crystal receiver connected to the parallel port of an old laptop but could never get it to work properly. 

So some help would be very encouraging.

 

Thanks

 

Mike

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Codes

Mike
 
Glad I can be of help (hopefully)
 
Here's what I got from the output of the thermostat radio bursts:
 
Off Burst
10 10 10 10 10 10 1100 100 10 110 100 1100 10 10 1100 10 10 10 10 10 10 10 10 10 1100 10 1100 10 1100
 
On Burst
10 10 10 10 10 10 1100 100 10 110 100 1100 10 10 1100 10 10 10 10 1100 10 10 10 10 1100 1100 10 1100
 
Using Brett's tutorial this is how I constructed the stream using the URF helper:
 
Use 2 bit encondig with the following timings because each "on" or "off" is about 500 millisecs
0 493 493
1 986 986
2 493 986
3 986 493
(I believe that they need to be slightly shorter to compensate for the 7 mhz crystal :-(
 
Allocating each frame to break at a 0 to 1 transition.
So the off burst has the following frames:
0  0  0  0  0  0  1    2   0  3   2   1     0  0  1    0  0  0  0  0  0  0  0  0  1    0  1    0  1 (29 frames)
and the On burst
0  0  0  0  0  0  1    2   0  3   2    1    0  0  1    0  0  0  0  1    0  0  0  0  1    1    0  1 (28 frames)
 
The transmitter sends 3 bursts with about 1.2 second interburst delay.
 
Putting the information through the URF helper gave the following outputs:
 
Off
010201ED01ED03DA03DA01ED03DA03DA01ED03012EE01D0006390400004440
 
On
010201ED01ED03DA03DA01ED03DA03DA01ED03012EE01C00063904010051
 
For Audacity I set the sampling rate to 48000 khz and mono. For some reason the output shows the  1's as down deflections and the 0's as up deflections, but it is faily easy to measure the on and off pulses if you zoom in on the burst output.
 
I had a problem initially as the boiler shuts down and goes into alarm mode if it doesn't get contact with the sender for more than about 10 minutes so as you'll see from the script the code is sent every time the update process is run. (Every minute in my case)
 
It's early days at the moment but the script and codes have been successfully controlling my boiler for 3 days now.
 
 

AttachmentSize
boilercontrolApplet.lua 3.74 KB
garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Alan,Thanks for this write up

Alan,

Thanks for this write up on how to use audacity to hack RF codes, this will no doubt help others to open up the RF capability, myself included.

 

For info, I also control my heating with HAH but I dont have a fancy drayton controller so have "made" one using a butchered RF socket (I know! its a bodge job but it works :) )

However, I have approached to LUA control aspect a little differently and thought I would share as it might give some ideas that may make your system more "programmable".

I modified the AliasApplet.lua script of Brett's to acceot two more alias messages, these are "Thermostat X" and "Heating" where X is the thermostat value required in degrees c.

If a "thermostat x" alias message is sent (ie thermostat 18) then the value 18 is writen to a file on the HAH.

if a "heating" alias message is sent, then the script first checks current house temp is below the thermostat value stored in the file and then checks current heating condition. If boiler is off and temp too low then the heating comes on.

Once temp if above thermostat value the heating goes off.

To glue this together I use the cron scheduler to send heating alias messages every minute during the required heating times. Cron also sends alias messages throughout the day to change the thermostat values for morning, day, evening and night settings.

the benefit of this approach is that this can all be programmed via Cron file (which can be done remotely) and in addition, one off adjustments can be made easily using google cal to send the required alias message or if you have an APP such as mote, your smartphone can send the alias messages to change thermostat or boost the heating for an hour etc.

Like I say its just another way to approach this.

I am away from home now so cant send code snippets, but if people are interested in this approach I will post up later this week.

 

Cheers,

 

Garry

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Dual control question

When my new boiler was fitted, I specified that a Drayton RF be used. I like the idea of having the HAH control the boiler ... but SWMBO won't be wanting to give up her nice Drayton thermostat.

As I understand it, the drayton receiver must be paired with the Thermostat. This give us the worry that if I pair the HAH with the Drayton receiver, the original thermostat will become redundant (and as a result, SWMBO is not happy).

I had a cunning plan to capture the actual RF Transmission from the (already paired) Drayton setup and program the HAH to emulate this. Clearly, dual control of this sort is only good as an 'override'.

So, the question is ... did you have to 'pair' the HAH to the Drayton receiver to get it workign in the 1st place (or does the one receiver pair with/respond to a number of thermostats)?

Derek

p.s. Nice to see good work on decoding more 'stuff'.

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Dual control

The ID of the sender unit is encoded into the pulse stream from what I can gather. I therefore did what you are suggesting and captured the output of an already paired controller. I didn't have to pair the HAH because the receiver unit believes that it is the sender unit that is sending the data because the pulse stream contains the sender unit ID.

 

I've switched off the Drayton sender unit (SWMBO not particularly happy but I'm calling it a trial at the moment) so there is no dual control, in fact dual control would be a problem because conflicting codes may be sent by the different units.

 

What I haven't done yet is to stop the HAH sending codes and see if the original thermostat will just take over again when I switch it back on (fingers are crossed) I'll have a go soon and let you know.

 

Edit. Great news. Just stopped the HAH control and switched back on the Drayton thermostat and it took over again without a problem.

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Yes I'd be interested

Garry

 

Yes I'd love to see your script. I'm aware that mine is a bit simplistic and has little flexibility for others in the house though it is very easy for me to alter it.

 

If anyone can tell me the command for restarting the plugboard and save me having to reboot the box every time I edit the script then I'd be very grateful.

 

Allan

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Try this

/etc/init.d/xap restart plugboard

 

Cheers Garry

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
Hardware for hacking the urf codes

I have 2 433 MHz things i want to "decode" my new watchman on my oil tank and a hurstman thermostat.

 

so what cheap 433MHz receiver did you use?

could i use my ham rig do you reckon? but are the receivers not fairly cheap? sub £5

 

dean

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Receiver

Fleabay item number 280810335072

comes as a pair tx and rx but I think the receivers are available seperately.
Just stuck the rx into a breadboard with 10k resistors between the GND and DATA line then plugged the audio cable into the line-in socket. I used an arduino to provide the 5V power and just fired the transmitter at it. 
allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Give it a go

I'd definitely give it a go with the ham rig. If you can connect the audio out to the line in on your computer and fire the transmitter then record the output into audacity.

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
I have an idea

what do you all think of following idea.

 

decode a standard TX (status) then use the decode on the HAH so you could use either std remote or hah to switch lights on/off so "if" HAH fails yuo can still switch lights on/off

 

SWMBO stays happy ish

 

what do others think (is it a goer???)

g7pkf
Offline
United Kingdom
Joined: 11 Jan 2011
I dont know if i can

bring myself to use a £500 rig to decode a 433MHz signal.

 

for £5 i can set up a dedicated system. why did you use an arduino to just power the receiver why not a 7805?

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Because I'm not a hardware man

I used an arduino because I needed 5V to power the receiver and not being a hardware sort of person it seemed to be the handiest way of powering the setup. I'm sure that many of you guys can think of much better ways to do these things. For me it just worked so I went with it!

P.S. I'm not even sure what a 7805 is :-(

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Seems like a plan

In a sense that's what happens with the newer Lidl sockets. Becuase they seem to be able to retain more than one code, the HAH and the remote controller can both be used on the same device. Having said that, I thought that the whole purpose of the URF was that the HAH emulated the codes from the remote controllers and therefore could be use instead of/as well as the original controller.

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
The older lidl ones are the same

I use the older lidl sockets with the wiki codes and can still use the remote. You're right though Dean, it does keep SHMBO happy(ish!)

AlexS
Offline
United Kingdom
Joined: 5 Dec 2011
not wanting to post a 'me

not wanting to post a 'me too' but maybe this will be helpful.

 

I combined a usb sound card (£1.40) with microphone in. plus a 433 mhz rx £3.99 drove the receiver off the 5v usb, the rf has 12v max. so <£10 receiver.

A couple or resistors & capacitors a spare box it seems to work. Have put a changeover switch so I can add IR receiver as well.

circuit from here:

http://wiki.nethome.nu/doku.php/analyzer/hardware

seems to work so far. Nice self contained and doesn't require line in on your PC.

used the analyzer software doesn't work too well on 64bit you have to find the 64 bit libraries.

still playing with it but might help.

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Ive had a go..quick question

Thanks Guys, i've knocked up a quick decoder circuit using the suggestions here and can see the pulses being received in Audacity and the protocol analyser downloaded from wiki.nethome.nu but I am getting ALOT of noise making it difficult to see where the code starts and noise ends.

Do you guys have this problem?? I also am powering the receiver of batteries, could this be the cause?

sorry for my ignorant questions but my electronics is not great but I'm enjoying playing!!.

cheers for any advice

 

Garry

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Noisy is normal

Garry,

It's normal to see a good deal of noise. The receivers seem to hunt for most anything that they can grab onto. However, when a decent signal is found, you should see a definite pattern appear.

Battery powered is fine. Just keep the receiver away from PCs/lappys/screens. An external antenna (like the ones in the shop) make this easier. Also, if you have other sources of 433MHz transmissions, try to temporarily disable these.

I do prefer to put a 'scope on the Tx pin of whatever is sending the signal ... but the 'general purpose receiver' technique is definately workable ... with a bit of experimenting ... trial and error. 

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
I'm maybe just lucky

Perhaps I'm just lucky with my setup but I get relatively little noise on my Audacity output.Th images below show a screen grab of the RF2 pulse as captured and also of the receiver setup, just a prototyping board with the components and a mono audio cable.

 

Rx on breadboard

Audacity output for RF2 pulse

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Changing transmitters

Just for information I have now seamlessly swapped between the RF2 thermostat and the HAH box a couple of times. I'm careful to ensure that the boiler is in the correct state before I do the switch but it seems to work pretty faultlessly. The boiler is unaware of which device is sending the data because it contains the correct unit ID. I think that it is important to have EITHER the HAH or the RF2, never both!

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Danfoss TP4000

My wireless stat was always a bit poor at controlling the boiler. It is supposed to have a range of 30metres but struggles to control the boiler from 5m away :) I think I have lead lined walls in this house.

Since setting up the HAH the wireless stat doesn't work at all so looks like I will going down this route too :)

Thanks for the write up

elyobelyob
Offline
United Kingdom
Joined: 17 Jul 2012
Explain how to deal with data

I am not exactly sure whether my attempts to create this Audiacity listener have worked .. if so, could someone explain how I get the data from these files? I have attach a link to one of my attempts.

EDIT: deleted it .. just realised, now that Allan suggested listening to one of his, that mine was just recording me and not the Arduino .. oops

Thanks

p.s. would love to take control of my boiler *this* winter!

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Had a listen

OK I've had a listen to the audacity file it sounds like it is a recording from a microphone rather than a 433mhz rx attached to a line-in socket. (It sounds like there is breathing in the background)

I'm not sure how you are capturing the RF output to record it into audacity but the actual burst is quite short and consists of three separate pulses.

I don't know if this is also an issue but I used a recording rate of 48000 as opposed to your 44100 khz.

Do you hear the burst on your receiver when it happens? I should happen regularly at about a four minute interval if you are using the Drayton RF2. Are you using a rx setup similar to the one which I described above or something else?


elyobelyob
Offline
United Kingdom
Joined: 17 Jul 2012
  Woops, yes .. that was

 

 

Woops, yes .. that was correct .. I thought those small spikes were the signals .. seems it was me playing with the remote .. 

Will have another try soon! Also, interested in knowing where Brett's tutorial is for encoding the pulses into the URF output?

 

Thanks

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Also

In addition to the stuff on the wiki also see here:

http://www.homeautomationhub.com/content/rf-output-format

 

for a Brett tutorial

 

Hardware Info