Closed bsecker closed 5 years ago
Hi bsecker,
Unfortunately, it's been a long time since I solved this problem, so my memory of the details is quite hazy. I'm using the same units, also from Bunnings in NZ, and they continue to work well.
I do remember that I had a lot of trouble getting this to work initially, and needed help from the original developer of the rc-switch project to get it working. I don't recall ever 100% understanding how he managed to come up with the codes that he did.
These switches don't appear to be fully supported by the rc-switch library, as you can see from Martin-Laclaustra's reply to my attempt at a pull request. This is why I created the library I have here.
I've translated the images above from your transmitter into binary and it appears to be: A on: 0011100001001100000011100111110100 A off: 0011100001001100000011110111110000
This is definitely different to my set of switches, but is similar enough that we may be able to decode it and alter the code to work with yours.
If you have a look at the bottom of the readme, I show how I broke the codes up into sections. Could you please press all the buttons on your remote and run them through the analysis tool, posting the binary output here?
sure.
A ON 0011100001001100000011110111110000
A OFF 0011100001001100000011100111110100
B ON 0011100001001100000011010111111100
B OFF 0011100001001100000011000111111000
C ON 0011100001001100000010110111100000
C OFF 0011100001001100000010100111100100
D ON 0011100001001100000001110111010000
D OFF 0011100001001100000001100111010100
ALL ON 0011100001001100000001000111011000
ALL OFF 0011100001001100000010000111101000
I made an attempt at splitting the codes up by the repeating parts:
BUTTON CODE ID ON 0111 ID?? ? ?
A ON 00111000010011000000 111 1 0111 1100 0 0
A OFF 00111000010011000000 111 0 0111 1101 0 0
B ON 00111000010011000000 110 1 0111 1111 0 0
B OFF 00111000010011000000 110 0 0111 1110 0 0
C ON 00111000010011000000 101 1 0111 1000 0 0
C OFF 00111000010011000000 101 0 0111 1001 0 0
D ON 00111000010011000000 011 1 0111 0100 0 0
D OFF 00111000010011000000 011 0 0111 0101 0 0
ALL ON 00111000010011000000 010 0 0111 0110 0 0
ALL OFF 00111000010011000000 100 0 0111 1010 0 0
Not sure how useful that is - The third to last column seems to repeat the first two bits from the ID but then I can't figure what the other two bits are.
The protocol looks a little different to the one used by my switches, but it's similar enough that it shouldn't be too difficult to modify the code to work with it. A pattern that I noticed in the column you've headed up ID??
is that the third bit of the ID appears to be inverted. The fourth bit of the ID??
column appears to be the same as the ON
bit, but inverted IF the third bit of the ID is 1.
Some examples:
Third bit of ID is 1. Note that the third bit of ID2 is inverted, as is ON2:
ID ON ID2 ON2
111 1 110 0
Third bit of ID is 0. Note that the third bit of ID2 is inverted, and ON2 is the same as ON:
ID ON ID2 ON2
110 1 111 1
Do you think you'd be able to modify ArlecRC210Switch.cpp
to try this out? I could have a try, but it would be difficult to confirm if I've got it right without the physical switches.
I got it to simply repeat the saved code to turn on switch A by modifying the .cpp code as shown:
// A = Fixed bit stream.
// B = Switch ID.
// C = on = 1, off = 0.
// D = Always 1001.
// E = Same as B.
// F = Inverse of C.
// G = 0.
// 0 1 2 3
// 012345678901234567890123456789012
// AAAAAAAAAAAAAAAAAAAABBBCDDDDEEEFG
char code[] = "001110000100110000000100011101100";
// writeBinary(switchId, &code[20]);
// writeBinary(switchId, &code[28]);
// code[23] = on ? '1' : '0';
// code[31] = on ? '0' : '1';
for(int i = 0; i != timesToSend; ++i) {
sendArlecFrame(code);
}
My spare time is limited due to uni starting up again so going to hard-code the RF transmitter codes in for now - at least the rest of the library works. I'd imagine we'd need to get another set of outlets and see how different their transmitter codes are to be able to write some generic script to handle all cases.
Nice work. Maybe if someone else runs into the same problem, we'll be able to figure out how to make it more generic. For now, I'm glad you're up and running!
Hey dude, thanks for the library.
I was wondering if you could give me a hand - I've been trying for days but to no avail. I can get the transmitter sending the code to turn a switch on (example sketch in the readme), and with a receiver on another arduino loaded with the rc-switch receive demo I get this:
And it doesn't change the state of any of the power outlets (the remote does though).
Interestingly enough if I turn the arduino transmitter off and just listen for the codes from the remote itself it doesn't get picked up by the receiver demo.
I followed a bit of this page on the rc-swich wiki, and putting the output from the remote into this I get this output:
where the top is A ON, the bottom is A OFF. I'm confused at where to go for the rest of that tutorial.
Do you have any tips where to go from here? Is it possible that the pattern at the beginning of the code (ie
01110110110110000000 111 1 1001 111 0 0
) is different for the units I bought? I got the three pack from bunnings in NZ.