Control HE830S switches using only an Arduino and RF Module

15 replies [Last post]
garymscott
Offline
Joined: 13 Jan 2014

Hello,

Has anyone on this forum managed to control the HE830S switches using just an Arduino and RF transmitter?

I have a set of the HE830S switches, controlled by an HE300 remote, which I picked up from B&Q. I would like to be able to control the switches using an Arduino Uno and and a 433MHz RF transmitter (link to the transmitter / receiver set I am using).

I know most people on this forum will be using the modified router to control their switches but after reading some of the forum pages on other people who have the HE830S switches, it seems like the members of this forum have a good degree of technical knowledge on the rf codes/transmission packet sequences used to control these devices. 

What I have tried so far:

I have logged the output of the remote using the rcswitch library for the Arduino, plus used the receiver code on the Arduino Playground Home Easy page to establish my remote control code but I can't successfully transmit and control the HE830S switches using either the rcswitch send code or the Arduino Playground Home Easy transmit scripts. I know the rf transmitter and receiver pair are working as I can send information between them using the rcswitch code (and see the results on the Arduino serial monitor).

Unfortunately my understanding of the remote control's raw data captured by the rcswitch code is limited and I'm not sure how to convert it into a successful transmit package to control the HE830S switches. If anyone could provide any guidance or sample Arduino code I would be most grateful!

allanayr
Offline
Ayr, United Kingdom
Joined: 25 Sep 2011
Quick off-the-top-of-my-head reply

I think that the output from the rcswitch demo gives the raw timings for the code that has been received listed as Raw Data i.e:

Decimal: 11850401 (24Bit) Binary: 101101001101001010100001 Tri-State: not applicable PulseLength: 310 microseconds Protocol: 1
Raw data: 9644,912,336,284,956,908,336,896,344,280,960,900,344,280,976,272,960,900,344,896,352,268,972,888,352,268,980,272,972,880,360,256,1012,264,24,24,68,396,460,12,964,280,956,284,956,292,948,904,336,

Decimal: 11850406 (24Bit) Binary: 101101001101001010100110 Tri-State: not applicable PulseLength: 308 microseconds Protocol: 1
Raw data: 9584,920,316,300,940,912,328,908,328,292,948,908,332,288,948,300,944,912,324,912,336,284,952,912,332,288,960,292,956,900,336,288,964,892,340,280,964,896,336,280,944,296,936,912,328,908,332,284,944,

 I think the basic idea is to get your arduino to emulate these and then "learn" them into the socket.

 

In it's simplest form that would be something like:

 

digitalWrite(txPin, HIGH);
delayMicroseconds(920);
digitalWrite(txPin, LOW);
delayMicroseconds(316);
digitalWrite(txPin, HIGH);
delayMicroseconds(300);
digitalWrite(txPin, LOW);
delayMicroseconds(940);
digitalWrite(txPin, HIGH);
delayMicroseconds(912);

etc

 where your transmitter is connected to txPin.

I haven't actually done this though so I don't have any working examples.

 

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
The HAH sketch

The micro on the HAH PCB runs a sketch that, amongst other things, implements a command that takes an ASCII encoded string of RF data (as detailed in the wiki) and pumps out the bits to the RF Tx module.

The command in question is 'URF'. 

Read the sketch at

https://code.google.com/p/livebox-hah/source/browse/trunk/userapps/arduino/liveboxHAH/liveboxHAH.ino

This might help get you going.

AndrewJ
Offline
United Kingdom
Joined: 22 Nov 2012
.

Hi Gary,

 

Also to add to this, it probably doesnt need to be said but make sure the HE830S is in learning mode before you send a packet.

 

thanks

 

Andrew

garymscott
Offline
Joined: 13 Jan 2014
Thanks Allan that explanation

Thanks Allan that explanation was very helpful. I now understand what the raw data means! I'll start by constructing some packets in the manner you have suggested and see how I get on.

garymscott
Offline
Joined: 13 Jan 2014
Derek, cheers for the link to

Derek, cheers for the link to the code - I'll have a play and see if I can get the urf command up and running.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
You could try the URFRX

You could try the URFRX module this is pretty useful for automatically figure it out for you.
Its similar to what you where using for getting RAW data.

With the added benefit that you can graph and SEE what this RF pulse stream looks like.

Brett

garymscott
Offline
Joined: 13 Jan 2014
Hi Brett,Thanks for the

Hi Brett,

Thanks for the suggestion, it would be great to get a visual representation of the rf data. I downloaded the URFRX library and sketch which uploaded to my Arduino Uno ok but the serial monitor only seems to display a corrupt character and doesn't seem to respond to any button on my HE300 remote. I changed the serial port rate to 9600 in the sketch and the monitor now correctly displays "Starting..." but still doesn't display any data on pressing the remote's buttons. I have the receiver set up on pin 4 as specified in the sketch. Do you or anyone else have any idea what I am doing wrong?

Thanks

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Strange behaviour with baud rate

If you don't see the 'Starting...' prompt when running at 57600 baud, something is wrong. Check the xtal on your board ... if it's not (at least) 16MHz, you will probably struggle with this code.

Check http://www.wormfood.net/avrbaudcalc.php - this shows why we use a 7.3728MHz xtal on the HAH PCB.

garymscott
Offline
Joined: 13 Jan 2014
I've checked and the Arduino

I've checked and the Arduino board runs at 16MHz - I didn't realise I had to also select the correct baud rate in the serial monitor window. I have now corrected this to 57600 baud and now see the "starting..." text but the remote button presses are still not being picked up :( 

garymscott
Offline
Joined: 13 Jan 2014
Interestingly, the rcswitch

Interestingly, the rcswitch send demo running on an another arduino connected to the 433mhz transmitter is successfully being captured by the rfrx receiver script, but button presses on the he300 remote aren't.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
The URFRX code needs at least

The URFRX code needs at least a 10ms as the inter pulse gap before kicking it.  Its possible that the gap is shorter which is defeating the detection logic.   You could try reducing the gap in the code down to say 5ms.   Do make sure you have wired correctly as well Digital PIN 4 is the data pin (by default).

http://livebox-hah.googlecode.com/svn/trunk/userapps/arduino/libraries/R...

Where is says 10000uS reduce to 5000uS

Brett

garymscott
Offline
Joined: 13 Jan 2014
Thanks Brett. I had a play

Thanks Brett. I had a play this morning and found that holding a button on the remote control for about 5-7 seconds resulted in the URFRX code detecting the signal!

The code I received was:

-10272,176,-2656,176,-320,176,-1360,160,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-320,192,-1344,176,-336,160,-1360,176,-320,176,-1360,176,-320,176,-1360,176,-1344,160,-336,192,-1328,176,-336,176,-336,176,-1344,176,-1344,176,-336,176,-336,176,-1344,176,-1344,176,-336,176,-1328,176,-368,160,-1328,176,-352,176,-1344,160,-352,176,-1328,176,-336,176,-336,176,-1360,160,-1344,176,-336,176,-1344,176,-336,176,-336,176,-1344,176,-336,176,-1344,176,-320,176,-1376,160,-1344,160,-352,176,-320,176,-1344,192,-320,176,-1344,176,-352,160,-1344,176,-1344,176,-336,176,-10016

The pulse definition plotter seems to chart the code ok!

I'm now trying to write a script to transmit this code. I'm not sure at the moment whether I need to send the entire sequence in a few bursts, or whether there are a couple of latches (-10272 & -2656) which need to fire once and then the rest of the sequence repeats for a few bursts from 176 onwards....time to experiment!

 

garymscott
Offline
Joined: 13 Jan 2014
Brett you were absolutely

Brett you were absolutely right - I reduced the pulse gap and it now picks the rf sequence up straight away. Strangely though each press of the button results in 2 lines of sequences in the serial monitor:

-10240,192,-2624,192,-320,176,-1344,176,-320,192,-1344,176,-320,176,-1344,192,-304,192,-1344,176,-336,176,-1344,176,-320,176,-1344,176,-320,192,-1328,192,-320,192,-1328,192,-320,176,-1344,176,-320,192,-1344,176,-320,176,-1344,176,-1328,192,-320,192,-1328,176,-336,192,-320,176,-1344,176,-1328,192,-336,176,-320,176,-1344,176,-1328,192,-336,176,-1328,176,-336,192,-1328,176,-336,176,-1328,176,-352,176,-1312,192,-336,176,-320,192,-1328,192,-1328,176,-336,176,-1328,192,-320,192,-320,192,-1328,192,-320,176,-1344,176,-336,176,-1328,192,-320,176,-1360,176,-320,176,-1360,160,-320,192,-1328,192,-320,176,-1328,192,-1328,192,-320,192,-8016

-9680,304,-928,880,-368,320,-912,880,-368,320,-912,880,-368,320,-928,304,-928,320,-912,880,-384,304,-928,864,-384,304,-928,304,-928,320,-912,880,-384,304,-912,320,-928,320,-912,880,-384,304,-928,864,-384,304,-928,304,-944,304,-8016

God knows what's going on there.

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Some of the remotes send new

Some of the remotes send new and old pulse streams so they will work with a variety of receivers.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
With a little bit of

With a little bit of adjustment the pulse stream looks like this.  I've just normalized the high values to be consistent so it will pack better.

-10272,176,-2656,176,-320,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-336,176,-1344,176,-320,192,-1344,176,-336,176,-1344,176,-320,176,-1344,176,-320,176,-1344,176,-1344,176,-336,192,-1344,176,-336,176,-336,176,-1344,176,-1344,176,-336,176,-336,176,-1344,176,-1344,176,-336,176,-1344,176,-368,176,-1344,176,-352,176,-1344,176,-352,176,-1344,176,-336,176,-336,176,-1344,176,-1344,176,-336,176,-1344,176,-336,176,-336,176,-1344,176,-336,176,-1344,176,-320,176,-1344,176,-1344,176,-352,176,-320,176,-1344,176,-320,176,-1344,176,-352,176,-1344,176,-1344,176,-336,176,-10016

If you then plug that into the "Pulse train to URF converter"
http://www.dbzoo.com/public/pulseTrainToURF.html

It nicely converts to a packed URF string.   Replace the bustcount with 10, and the interburst delay to 10000us and repack and I would give that a go.

Brett

Hardware Info