Hi there,
I was looking for a way to control Livolo wireless switches. Seller only told me it was a 433.92 MHz thing, but wonderful RC-Switch wouldn't read them. I'm not a programmer, so I had to use the most simple approach. That is record command with Audacity, figure out pattern and pulses length, and hardcode it for Arduino.
In case you have the same switches, feel free to use this code to control them. Hardcoded are 11 buttons (0 to 9 plus All off). As Livolo switches are learning, they should be programmable with this commands. Just put switch into learning mode and transmit command you wish.
================================
IMPORTANT UPDATE
Code below is outdated and now it is a mere demo of what I've been through.
As of 25.10.2013 code avaliable as a library.
Find latest version of Livolo switch library attached.
================================
LIVOLO REMOTE RECEIVER FOR ARDUINO
http://forum.arduino.cc/index.php?topic=153525.msg1560970#msg1560970
Thanks, daleldalel!
LIVOLO REMOTE RECEIVER AND TRANSMITTER FOR RASPBERRY PI
http://forum.arduino.cc/index.php?topic=153525.msg1537781#msg1537781
Thanks, platenspeler!
================================
int txPin = 9; // pin connected to RF transmitter
int i; // counter to send command pulses
int pulse; // count pulse repetitions
int incomingByte = 0; // for incoming serial data
// hard coded commands (see txButton): 1 - pulse start, 2 - zero, 3 - one, 4 - pause, 5 - low
int button1[45]={44, 1, 2, 4, 2, 4, 2, 4, 3, 5, 2, 4, 2, 4, 3, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2};
int button2[43]={43, 1, 2, 4, 2, 4, 2, 4, 3, 5, 2, 4, 2, 4, 3, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 5, 3, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2};
int button3[41]={40, 1, 2, 4, 2, 4, 2, 4, 3, 5, 2, 4, 2, 4, 3, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 5, 3, 5, 3, 4, 2, 4, 2, 4, 2};
int button4[43]={42, 1, 2, 4, 2, 4, 2, 4, 3, 5, 2, 4, 2, 4, 3,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
void setup () {
pinMode(txPin, OUTPUT);
Serial.begin(9600);
Serial.println("Number = button; a to press 0; b to shut off all");
}
void loop(){
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
switch(incomingByte) {
case 49:
txButton(button1);
Serial.println("Switching on 1");
break;
case 50:
txButton(button2);
Serial.println("Switching on 2");
break;
case 51:
txButton(button3);
Serial.println("Switching on 3");
break;
case 52:
txButton(button4);
Serial.println("Switching on 4");
break;
case 53:
txButton(button5);
Serial.println("Switching on 5");
break;
case 54:
txButton(button6);
Serial.println("Switching on 6");
break;
case 55:
txButton(button7);
Serial.println("Switching on 7");
break;
case 56:
txButton(button8);
Serial.println("Switching on 8");
break;
case 57:
txButton(button9);
Serial.println("Switching on 9");
break;
case 97:
txButton(button10);
Serial.println("Switching on 0");
break;
case 98:
txButton(button11);
Serial.println("Switching All off");
break;
}
} // end if serial available
}// end void loop
// transmit command. Due to transmitter (or something, I don't know) transmission code should be INVERTED. Ex: one is coded as LOW-delay->HIGH instead of HIGH-delay-LOW
void txButton(int cmd[]) {
Serial.print("Processing. Array size is ");
Serial.println(cmd[0]);
digitalWrite(txPin, HIGH); // not sure if its required, just an attempt to start transmission to enable AGC of the receiver
delay(1000);
for (pulse= 0; pulse <= 100; pulse=pulse+1) { // repeat command 100 times
for (i = 1; i < cmd[0]+1; i = i + 1) { // transmit command
switch(cmd[i]) {
case 1: // start
digitalWrite(txPin, HIGH);
delayMicroseconds(550);
digitalWrite(txPin, LOW);
// Serial.print("s");
break;
case 2: // "zero", that is short high spike
digitalWrite(txPin, LOW);
delayMicroseconds(110);
digitalWrite(txPin, HIGH);
// Serial.print("0");
break;
case 3: // "one", that is long high spike
digitalWrite(txPin, LOW);
delayMicroseconds(303);
digitalWrite(txPin, HIGH);
// Serial.print("1");
break;
case 4: // pause, that is short low spike
digitalWrite(txPin, HIGH);
delayMicroseconds(110);
digitalWrite(txPin, LOW);
// Serial.print("p");
break;
case 5: // low, that is long low spike
digitalWrite(txPin, HIGH);
delayMicroseconds(290);
digitalWrite(txPin, LOW);
// Serial.print("l");
break;
}
}
}
}
Parts used: Arduino Uno, OOK/ASK transmitter/receiver, simple circuit to record signals on PC, Audacity, Livolo wireless switches.
Special thanks to Nethomeserver author, RC-Switch author and all that good people who were hacking wireless remotes and shared their findings and ideas.
Livolo.zip (3.34 KB)