Arduino Forum

Topics => Home Automation and Networked Objects => Topic started by: spch on Mar 11, 2013, 08:20 am

Title: Control Livolo switches / Livolo switch library
Post by: spch on Mar 11, 2013, 08:20 am
Hi there,

I was looking for a way to control Livolo wireless switches (http://www.aliexpress.com/item/Christmas-Promotion-Wholesaler-Livolo-Free-Shipping-Luxury-Crystal-Glass-Switch-Wireless-Remote-Control-Light-Switch-VL/354984914.html?cn=null&PID=5374793&tp1=null&tracelog=null&src=ale&URL=http%253A%252F%252Fwww.aliexpress.com%252Fproduct-gs%252F354984914-Christmas-Promotion-Wholesaler-Livolo-Free-Shipping-Luxury-Crystal-Glass-Switch-Wireless-Remote-Control-Light-Switch-VL-wholesalers.html&cv=10975781&af=cj_5374793&vd=30). 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!

================================
Code: [Select]

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, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 5, 3, 4, 2, 4, 2, 4, 2};
int button5[43]={42, 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, 2, 4, 3, 4, 2, 4, 2, 4, 2, 4, 2};
int button6[43]={42, 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, 5, 3, 4, 2, 4, 2, 4, 2, 4, 2};
int button7[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, 4, 2, 5, 3, 4, 2, 4, 2};
int button8[43]={42, 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, 5, 3, 4, 2, 4, 2};
int button9[43]={42, 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, 2, 4, 2, 4, 3, 4, 2, 4, 2, 4, 2};
int button10[43]={42, 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, 5, 2, 4, 3, 4, 2, 4, 2, 4, 2};
int button11[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, 4, 2, 5, 2, 4, 3, 4, 2};

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 (http://www.aliexpress.com/snapshot/213429237.html), simple circuit to record signals on PC, Audacity, Livolo wireless switches.

Special thanks to Nethomeserver (http://wiki.nethome.nu/doku.php/start) author, RC-Switch (https://code.google.com/p/rc-switch/) author and all that good people who were hacking wireless remotes and shared their findings and ideas.
Title: Re: Control Livolo switches
Post by: AWOL on Mar 11, 2013, 08:40 am
Code: [Select]
int button1[45]={44,
RAM is a precious resource on an AVR.
You could easily halve your use of it for these tables (use "byte" instead of "int"), or eliminate it altogether (use PROGMEM)
Title: Re: Control Livolo switches
Post by: spch on Mar 11, 2013, 09:14 am
Thanks for the clue! I was sure, it is not a good code, but it was ok for me as long as it worked. I'll try it with PROGMEM first, and in case I fail, stick to "byte" type.


Code: [Select]
int button1[45]={44,
RAM is a precious resource on an AVR.
You could easily halve your use of it for these tables (use "byte" instead of "int"), or eliminate it altogether (use PROGMEM)
Title: Re: Control Livolo switches
Post by: Graeme_Evans on May 13, 2013, 03:17 am
dont suppose you have a guide to connecting the ook ask to the arduino?

I searched around but got a lot of unrelated topics when searching for arduino uno ask :P

also, thanks a bunch, if i get this working you've potentially saved me a lot of stressing and having to find an alternative to my nice new glass dimmer switches.

I'm also going to pass on your findings to rfxcom and see if theres any chance of them getting the livolo switches working  with the rfxtrx433
Title: Re: Control Livolo switches
Post by: phantom8 on May 24, 2013, 09:25 pm
spch, thanks a lot for sharing.  I've just purchased Livolo switches and am trying to control them from my computer.  Can you share the wiring diagrams of your project?  Thanks in advance for your help.
Title: Re: Control Livolo switches
Post by: igorgumush on Jun 23, 2013, 02:45 pm
thanks a lot
i'm trying to control the livolo switches from  arduino and your code works great !
can you explain the protocol it's working on ?
Title: Re: Control Livolo switches
Post by: iiiwyfiii on Jul 12, 2013, 12:05 pm
Hi, thank you for your works. I have got this remote from livolo.
http://www.aliexpress.com/item-img/smart-home-furnishing-life-touch-switches-for-remote-control-VL-RT01/575630281.html

Your works cover button 0 to 10, plus the big "power" button on the top of the remote.

The remote can set scene for a group of lighting switch. Most importantly, the code (0 to 10 button) only give power toggle function, but not power on only function. Under the scene mode, light can be power on only. Can anyone help to study the codes?

I do not have hardware and knowledge to do this myself. If anyone can give me a list of hardware needed. I will also try to learn how to do this.

Thank you
Title: Re: Control Livolo switches
Post by: spch on Oct 01, 2013, 09:59 pm
Hi folks,

Sorry for not answering questions in timely manner. I didn't get immediate follow up to this post, so I thought that everyone was quite satisfied with initial idea, or not interested at all.

I'v been a bit busy doing some home automation, mostly light automation, of course (but there is auto music in bathroom and automatic wireless cat feeder. All controlled over internet, as you may have guessed ;)

I did my best to answer your questions by PM. Here is a summary for all.

1) Wiring to control switches is extremely simple. Regarding this code: transmitter DATA to Arduino digital pin 9, GND to GND, VCC to 5V.

2) Wiring to record and analyze raw command includes some additional hardware: http://wiki.nethome.nu/lib/exe/detail.php/upm_scheme.png?id=analyzer%3Ahardware and a PC with your favourite audio recording software (I strongly recommend Audactiy)

Here you connect receiver DATA to RECEIVE point, GND to GND and GND of external 5V DC power supply, VCC to external 5V DC power supply.

MIC output should be connected to MIC in of your PC.

Please note that this does not require Arduino. Only receiver, divider, power supply and PC to record and analyze pulses.

3) I didn't try to break into Livolo protocol. Mostly because I don't have the skills to do so. Sorry guys. But I have two recorded raw samples from two different Livolo remotes. That, I guess, shoud be enough to understand protocol.

Here are download links to WAVs with 11 keypresses (order: 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, All Off).
http://yadi.sk/d/oDu5rYb9AEtJq
http://yadi.sk/d/psE0boFXAEtFL

4) Here is an automated (sorry) translation of how I did Livolo remote imitation:

http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&u=http%3A%2F%2Fmysku.ru%2Fblog%2Faliexpress%2F14127.html

Search for "MANAGEMENT Radio switch" in the text to read about Livolo remote imitation.

So, I guess that's all. I'll try to answer your questions if there are any.
Title: Re: Control Livolo switches
Post by: seagorf7 on Oct 13, 2013, 03:28 pm
hi thanks for your work,

could you share your latest and impoved code with us?

i copied the codes with audacity , i dont get the same waves, i guess i ll be able to reconstruct the signal thanks to your code

thanks
Title: Re: Control Livolo switches
Post by: spch on Oct 13, 2013, 09:15 pm
Quote
could you share your latest and impoved code with us?


Hi,

Sure. I was going to, anyway. But I didn't do anything to transmitting part, sorry. I've only optimized for memory.

Here is more neat (as I guess) code that should use far less precious RAM than previous. It's been cut from working code, that is why here are only few buttons.

Code: [Select]
#include <avr/pgmspace.h> // needed to use PROGMEM

#define  txPin  8 // pin connected to RF transmitter (pin 8)
byte i; // command pulses counter for Livolo (0 - 100)
byte pulse; // counter for command repeat

// commands stored in PROGMEM arrays (see on PROGMEM use here: http://arduino.cc/forum/index.php?topic=53240.0)
// first array element is length of command
const prog_uchar button1[45] PROGMEM ={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};
const prog_uchar button2[43] PROGMEM ={42, 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};
const prog_uchar button3[41] PROGMEM ={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};
const prog_uchar button4[43] PROGMEM ={42, 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, 5, 3, 4, 2, 4, 2, 4, 2};
const prog_uchar button5[43] PROGMEM ={42, 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, 2, 4, 3, 4, 2, 4, 2, 4, 2, 4, 2};
const prog_uchar button7[41] PROGMEM ={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, 4, 2, 5, 3, 4, 2, 4, 2};
const prog_uchar button11[41] PROGMEM ={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, 4, 2, 5, 2, 4, 3, 4, 2};

// pointers to command arrays
PROGMEM const prog_uchar *buttonPointer[] = {button1, button2, button3, button4, button5, button7, button11};

void setup() {

// sipmle example: send button "button2" once. Note that array elements numbered starting from "0" (so button1 is 0, button2 is 1 and so on)

txButton(1);

}

void loop() {
}

// transmitting part
// zeroes and ones here are not actual 0 and 1. I just called these pulses for my own convenience.
// also note that I had to invert pulses to get everything working
// that said in actual command "start pulse" is long low; "zero" = short high; "one" = long high; "pause" is short low; "low" is long low.

void txButton(byte cmd) {
prog_uchar *currentPointer = (prog_uchar *)pgm_read_word(&buttonPointer[cmd]); // current pointer to command array passed as txButton(cmd) argument
byte cmdCounter = pgm_read_byte(&currentPointer[0]); // read array length

for (pulse= 0; pulse <= 180; pulse = pulse+1) { // how many times to transmit a command
for (i = 1; i < cmdCounter+1; i = i + 1) { // counter for reading command array
  byte currentCmd = pgm_read_byte(&currentPointer[i]); // readpulse type from array
  switch(currentCmd) { // transmit pulse
   case 1: // start pulse
   digitalWrite(txPin, HIGH);
   delayMicroseconds(550);
   digitalWrite(txPin, LOW);
   break;
   case 2: // "zero"
   digitalWrite(txPin, LOW);
   delayMicroseconds(110);
   digitalWrite(txPin, HIGH);
   break;   
   case 3: // "one"
   digitalWrite(txPin, LOW);
   delayMicroseconds(303);
   digitalWrite(txPin, HIGH);
   break;     
   case 4: // "pause"
   digitalWrite(txPin, HIGH);
   delayMicroseconds(110);
   digitalWrite(txPin, LOW);
   break;     
   case 5: // "low"
   digitalWrite(txPin, HIGH);
   delayMicroseconds(290);
   digitalWrite(txPin, LOW);
   break;     
  }
  }
}
digitalWrite(txPin, LOW);
}


Have fun!
Title: Re: Control Livolo switches
Post by: comptrmedic on Oct 15, 2013, 04:45 am
spch,
quick question, I've done pretty much the same thing with rf remotes but have a problem, if I do a page refresh for whatever reason in the browser, the switches are retriggered again turning them off if they're on and vice versa, are u running your app in a browser and if so have you experienced the same thing and have you been able to correct it, how?  Thanks much....
Title: Re: Control Livolo switches
Post by: spch on Oct 15, 2013, 07:33 am
comptrmedic,

I've never experienced such an issue. I'm using web server as in RC-Switch (https://code.google.com/p/rc-switch/) example.

There are, however, certain browser issues. For example, when using Chrome, I need to type command two times to get it working  (I guess that is the way Chrome's cache is working). So when I need to use browser, I prefer Firefox over Chrome.

My best guess is that re-triggering happens because of browser's cache. Try using another browser, or turning off cache (note that this could also slow down your normal browsing). If that doesn't help, there may be something special about web server that is running on your Arduino.

ps. apart from browsers I use Tasker (https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=en) to for direct HTTP POST requests when I need to trigger a switch or change automation settings. I doesn't require to load/reload pages and works flawlessly.
Title: Re: Control Livolo switches
Post by: spch on Oct 16, 2013, 07:54 am
Recently I took another look at the waveform of Livolo remote. And as I had some time to spare, that is what I saw.

1) Each keypress sends remote ID and a command itself (approximately 8000 us, repeated about 100 times or more)
2) Remote ID is unique to the remote and never changes during transmission
3) Each command can be represented by 24 pulses: long start pulse plus 23 data pulses (bits). Of that 23 bits 16 are remote ID and the rest are the command.
4) I've compared commands (7 bit) of two remotes, and they look identical.

Regarding pulses to bits conversion. I took for granted that data pulses are:

1) short highs (I took them as "0")
2) long highs and lows (excluding start pulse) (I took them as "1"). Right, "1" is therefore represented either by long high or long low - doesn't matter

This approach gives exactly 24 pulses (including start) for all avaliable to me commands (buttons 1 to 0). Here is my vision of data packet structure:

(http://2.firepic.org/2/images/2013-10/16/fpadyd8ojzrn.jpg) (http://firepic.org/)

Then I thought there must be some kind of a rule which pulses must follow. It looks like:

1) Each data pulse is followed by short low pulse, excluding two long pulses in a row and single long low pulse which is followed by short high
2) First long pulse ("1") is always high, then they are interleaving.

I could have missed something, but first result is simplified code that takes about 200 bytes less memory when compiled for Mega.

Here is an example, which can be further improved (as there is no need to store in command arrays short low pulses):

Code: [Select]
#include <avr/pgmspace.h> // needed to use PROGMEM

#define  txPin  8 // pin connected to RF transmitter (pin 8)
byte i; // command pulses counter for Livolo (0 - 100)
byte pulse; // counter for command repeat

// commands stored in PROGMEM arrays (see on PROGMEM use here: http://arduino.cc/forum/index.php?topic=53240.0)
// first array element is length of command
const prog_uchar start[30] PROGMEM = {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}; // remote ID - no need to store it with each command
const prog_uchar button1[15] PROGMEM ={14, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2}; // only command bits
const prog_uchar button2[13] PROGMEM ={12, 5, 3, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2};
const prog_uchar button3[11] PROGMEM ={10, 5, 3, 5, 3, 4, 2, 4, 2, 4, 2};
const prog_uchar button4[13] PROGMEM ={12, 4, 2, 4, 2, 5, 3, 4, 2, 4, 2, 4, 2};
const prog_uchar button5[13] PROGMEM ={12, 5, 2, 4, 3, 4, 2, 4, 2, 4, 2, 4, 2};
const prog_uchar button7[11] PROGMEM ={10, 5, 3, 4, 2, 5, 3, 4, 2, 4, 2};
const prog_uchar button11[11] PROGMEM ={10, 5, 3, 4, 2, 5, 2, 4, 3, 4, 2};

// pointers to command arrays
PROGMEM const prog_uchar *buttonPointer[] = {start, button1, button2, button3, button4, button5, button7, button11};

void setup() {

// sipmle example: send button "button2" once. Note that array elements numbered starting from "0" (so button1 is 0, button2 is 1 and so on)
// Serial.begin(9600);


}

void loop() {

txButton(3);
delay(1000);
}

// transmitting part
// zeroes and ones here are not actual 0 and 1. I just called these pulses for my own convenience.
// also note that I had to invert pulses to get everything working
// that said in actual command "start pulse" is long low; "zero" = short high; "one" = long high; "pause" is short low; "low" is long low.

void txButton(byte cmd) {
prog_uchar *currentPointer = (prog_uchar *)pgm_read_word(&buttonPointer[cmd]); // current pointer to command array passed as txButton(cmd) argument
byte cmdCounter = pgm_read_byte(&currentPointer[0]); // read array length

prog_uchar *currentPointerStart = (prog_uchar *)pgm_read_word(&buttonPointer[0]); // current pointer to start command array


for (pulse= 0; pulse <= 180; pulse = pulse+1) { // how many times to transmit a command
for (i = 0; i<30; i=i+1) {

byte currentCmd = pgm_read_byte(&currentPointerStart[i]);
sendPulse(currentCmd);
// Serial.print(currentCmd);
// Serial.print(", ");
}


for (i = 1; i < cmdCounter+1; i = i + 1) { // counter for reading command array
 byte currentCmd = pgm_read_byte(&currentPointer[i]); // readpulse type from array

 sendPulse(currentCmd);
//  Serial.print(currentCmd);
// Serial.print(", ");
   }
 }
}

void sendPulse(byte txPulse) {

 switch(txPulse) { // transmit pulse
  case 1: // start pulse
  digitalWrite(txPin, HIGH);
  delayMicroseconds(550);
  digitalWrite(txPin, LOW);
  break;
  case 2: // "zero"
  digitalWrite(txPin, LOW);
  delayMicroseconds(110);
  digitalWrite(txPin, HIGH);
  break;  
  case 3: // "one"
  digitalWrite(txPin, LOW);
  delayMicroseconds(303);
  digitalWrite(txPin, HIGH);
  break;      
  case 4: // "pause"
  digitalWrite(txPin, HIGH);
  delayMicroseconds(110);
  digitalWrite(txPin, LOW);
  break;      
  case 5: // "low"
  digitalWrite(txPin, HIGH);
  delayMicroseconds(290);
  digitalWrite(txPin, LOW);
  break;      
 }
digitalWrite(txPin, LOW);
}


Title: Re: Control Livolo switches
Post by: winnaing on Oct 19, 2013, 07:34 am
Hi spch
I am following your post quite sometime after I bought livolo switch and face same problem.
It is very useful information in your post and codes are working perfectly.
What I am doing right now is, to have more codes ( I wanted around 20 codes to control 20 different switches) by doing try and error method on your codes. I have to admit that it is not successful at all. I cannot get even one more code.
Is it possible to get more codes to control livolo switches and how?

Sorry, I am very new to RF and Arduino.

Regards
Title: Re: Control Livolo switches
Post by: spch on Oct 20, 2013, 09:46 pm
Hi, winnaing,

I'm new to Arduino/RF too ;)

Lately I've been a bit busy with debugging some pieces of code and other things, but I'm planning to rewrite Livolo code since I've studied waveforms more carefully. You could wait a bit, or modify code yourself. I hope the following information would be of use in case you choose the latter.

The key is that command consists of unique remote ID (never changes) and key code (they appear to be fixed too, but change depending on key pressed). So you only need to change remote ID to get more keys, and there are plenty of these "virtual remotes" as each remote ID is 16 bit. Additionally, it is highly probable that Livolo switches can learn key codes other than I've discovered by recording remotes. So there could be even more remote ID and key code combinations.

But the thing is that changing remote ID (or key code) requires following strict rules, i.e.: pulses must interleave, that is high pulse should be always followed by low pulse; two short pulses are "0" and every single long pulse (apart from start) is "1" or vice versa, it doesn't matter as long as you code them right.
Title: Re: Control Livolo switches
Post by: winnaing on Oct 21, 2013, 02:42 pm
Hi spch

Thanks for your reply. I follow your advice as follow:

1) I changed ID for a few combinations, not successful.
2) Yes, other third party remote can control the Livolo and I try to decode it, also not successful.

Maybe the way I did is not correct. By the way, what is interleave?   :smiley-roll:

Regards
Title: Re: Control Livolo switches
Post by: spch on Oct 21, 2013, 07:42 pm
Winnaing,

I was pretty sure that I could say "interleaving" to describe a rule of high pulse following low pulse and vice versa. Sorry for bad English, if I got that wrong.

Here is more "user friendly" code. No more strange arrays full of strange numbers ;) It requires only two values: Remote ID and a keycode of button to "press".

There are three predefined working Remote IDs (and it is possible to use many more as long as Remote IDs are 16 bit), and 11 predefined buttons (and, maybe, it is possible to use any other as long as keycodes are 7 bit).

Bottom line: it should work. If it doesn't, please tell me what went wrong and I'll try to figure out how to fix it.

Code: [Select]

#define  txPin  8 // pin connected to RF transmitter (pin 8)
byte i; // just a counter
byte pulse; // counter for command repeat
boolean high = true; // pulse "sign"

// keycodes #1: 0, #2: 96, #3: 120, #4: 24, #5: 80, #6: 48, #7: 108, #8: 12, #9: 72; #10: 40, #OFF: 106
// real remote IDs: 6400; 19303
// tested "virtual" remote ID: 8500, other IDs could work too, as long as they do not exceed 16 bit
// known issue: not all 16 bit remote ID are valid
// have not tested other buttons, but as there is dimmer control, some keycodes could be strictly system
// use: sendButton(remoteID, keycode);
// see void loop for an example of use

void setup() {


}

void loop() {

sendButton(6400, 120); // blink button #3 every 3 seconds using remote with remoteID #6400
delay(3000);

}

void sendButton(unsigned int remoteID, byte keycode) {

  for (pulse= 0; pulse <= 180; pulse = pulse+1) { // how many times to transmit a command
  sendPulse(1); // Start 
  high = true; // first pulse is always high

  for (i = 16; i>0; i--) { // transmit remoteID
    byte txPulse=bitRead(remoteID, i-1); // read bits from remote ID
    selectPulse(txPulse);   
    }

  for (i = 7; i>0; i--) { // transmit keycode
    byte txPulse=bitRead(keycode, i-1); // read bits from keycode
    selectPulse(txPulse);   
    }   
  }
   digitalWrite(txPin, LOW);
}

// build transmit sequence so that every high pulse is followed by low and vice versa

void selectPulse(byte inBit) {
 
      switch (inBit) {
      case 0:
       for (byte ii=1; ii<3; ii++) {
        if (high == true) {   // if current pulse should be high, send High Zero
          sendPulse(2);
        } else {              // else send Low Zero
                sendPulse(4);
        }
        high=!high; // invert next pulse
       }
        break;
      case 1:                // if current pulse should be high, send High One
        if (high == true) {
          sendPulse(3);
        } else {             // else send Low One
                sendPulse(5);
        }
        high=!high; // invert next pulse
        break;       
      }
}

// transmit pulses
// slightly corrected pulse length, use old (commented out) values if these not working for you

void sendPulse(byte txPulse) {

  switch(txPulse) { // transmit pulse
   case 1: // Start
   digitalWrite(txPin, HIGH);
   delayMicroseconds(500); // 550
   digitalWrite(txPin, LOW);
   break;
   case 2: // "High Zero"
   digitalWrite(txPin, LOW);
   delayMicroseconds(100); // 110
   digitalWrite(txPin, HIGH);
   break;   
   case 3: // "High One"
   digitalWrite(txPin, LOW);
   delayMicroseconds(300); // 303
   digitalWrite(txPin, HIGH);
   break;     
   case 4: // "Low Zero"
   digitalWrite(txPin, HIGH);
   delayMicroseconds(100); // 110
   digitalWrite(txPin, LOW);
   break;     
   case 5: // "Low One"
   digitalWrite(txPin, HIGH);
   delayMicroseconds(300); // 290
   digitalWrite(txPin, LOW);
   break;     
  }
}
Title: Re: Control Livolo switches
Post by: winnaing on Oct 22, 2013, 05:24 pm
Hi spch

It is wonderful. All ID key are working. Thank you.  :)
I try to 'decode' your ID key but still don't understand and no luck.
Anyway I try to digest your advice and try to look for other IDs. For the time being, 30 codes are enough for me.

Have you try Koti light switch? see http://www.aliexpress.com/store/529450
The good thing about these switches is that they are bicommunication; ie switch send back the feedback signal.
So we know exactly if switch on or off. Whereas Livolo is not.
Again, I have checked with supplier. They said their code is propitiatory and do not work with 3rd party RC.
I don't have the talent to decode them. So I did not buy.
Anybody ever decode them successfully? 

Regards
Title: Re: Control Livolo switches
Post by: spch on Oct 22, 2013, 09:30 pm
Hello Winnaing,

Glad to know the code is working. Koti switches could use proprietary protocol (Livolo, by the way, does use its own proprietary protocol too) or they can use Z-Wave protocol as store name suggests. In the latter case you don't need to decode anything as there are Z-wave modules for Arduino.

But if Koti switches use fixed codes just like Livolo, they can be decoded as well.
Title: Re: Control Livolo switches
Post by: baustromverteiler on Oct 22, 2013, 09:35 pm
Thanks for decoding the Livolo protocol and your sketch, I already got it to work with my Livolo switches! I was wondering if there is any way to use the Livolo dimmers with your code?

Regards, Max
Title: Re: Control Livolo switches
Post by: spch on Oct 22, 2013, 09:58 pm
Max,

I guess it is highly probable. At least, manual for VL-RMT-01 remote that I have says that buttons 7 (on), 9 (off), "+" (more light) and "-" (less light) can be used to control dimmer switch.

I don't have dimmer switches, that is why I have not scanned "+" and "-" buttons yet. I'm planning to do that this or next week, and after that you will be able to test dimmer feature.
Title: Re: Control Livolo switches
Post by: baustromverteiler on Oct 22, 2013, 10:17 pm
thanks for your really fast reply  -  I'm really looking forward to test the dimmer feature :) keep up the great work!
Title: Re: Control Livolo switches
Post by: winnaing on Oct 23, 2013, 04:25 pm
Hi spch
Thanks for your reply.
I still cannot find new ID yet. For example, i use 6500 for ID which is 0001 1001 0110 0100. I though it follow your rule.
But it did not work either. Which pulse is not following your rule?

I understand that KOTI use FSK protocol. Still can decode?

Regards
Title: Re: Control Livolo switches
Post by: spch on Oct 23, 2013, 07:31 pm
baustromverteiler,

I've just recorded what I believe are dimmer buttons. I have to sets of dimmer buttons  (+/-) on the remote, and they have different keycodes. So here are both sets:

1) "+": 92  ; "-": 116

2) "+": 126; "-": 36

It's in the manual that I've found on the net that dimmer should be "paired" with buttons 7 and 9. Regretfully there is nothing on pairing and I don't have dimmer switch, so I can not test it.

winnaing,

It seems, you are right. Not all remote IDs are working. Sorry, I can not find the reason - it is really beyond my understanding. Maybe, I missed something or there is a bug in the code.

So there is a hit or miss approach: try different remote IDs to find ones that work. For example, I found that 7400, 6550, 10550 can be used with Livolo switches.

As to FSK, it is not really a protocol - it is method of modulation used to transmit data over RF. Basically it can be easily demodulated using FSK receiver (the same way as I demodulated Livolo's signal using ASK receiver). And there are two ways to use received data:

1) Try to "copy" code sequence without trying to understand underlying protocol;
2) Try to decode and use original protocol.

First will do if it is about fixed codes. Second is good to deal with fixed and dynamic codes, although to me dynamic codes are really hard to hack.

Regards,
Sergey.
Title: Re: Control Livolo switches
Post by: baustromverteiler on Oct 23, 2013, 10:24 pm
Thanks for the keycodes - I'll let you know how it worked out
Title: Re: Control Livolo switches
Post by: winnaing on Oct 24, 2013, 05:17 pm
Hi spch
Thanks for new IDs.
As for FSK ; are you saying that it works with fsk receiver and will not work with ask receiver?
Then where can I find fsk receiver? It is like all arduino store sell ask receiver.

Regards
Title: Re: Control Livolo switches
Post by: spch on Oct 24, 2013, 09:32 pm
Hi winnaing,

Of course, ASK receiver won't be able to receive FSK transmission. Here is a simple FSK receiver:
http://www.ebay.com/itm/Very-Good-FSK-Replace-ASK-Transparent-Wireless-Data-Receier-RX-Module-433MHZ-/271302707346?pt=LH_DefaultDomain_0&hash=item3f2ae6c892

and here are both FSK receiver and transmitter:

http://www.ebay.com/itm/FSK-Directly-Replace-ASK-200-300-Meters-Transparent-Wireless-Data-433MHZ-Modules-/261050654636?pt=Vintage_Electronics_R2&hash=item3cc7d4dfac
Title: Re: Control Livolo switches
Post by: eltin on Oct 25, 2013, 03:28 pm
Hi,

Thanks for the code :)
What kind of transmitter work fine with livolo?

This: http://www.ebay.com/itm/433mhz-WL-RF-transmitter-Receiver-Module-Link-Kit-for-Arduino-ARM-MCU-Wireless-/360770544267?pt=LH_DefaultDomain_2&hash=item53ff99a28b (http://www.ebay.com/itm/433mhz-WL-RF-transmitter-Receiver-Module-Link-Kit-for-Arduino-ARM-MCU-Wireless-/360770544267?pt=LH_DefaultDomain_2&hash=item53ff99a28b)

Thx!!!
Title: Re: Control Livolo switches
Post by: spch on Oct 25, 2013, 04:21 pm
Hi eltin,

These should be just fine. My transmitter looks exactly the same.
Title: Re: Control Livolo switches
Post by: spch on Oct 25, 2013, 04:47 pm
Hi folks,

It is now a Livolo switch control library.

Just unzip Livolo folder under your Arduino/libraries folder, restart Arduino IDE if it was open at the moment, connect Arduino board with ASK RF transmitter to PC, upload test sketch and put your Livolo switch into learning mode.

If everything goes right, your light will turn on and off every 3 seconds. See readme.txt for more info.

Default TX pin is 8, but you can use any digital pin you like.

Enjoy!
Title: Re: Control Livolo switches
Post by: winnaing on Oct 25, 2013, 05:51 pm
Hi spch
Thanks for the link. I have purchased the pair already.
Next, once I receive the switch and rf module, I try to decode them. If not successful, will shout for help.
Thanks for the library as well. I haven't tested yet, but should be fine. Well feedback to you after tested.

Regards
Title: Re: Control Livolo switches
Post by: eltin on Oct 25, 2013, 11:35 pm
Hi,

First thanks for sharing your code :)

I can´t control the switch :(

I use:
1. Arduino Uno
1. RF433 transmitter
1. Switch VL-C301DR-81

Steps:
1. Connect rf433 data on pin 8 VCC on 5v and GND on gnd
2. Load the code
3. Touch the button of switch 5 seconds (Di sound)
4. Send 1 to monitor.

The code:
Code: [Select]

#include <livolo.h>
Livolo livolo(8);
int incomingByte = 0;

void setup() {
    Serial.begin(9600);
    Serial.println("init");
}

void loop() {
   if (Serial.available() > 0) {
        incomingByte = Serial.read();
        switch(incomingByte) {
          case 49:
            livolo.sendButton(6400, 120);
            Serial.println("Switching on 1");
          break;
        }
   }
}
Title: Re: Control Livolo switches
Post by: spch on Oct 25, 2013, 11:59 pm
eltin,

Sorry for previous message. I missed some pieces of code you wrote. I've just tested your code on Mega and it is working flawlessly.

I guess problem is in switch "pairing". Try clearing previous code from switch first. For example:

1) Hold switch button until it beeps twice
2) Release switch button
3) Hold switch button until it beeps once
4) Enter "1" in Arduino port monitor input field and press Enter (switch shoud beep and accept new button)
5) Enter "1" in Arduino port monitor input field and press Enter (switch should turn on)

In case switch still not responding, make sure you have right antenna (163 mm of wire soldered to transmitter) and that transmitter is quite close to switch (at least for testing).
Title: Re: Control Livolo switches
Post by: eltin on Oct 26, 2013, 12:24 am
spch,

I did all the step but not work on Arduino Uno.
I check in all Arduino PINs with the transmitter near the switch!

If I can make it work, then they notice!

Thx

Pd. Sorry for my bad English
Title: Re: Control Livolo switches
Post by: eltin on Oct 26, 2013, 12:55 am
spch,

It works with arduino uno :)

I use PIN 3 and I send this livolo.sendButton(19303, 72);

Thanks man!!!
Title: Re: Control Livolo switches
Post by: seagorf7 on Oct 31, 2013, 10:27 am
thanks for your code, its working like a charm

my remote id are13979 for room 1
13972 for room 2
139731 for room 3

do you have a sketch to read the id and the command directly from the remote ( without going thru audacity)
i m sure it would help a bunch  of people

thanks for your work
Title: Re: Control Livolo switches
Post by: Arisma on Oct 31, 2013, 11:51 pm
Dear friends,

  I know that this is strictly an Arduino forum, but I am working on the same project a long time now to control my Livolo switches, but with a Raspberry pi instead. As far as now I have not managed to achieve it. Hopefully someone inside the forum can translate the already working code for Arduino and make it work on Raspberry pi. There are already some useful codes for Raspberry pi that control the GPIO and send pulses to them (RCSwitch-pi and wiringPi) but I can note make them work with Livolo. Thank you very much for your reading!
Title: Re: Control Livolo switches
Post by: spch on Nov 01, 2013, 06:09 am
seagorf7,

You are right, reading remote IDs with Audacity is an akward routine. And I did try to build a code to read remote IDs, but have not succeeded yet. What's more, I'm not really sure I can do it.

But I'll get back to it as soon as I have enough time.
Title: Re: Control Livolo switches
Post by: seagorf7 on Nov 02, 2013, 10:03 am
i m no good at programing but , you can get help on irc
server : chat.freenode.net
room : #arduino

a bunch of savvy coders there
Title: Re: Control Livolo switches
Post by: eltin on Nov 05, 2013, 03:01 pm
Hi,

It´s possible to get current status or send ON command only.

thx
Title: Re: Control Livolo switches
Post by: spch on Nov 05, 2013, 06:56 pm
seagorf7,

Thanks, I'll take a note on that. But still I don't understand how come talking on IRC gives me time to work on the code ;)

eltin,

Is it a statement or question? In case you know how to get Livolo switch status, please share this info.
Title: Re: Control Livolo switches
Post by: eltin on Nov 05, 2013, 06:57 pm
Sorry is a question :(
Title: Re: Control Livolo switches
Post by: spch on Nov 05, 2013, 07:06 pm
eltin,

I'm not really sure it is possible to get switch status or send ON only command. There is a small chance of that, beause of "scenes" feature of advanced remote control.

As far as I remember (I've lost manual), there is a way to record several "scenes" with remote. Each scene means that one button can turn on several switches simultaneously. The thing is that required switches must be turned on prior to programing a scene. So I guess remote somehow "knows" which switches are on.

Again, I'm not sure it is working that way. I'll get back to this a bit later, sorry.
Title: Re: Control Livolo switches
Post by: eltin on Nov 05, 2013, 07:13 pm
spch,

I have this switch http://blog.iteadstudio.com/itead-intelligent-switch-433mhz-communication-protocol/ (http://blog.iteadstudio.com/itead-intelligent-switch-433mhz-communication-protocol/) in this it´s posible but I can´t with livolo :(

I keep trying, if I succeed I share!!
Title: Re: Control Livolo switches
Post by: spch on Nov 06, 2013, 09:14 am
Hi everyone,

Sorry to mislead. There is no two-way communication between remote and switch. Scenes are being recorded on remote only, no interaction with switches required.
Title: Re: Control Livolo switches
Post by: winnaing on Nov 06, 2013, 04:21 pm
Yes, Itead switch is dual communication. It means switch send feedback status signal.
Whereas Livolo switch is not.
Anybody has any idea that where Itead source its switch from?

As I said earlier, another dual communication switch is Koti light switch. I have purchased them and play with them. It is nice and cool but its code is not open. I am waiting for FSK rf transmitter/receiver to decode them.

http://koti-china.en.alibaba.com/

If anyone has successfully decode them, please share.

Regards
Title: Re: Control Livolo switches
Post by: seagorf7 on Nov 07, 2013, 08:06 pm
here are pictures of the remote manual

http://www.megafileupload.com/en/file/466879/vlrmt01-zip.html

Title: Re: Control Livolo switches
Post by: spch on Nov 08, 2013, 08:54 pm
seagorf7,

Thanks for the manual! I'll keep it.
Title: Re: Control Livolo switches
Post by: eltin on Nov 12, 2013, 02:55 pm
here other remote manual :)
http://www.keepandshare.com/doc/1952335/scene-remote-controller-manual-pdf-june-4-2010-7-33-am-229k?da=y (http://www.keepandshare.com/doc/1952335/scene-remote-controller-manual-pdf-june-4-2010-7-33-am-229k?da=y)
Title: Re: Control Livolo switches
Post by: spch on Nov 14, 2013, 11:17 am
Thanks, eltin!
Title: Re: Control Livolo switches
Post by: winnaing on Nov 23, 2013, 09:30 am
hi spch
As I said earlier, I have purchased koti light switch. It is working perfect.
After I received fsk transmitter and receiver, I tried to decode them. Again, I have no talent to interpret their code properly.
I used Goldwave software to decode. Can you help me to have a look the wave file that I captured?
There are 3 files. kotiT is captured transmitted code only, kotiR is feedback signal from light switch and kotiTR is combined transmitter+feedback signal.
My opinion on this switch is that it is better then Livolo, in terms of design and functionality. In addition, it send back status signal.
Everybody who work with rf transmitter/receiver know that sending rf signal is not reliable. If we know the status of the receiver, it is perfect.
Thanks in advance.

Regards
Title: Re: Control Livolo switches
Post by: spch on Nov 23, 2013, 01:43 pm
Hi winnaing,

You are right, this one could be hard to decode. Could you, please, record several different keycodes?

What is more, I still didn't learn how to receive. I've only managed detect Livolo transmission, so that I know when Livolo remote transmits a code, but I can not decode what's being transmitted.
Title: Re: Control Livolo switches
Post by: winnaing on Nov 24, 2013, 04:01 am
Hi spch
Maybe we are using different term for the code. I do not intent to decode it, what I want is "hardcode" (borrow your word) for Arduino. Same as what you did for Livolo switch.
I attached more transmitted signals from RC, altogether 5 buttons. If it is not enough, I am willing to send RC and switches to you, if you wish to take challenges.
Thanks in advance.

Regards
Title: Re: Control Livolo switches
Post by: spch on Nov 25, 2013, 08:51 pm
Hi winnaing,

Got it. I'll take a closer look to these samples as soon as I have time later this week.

Sincerely,
Sergey.
Title: Re: Control Livolo switches
Post by: platenspeler on Nov 30, 2013, 11:17 am
Hi Spch,

Thanks for starting this topic. I'm a Raspberry user (not yet Arduino) and used your code to make a version for that hardware.

It's working, but not 100% reliable. When calling a sendButton 10 times only 7 times the switch would react.  And the distance (about 2 meters) is far less than what I do get with my 10 other 433 switches (klikaanklikuit.nl).

And the transmitter is much less reliable as for example the keychain device of Livolo. The keychain almost always reacts fine. I use the following timing settings: 520uSec for start, 110uSec for short, 300uSec for long pulses.


Just trying to find out why the keychain remote performs so much better than the DIY solution. Your feedback is welcome.

Btw: Let me share the codes for the VL-RMT-02 remote of 5 USD. It is capable of controlling 3 devices in toggle ON/OFF mode and has one all-off button:
A key: 08
B key: 16
C key: 56
D key: 42 (All Off)

As you see, none of these codes were used in the remote that you published. I did see that my VL-RMT-02 remote can also be used for dimmer control. In that case, A is On, B= Dim-Up, C=Dim-Down and D is Off. I do not have a dimmer so I cannot test it.

regards,

Maarten
Title: Re: Control Livolo switches
Post by: spch on Nov 30, 2013, 07:44 pm
Maarten,

That is really great, you could build your code for Raspberry!

I've run into reliability issue too. And my best guess is that reliability depends on transmission quality. You can verify if it is true by placing transmitter and switch as close as you can. It should work each and every time.

I found that it is quite hard to match selfmade antenna with these cheap transmitters and receivers. And even factory helical antenna (I've bought several from eBay) is not good as I thought it would be.

Maybe these keychain and full-sized remotes are better tuned, or there is something I don't know because I, too, think that Livolo protocol has pretty good timing tolerance (maybe even more than 20 usec). And, yes, I've a bit varied timings, but as switches behaved quite well, I left them with 500-100-300 usec (in first version I used crazy 550-110-303-290 usec).

I powered transmitters both with 5V and 9V, but haven't noticed siginificant difference. What's even more strange, sometimes there were more "misfires" with 9V than with 5V (light didn't come on/off when expected). Don't know the reason,  but I think transmitter could slightly change waveform, although it must not. Can't remember for sure, but last hardware cofiguration could use 9V to power transmitter, and it is quite stable.

As for range, I didn't run any tests. All my switches are in range of approximately 2.5 meters from transmitter. And what could be important, transmitter is at about 2 m height.

Hope that helps and thank you for feedback!

Regards,
Sergey.
Title: Re: Control Livolo switches
Post by: platenspeler on Dec 01, 2013, 05:28 pm
Spch,

Well, good to hear that I'm not the only one with RF reliability issues when using Livolo.
I have asked Livolo (and their competitor Kopou) for the timing and protocol description,
but they think it is business secret and an advantage to make their own interface.

Maarten

PS. You can save on a few characters in your code if you in function SendPulse leave out the last digitalWrite line in every case section.

so
Code: [Select]
case 0: // Start
digitalWrite(txPin, LOW);
delayMicroseconds(p_start); // 550
//digitalWrite(txPin, HIGH);
break;
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Dec 02, 2013, 10:43 am
Maarten,

Thanks for the tip! It does really make sense.

You were lucky enough to get to "business secret". They only told me that switches are 433MHz - something I have already knew ;)
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Dec 25, 2013, 11:59 am
Hi everyone,

Mini-update. I've been trying to decode Livolo with Arduino, but so far only managed to detect Livolo transmission. Yes, I know, Arduino iterrupts are nothing  special, but for me they really are.
Title: Re: Control Livolo switches / Livolo switch library
Post by: platenspeler on Jan 01, 2014, 06:30 pm
Hmm,

Why are you trying to do this? The protocol of the Livolo is crap and does contain very little error detection/control. As you know, it just sends 100 times the same code and hopes that the Livolo switch will pick up at least one , (and if it does it won't accept a new command for 4 secs,  to allow the user to release the button first and avoid "blinking")
Better use any well-known transmitter (there is code for several 433MHz transmitters available for Arduino and Rasp)berry) and translate such decoded button press to the Livolo code by your sender.

Maarten

PS. Some weeks ago I ordered a Kopou switch with remote. As soon as that one arrives I hope to integrate it in our system..

PS2. Yeah, I forgot that if you have such a remote already it might come in handy ...
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 02, 2014, 07:18 am
Arduino code to read Livolo remote control buttons makes sense in case you have an RC you want to use and don't have hardware/skills to read codes manually (e.g. in Audacity or other audio editing software).

I thought it is quite simple, and I'm quite sure it is - just not for me.

In case there is no RC or one doesn't want to use it, reading Livolo codes, of course, is not necessary.
Title: Re: Control Livolo switches / Livolo switch library
Post by: platenspeler on Jan 04, 2014, 12:40 am
Yes, you're right if you have the remote. But if I had such a remote, I would probably pair the remote directly with the switch, and pair the Arduino as a separate second controller with one of your universal codes. I do this with my klikaanklikuit stuff.

Too bad that the transmission protocol of Livolo is so bad.

BTW: I received my Kopou switch yesterday, including a small remote key-chain fob. Kopou switches look quite similar to Livolo swicthes, but unfortunately their code is  quite different. But as their communication protocol is  better,  I hope I can integrate it's receiver code with the Action and klikaanklikuit code I already use.

But for those of you that would like to control Livolo and Kopou switches with the same remote: It is not going to work.
I will probably post the protocol one of these days,I first like to finetune the communication parameters (timing).

Maarten
Title: Re: Control Livolo switches / Livolo switch library
Post by: platenspeler on Jan 05, 2014, 05:37 pm
Hi Spc,

I made receiver code for the Livolo and Kopou switches today. Of course the code is for Raspberry, but I expect that with only minor mods it can run on Arduino too (I can't check as I do not have Arduino)

The idea is simple: You need an interrupt handler function that runs as soon as the edge of the pin changes from hi to low or low-to-high. The interrupt handler fills a (circular) buffer. In the main routine you constantly read the buffer making sure you will keep one bit-string distance from the write position.

As the circular buffer method works much better than what I had, I will integrate it in my LamPI project. It needs some cleaning, but if you want I can publish the code...

Maarten
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 05, 2014, 09:28 pm
Hi Maarten,

To "pair" both remote and Arduino to switch one has to figure out what remote's code is. As far as I know, switch can not be paired to several different remotes. That is why I tried to write Livolo receiver.

I've also found that there is way too much interference in my vicinity. And what is worse, noise pulses often are exactly the same length to fit into parts of Livolo's code. I managed to detect Livolo transmission by counting "key" (500 usec or so) pulses for specific amount of time (i.e. we know that Livolo command is about 800 usec, and it consists of about 100 repetitions of the same pattern, so in 80 usec we can expect ten 500 usec pulses).

It's a shame, but I got stuck in organizing buffer to hold pulses after Livolo transmission has been detected. So it would be very kind of you to publish your code.

ps. Thanks for feedback about Kopou switches.

Regards,
Sergey.
Title: Re: Control Livolo switches / Livolo switch library
Post by: platenspeler on Jan 08, 2014, 01:44 pm
Spc,

I'm a newbie on GIT, but I think I managed to create a share to my repository (fingers crossed). You should be able to find the Livolo sniffer code at: https://github.com/platenspeler/LamPI and then in subdir receivers/sniffer. For raspberry: Sniffer contains support for klikaanklikuit, action/impuls, Livolo, Kopou and a few other remotes with 24-bit codes...

- unpack the branch in dir /home/pi/ (or use your own)
- cd /home/pi/receivers/sniffer
- make
- sudo ./sniffer -v -s -t
The flags are for: verbose + statistics (per remote) + test (gives all pulse timings too).

You will have to modify the interrupt handling/registration in the main program which is (slightly) different for Arduino. Probably the timing is almost equal for both devices so that should not be a problem.

Let me know if you encounter difficulties with GIT or so.

regards,

Maarten
Title: Re: Control Livolo switches / Livolo switch library
Post by: platenspeler on Jan 11, 2014, 12:08 am
The github repository contains the commands to interface with the 433Mhz transmitter and receiver, but I also added a LamPI-daemon and a web interface in Javascript/jQuery to control your lighting in style. Below is a screendump of the main screen which controls the various devices in the rooms.

It's also possible to define more comples scenes (of multiple lam p commands), set timers and to manage handsets/remote controllers. I like to make most settings in the GUI, but for handsets unfortunately some settings need to be made in the configuration file directly.

The small Livolo keychain remotes are very useful to bind complex scene commands to one of the 4 buttons on the remote so that you can easily create a lighting scene in your living with just one keypress on the remote.

(http://platenspeler.github.io/screenshots/room_screen_grey.JPG)

The user interface, MySQL database and the daemon can all run on a different computer on the network and will interface with the transmitter/receiver on Raspberry or Arduino over a socket interface (so these devices must be network enabled to work).

Maarten
Title: Re: Control Livolo switches / Livolo switch library
Post by: icofjm on Jan 12, 2014, 12:33 pm
Hi Spch.
Hi I am a new user and I have recently approached for arduino, possessing Livolo plates I have read that it is possible for plugging it into another arduino, I wanted to know if he can get you some questions maybe in Italian in order to understand a little better, while waiting for your kind reply thank you and greet.
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 13, 2014, 10:23 am
Maarten,

Thank you so much for sharing!

Sincerely,
Sergey.
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 13, 2014, 10:27 am
Hi icofjm,

I'm not sure I got what you are interested in, but you are welcome to ask any questions. I'll do my best to answer them.

Sincerely,
Sergey.
Title: Re: Control Livolo switches / Livolo switch library
Post by: icofjm on Jan 13, 2014, 01:43 pm

Thanks Spch. I wanted to know if I can control the livolo plates directly from arduino. It is difficult for one to first experience with arduino? I have already a rf transmitter just logged in as you described and install the code? Excuse my ignorance but are my first tests. Thank you for the time and rest while waiting for your kind reply.

Italiano

Grazie Spch.
Volevo sapere se posso comandare le placche livolo direttamente da arduino. È difficile per uno alla prima esperienza con arduino? Io ho già un trasmettitore rf basta collegato come da te spiegato e installare il codice? Scusa la mia ignoranza ma sono le mie prime prove. Ti ringrazio per il tempo dedicatomi e resto in attesa di una tua cortese risposta.
Title: Re: Control Livolo switches / Livolo switch library
Post by: andriej on Jan 13, 2014, 03:41 pm
Hi everyone!

Thanks for the great library - I was able to learn 6 switches different codes.
The worst thing is that they have same code for 'on/off' and I don't have remote...

Is there any option to switch individual switches off with different code?
And what's the code to send for "ALL OFF" button using the library?
Maybe I'll just force every switch to off...

Regards
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 13, 2014, 04:29 pm
icofjm,

It is really easy to control Livolo switches with Arduino. That is what Livolo library is for. Download it here:
https://docs.google.com/file/d/0B0DQ7La4EBHlU2ltTmlmeHhya3M

In case you download it as separate files, put them all into Livolo folder inside your Arduino\libraries folder.

Connect transmitter (this should be OOK/ASK 433 Mhz transmitter) DATA to pin 8, VCC to +5V and GND to GND. Don't forget to connect proper antenna (173 or, maybe, 164 mm) of single or multicore wire.

Then use test sketch blink.ino (it is in examples folder of Livolo library folder) for testing. Be sure to put your switch into learning mode shortly after uploading sketch. In case you've done it right, Livolo switch will turn on and off every 3 seconds.

You can find keycodes to emulate other buttons in readme.txe, that is also in Livolo library folder. And, of course, you can use any free digital pin to connect your transmitter.
Title: Re: Control Livolo switches / Livolo switch library
Post by: icofjm on Jan 14, 2014, 03:40 am
Thanks Spch.
In the coming days I will try following your valuable instructions and I'll let you know. For now, thanks for your patience and availability.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Nmraspi on Jan 17, 2014, 10:51 am
Hi Platenspeller.

Hi I wanted to ask an information on the connection with raspberry. I livolo plates and I wanted to on and off directly from raspberry and I seem to have figured out that you have succeeded. I have a few questions. That type of form tx did you use and how did you connect? For the code I am referring to the link github? Excuse the banality of the questions but it is just that I approached this world and would like to learn, hope I'm not bothering you too much and confided in a courteous response. :)
Title: Re: Control Livolo switches / Livolo switch library
Post by: icofjm on Jan 22, 2014, 11:06 pm
Hi Spch.
Thanks, there are successful and it works great!
A question, you can create a web interface for the control of various lights like Maarten that features with arduino?
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 23, 2014, 09:24 am
Hi icofjm,

I don't have enough knowledge in Javascript, so I won't be able to create exactly the same interface. But it is not hard to compose simple web interface to control several switches.

Check Arduino web server example here: https://code.google.com/p/rc-switch/downloads/list?can=3&q=

Sincerely,
Sergey.
Title: Re: Control Livolo switches / Livolo switch library
Post by: daleldalel on Jan 24, 2014, 11:05 pm
Just in case someone was looking for arduino code to decode Livolo remotes.

Code: [Select]

#define SIGNAL_IN 0 // INTERRUPT 0 = DIGITAL PIN 2 - use the interrupt number in attachInterrupt

volatile byte impulse = 0; // kolejny puls
volatile int bufor[53];
volatile boolean header = false;
volatile unsigned long StartPeriod = 0; // set in the interrupt
volatile boolean stop_ints = false;


void setup()
{
  attachInterrupt(SIGNAL_IN, calcInput, CHANGE);

  Serial.begin(9600);
}

void loop()
{
  if (stop_ints) //data in buffer
  {
    unsigned long binary = 1;
    //byte i = 0;
    for (byte j = 0; j < 46; j++)
    {
      //Serial.print(binary);
      if ((bufor[j] > 220) &&
          (bufor[j] < 400))
      {
        binary <<= 1;
        //binary |= 1;
        //i++;
        bitSet(binary,0);
      }
      else if ((bufor[j] > 90) &&
               (bufor[j] < 220) && (bufor[j + 1] > 90) &&
               (bufor[j + 1] < 220)) {
        binary <<= 1;
        j++;
       
      }
      else if ((bufor[j] > 90) &&
               (bufor[j] < 220) && (bufor[j + 1] > 220) &&
               (bufor[j + 1] < 400)) {
        binary <<= 1;
        bitSet(binary,0);
        //i += 2;
        j++;
      }
      else break;
          }
          //Serial.println(bitRead(binary,4));
    if (bitRead(binary,23))
    {
      bitClear(binary,23);
      Serial.print("remoteID:");
      Serial.print((binary / 128) & 65535);
      Serial.print(" - ");
      Serial.print("key code:");
      Serial.println(binary & 127);
    }
    else {
      Serial.println("wrong code  ");
      Serial.println(binary, BIN);
    }
    delay (1000);
    header = false;
    impulse = 0;
    stop_ints = false;

    // }
  }
}

// interrupt below...


void calcInput()
{
  // get the time using micros
  unsigned int duration = (int)(micros() - StartPeriod); // save pulse length to bufor
  StartPeriod = micros(); //begin next impulse
  //Serial.println(StartPeriod);
  if (stop_ints) return;
  if ((duration < 90) || (duration > 600)) goto reset; //impulse not right
  bufor[impulse++] = duration;
  if (duration < 415) return;
  if (!header)
  {
    header = true;
    impulse = 0;
    return;
  }
  else
  {
    if ((impulse < 23) || (impulse > 52)) goto reset; //too long or too short info
    stop_ints = true;
    return;
  }
reset:
  header = false;
  impulse = 0;
  return;
}




Thanks to platenspeler and spch

Improved code
Title: Re: Control Livolo switches / Livolo switch library
Post by: winnaing on Jan 26, 2014, 05:09 am
Hi daleldalel
Thanks for your code. I tested it and it showed below info.

wrong code
remoteID:6774 - key code:16

What can I do with it? I mean how I can utilise them in Arduino code?
Is it correct output? What are the output do you expect?
In fact, I am expecting time duration of each pulse.

Regards
Title: Re: Control Livolo switches / Livolo switch library
Post by: daleldalel on Jan 26, 2014, 07:37 am
Hi winnaing

This code just shows the data needed for livolo library created by spch. So you can use your remote as long as arduino.

Regards
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 26, 2014, 06:08 pm
Hello daleldalel,

Thanks for a great job! I tested code too and it works just right.
Although I get "wrong code" message from time to time, mostly output is correct.

Sincerely,
Sergey.
Title: Re: Control Livolo switches / Livolo switch library
Post by: purceno on Jan 29, 2014, 05:40 pm
Well done guys, incredible job! I just tested it yesterday in my Arduino + Livolo. It worked perfectly.

My Livolo switch can be controlled remotely, but it is not dimmerable.

I'd like to know if any of you has tried to use the dimmer function with arduino.
I want to but more switches like this, with dimmer, but I'm not fully sure if it's possible to dimmer them with Araduino.

Thank you !!!
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 29, 2014, 06:21 pm
purceno, I, too, have non-dimmable switches, so I didn't test that feature and can not tell you for sure if it would work.

Sincerely,
Sergey.
Title: Re: Control Livolo switches / Livolo switch library
Post by: purceno on Jan 29, 2014, 07:26 pm
That's fine. I will need to buy other 6 switches.
I will buy at least one with dimmer function to test.
I will need to buy a remote control also, to get the id of the dimmer function (using the code provided to recognize the buttons)

Thank you!
Title: Re: Control Livolo switches / Livolo switch library
Post by: icofjm on Feb 19, 2014, 11:07 am
Hello Purceno,
I tried with versions dimmer and is working with the buttons you just interfacciarti dimmers, memory should use the button 5/6, however, control tonight and let you know. The only thing that you have and find ways to manage the rise time and dropped to be able to take full advantage.
Title: Re: Control Livolo switches / Livolo switch library
Post by: vant on Mar 14, 2014, 04:16 am
Hello all

I am new to the forum and I would like to  get involved with what happening with the Livolo switches. I downloaded Livolo library (many thanks Spch).  I just bought a 2 gang switch with a VL-RMT01 remote control and I would like to decode codes send by this Livolo remote.

In the Livolo library, the are three files ( livolo.ccp, livolo.h and readme.txt) with 1 folder called "examples". If I want to decode the Livolo remotes, what should I do and where or how to put those codes posted by daleldalel (many thanks daleldalel). 

Could you kindly please provide some instructions.

Many thanks,
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Mar 16, 2014, 07:56 pm
vant,

Just read your remote codes with daleldalel's sketch and use them with Livolo library as per examle.
Title: Re: Control Livolo switches / Livolo switch library
Post by: vant on Mar 17, 2014, 02:00 am
Hi Spch,

Many thanks for your reply but how can I use the code? Do I just open a text editor, copy and paste in the codes and save it as file.h (in the livolo libary)?

In your Livolo library that you posted, there are files and folder. But daleldalel only posted the codes.  How can I turn the codes into a sketch to read my remote. Sorry for I am a bit slow, please help me!

Many thanks. 
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Mar 17, 2014, 07:24 am
vant,

First of all, you don't have to modify Livolo library files in any way (but you can modify example) and you don't have to save your sketch (program code) as *.h unless you want your own library.

Arduino Guide to libraries (http://"http://arduino.cc/en/Guide/Libraries") will give you basic understanding of what Arduino library is and how it is installed.

To get everything working you will need ASK/OOK 433.92 MHz transmitter and receiver. Like these (http://"http://www.ebay.com/itm/433Mhz-RF-transmitter-receiver-link-kit-for-Arduino-ARM-MC-U-remote-control-CM-/360738360630?pt=AU_B_I_Electrical_Test_Equipment&hash=item53fdae8d36") for example. You will also need to solder antennas to them (about 175 mm of wire).

Make sure you connected transmitter and receiver right.

Transmitter: DATA to pin 8; GND to GND; VCC to 5V;
Receiver: DATA to pin 2; GND to GND; VCC to 5V;

In case you want to use Arduino along with your existing remote, you will need to read your remote's codes. That is what daledale's code (http://"http://forum.arduino.cc/index.php?topic=153525.msg1560970#msg1560970") for.

1) Copy and paste it  (http://"http://forum.arduino.cc/index.php?topic=153525.msg1560970#msg1560970")into Arduino IDE (e.g. start Arduino IDE or use File/New inside open Arduino IDE).
2) Upload to Arduino
3) Open Serial monitor
4) Press original remote buttons you wish to use with Arduino
5) Write down codes shown in Serial monitor window (remote ID and button code).

In case you don't need your remote, you can use button map as in readme.txt file.

Now you can test your own code to control switches with Arduino:

1) Install Livolo library into Arduino IDE (see above, or just copy Livolo folder under your Arduino\libraries folder)
2) Open blink.ino example from Livolo library (File/Examples/Livolo/blink). It will give you something to start with.
3) Replace remote ID and button code in "livolo.sendButton(6400, 120);"  with any pair that you wrote down earlier.
4) Make sure you "paired" switch with the same button of the original Livolo remote.
5) Upload to Arduino
6) "Paired" switch now must turn on and off every 3 seconds

You can switch on/off any "paired" switch like this. Just be sure to include Livolo library in your project ("#include <livolo.h>" in example) and use Livolo method to create a Livolo instance ("Livolo livolo(8);" in example)

Note, that you won't be able to control "unpaired" switches. There are two ways to pair switch: use original remote or:

1) Open blink example
2) Replace remote ID with your remote ID
3) Replace button code with a button to pair switch with
4) Upload code to Arduino
5) Put target switch into learning mode
6) Switch will beep and pair in case you did it right.

Sorry, I'm not sure if I can tell more than this. I really tried to make it as simple as I could.
Title: Re: Control Livolo switches / Livolo switch library
Post by: vant on Mar 17, 2014, 10:36 pm
Hi Spch,

I brought the arduino UNO to decode the signals send out from my Watts Clever sockets remote. I could not decode the Livolo switches but with your helps and instructions, I can now.

Thank you very much and I ready appreciate your time and efforts to write up the instructions. If there anything I can help you back please let me know. I am currently working on a project using raspberry pi and web app such Amote to  control my home theatre, power sockets and wall light switches. I got the first two working perfectly. I will try to see whether I can make the Livolo light switches to work.

Best Regards

Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Mar 19, 2014, 06:46 pm
Hi vant,

Glad to know you did what you wanted. In case you missed it: here is a port of Livolo library for Raspberry (http://"http://forum.arduino.cc/index.php?topic=153525.msg1537781#msg1537781").
Title: Re: Control Livolo switches / Livolo switch library
Post by: seagorf7 on Mar 25, 2014, 10:11 am
hi guys,
thnks for your work

i got my livolo to work thru vocal using android phone, pretty impressive. i used app inventor from the mit to create the app ( no coding)

i also found a IR and RF decoder very nice coz would create a arduino sketch to  repoduce almost any wave
( didn t get it going right yet, when i send a code i decoded, i get another code...)
for thosee getting an error at int message_code_start_816[0]       = {3}; change the 0 to the nymber of colums you got between  { } then it compiles...

check it it worth it
http://sequencedecoder.weebly.com/sequencedecoder.html
Title: Re: Control Livolo switches / Livolo switch library
Post by: Fantt on May 04, 2014, 12:37 pm
Hi to all! really require your help! I bought kopou switches and try to manage them with the arduino. Tried to alter the code https://github.com/platenspeler/LamPI-1.9/blob/master/receivers/kopou/kopou.cpp (https://github.com/platenspeler/LamPI-1.9/blob/master/receivers/kopou/kopou.cpp) for arduino, but the result can be got :) anyone have a working sketch for arduino for these switches?
Title: Re: Control Livolo switches / Livolo switch library
Post by: Fantt on May 04, 2014, 12:44 pm
Also, the manufacturer sent me a signal circuit breakers (http://imglink.ru/thumbnails/04-05-14/68ff08665a73d645f8158014af4dcd71.jpg) (http://imglink.ru/show-image.php?id=5bc908b4e972a3f4f66ea00704eb8d3d), may be it can help?
Title: Re: Control Livolo switches / Livolo switch library
Post by: purceno on May 05, 2014, 03:49 pm

Hello Purceno,
I tried with versions dimmer and is working with the buttons you just interfacciarti dimmers, memory should use the button 5/6, however, control tonight and let you know. The only thing that you have and find ways to manage the rise time and dropped to be able to take full advantage.


Hello icofjm

Do you know what code the remote control sends to dimmer+ and dimmer- ?

Thank you
Title: Re: Control Livolo switches / Livolo switch library
Post by: CalDude on May 13, 2014, 08:31 am
Has anyone seen this? Thoughts?  Total BS?
Guy using a livolo switch supposedly a zwave application detected the switch press.

https://www.youtube.com/watch?v=clEKeWASCFU
Title: Re: Control Livolo switches / Livolo switch library
Post by: torinnguyen on May 18, 2014, 08:16 pm
I figured out a pattern for the Remote ID to be used with this library.

Fullsize remote ID has this pattern: remoteID = 1 + N*3;
where N is any integer number you choose starting from 0 to 21884 (so that the output doesn't exceed 65535)
the result are as examples: 1,4,7,10,13,...,6400,6403,6406....
Mini remote ID is the rest of the numbers besides the fullsize ID ones.

You have to use the correct keycodes (listed below) for the correct type of remote, otherwise it doesn't work at all.

Keycodes for fullsize remote
#1: 0, #2: 96, #3: 120, #4: 24, #5: 80, #6: 48, #7: 108, #8: 12, #9: 72; #10: 40, #OFF: 106
(http://www.wlacznikidotykowe.pl/images/Livolo-Remote.png)

Keycodes for Mini remote
#A: 8, #B: 16, #C: 56, #OFF (a.k.a #D): 42
(http://thumbs3.ebaystatic.com/d/l225/m/mYCXaNwCP7gl8JI7136B0-Q.jpg)
Title: Re: Control Livolo switches / Livolo switch library
Post by: torinnguyen on May 18, 2014, 08:22 pm

Has anyone seen this? Thoughts?  Total BS?
Guy using a livolo switch supposedly a zwave application detected the switch press.

https://www.youtube.com/watch?v=clEKeWASCFU


I'm the guy that hacked this. If you don't think it's real, it's your choice.
It's not my duty to explain it to you how it works.

Btw, this is off topic, we are talking about Arduino + Livolo here, nothing to do with ZWave.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Arank on May 19, 2014, 09:19 pm
Great job guys.

There is anyway to see if the livolo switches are on or off from arduino?
Title: Re: Control Livolo switches / Livolo switch library
Post by: torinnguyen on May 20, 2014, 03:16 am

Great job guys.

There is anyway to see if the livolo switches are on or off from arduino?


It's not possible wirelessly because Livolo switch doesn't contain a transmitter.

However, if you open up the Livolo switch, you'll able to tap on the LED pins on their microcontroller & connect it to Digital Input on Arduino. It's not a very clean solution though.
Title: Re: Control Livolo switches / Livolo switch library
Post by: pronsta on May 22, 2014, 12:04 pm
hi,

I managed to control my livolo switches using my arduino uno thanks to you guys! have two questions.

1. How can I print the binary or hex command to turn of the lights and on?
2. I have a ninja block and can I just use the RF hex or binary command code to turn on and off the lights? 

thank you in advance
Title: Re: Control Livolo switches
Post by: iambenq on Jun 19, 2014, 04:34 am
hi winnaing

It's really like the noise and difficult to find the code :(


hi spch
As I said earlier, I have purchased koti light switch. It is working perfect.
After I received fsk transmitter and receiver, I tried to decode them. Again, I have no talent to interpret their code properly.
I used Goldwave software to decode. Can you help me to have a look the wave file that I captured?
There are 3 files. kotiT is captured transmitted code only, kotiR is feedback signal from light switch and kotiTR is combined transmitter+feedback signal.
My opinion on this switch is that it is better then Livolo, in terms of design and functionality. In addition, it send back status signal.
Everybody who work with rf transmitter/receiver know that sending rf signal is not reliable. If we know the status of the receiver, it is perfect.
Thanks in advance.

Regards
Title: Re: Control Livolo switches / Livolo switch library
Post by: cssmcp on Jun 24, 2014, 10:01 am
First of all , For nice share thanks a lot . As much as I can what is written've tried to read english everything :)I have LIVOLO switc available,I provide remote control so far so great

However , I want to ask some questions

1 - The switch, How can I find that remote ID ?.So far I've found through trial and error.Well if I plug a lot of switch Can I preset remote ID Every switch?
2 - Each switch the shutdown command to a different drive? I'm using Currently shutdown id = "106" and ? can close only the one switch, If I were plug more than one switch and when I send "106" Command from RF transmitter the switch ,that all open position switches close did?
3 - Look far as I up to 9 hard code the assignment I can .15-20 units LIVOLO switches if I have if for each separate programming think I could do. (Each one remote id of different and shutdown remote was in a different way)
Title: Re: Control Livolo switches / Livolo switch library
Post by: cssmcp on Jun 26, 2014, 04:49 pm
Please help me:(
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jul 02, 2014, 08:48 pm
Hi cssmcp,

I'm not sure if I got you right, but here are my thoughts.

Most important: Livolo switches accept commands only from paired remotes. So you will have to pair each switch with remote you want to use.

In case you want to find out remote ID of an existing hardware remote use daleldalel's code (http://forum.arduino.cc/index.php?topic=153525.msg1560970#msg1560970). You will need Arduino and 433 MHz receiver for this.

In case you are not sure what remote ID is good for your switches, consult brilliant discovery by torinnguyen (http://forum.arduino.cc/index.php?topic=153525.msg1728584#msg1728584).

You can pair any compatible Livolo switch with any valid remote ID (both hardware or software emulated). Just put your switch in learning mode and press corresponding button on hardware remote or send command using Arduino and Livolo library. Switch then should accept command and pair with remote or its emulation.

"All off" command (106) is good for any number of switches wich are paired with certain remote. In case switch is not paired with remote that you use to send "All off" (106) command, it will ignore command.

There are several ways out in case you have more switches than number of buttons on the remote:

1) You can group some switches so that one button of the remote switches on or off several switches at once.

2) You can use different room buttons on full sized hardware remote (that will give you about 30 switch buttons).

3) You can emulate almost as many as you like remotes with Arduino and Livolo library.
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jul 02, 2014, 08:55 pm
Hi pronsta,

Sorry for super long delay with answer.

I don't quite understand what you mean by "print binary or hex code to switch..." because I'm not sure where you intend to print this code. There must be some end point for that, right?

In theory, you can do this for sure, but you will have to build your own Livolo control library that accepts binary or hex code and thranslates it into proper sequence for RF transmission. That is exactly what my implementation of Livolo library does and it is (as you can see) pretty straightforward.

I did my best to make its use as simple as multiplying 2 by 2. That is why it accepts binary remote IDs and switch command codes.

ps. In case you wanted to print hex/binary to RF transmitter - no, that won't work. You need a software layer to translate code into switch command in accordance with Livolo protocol.
Title: Re: Control Livolo switches / Livolo switch library
Post by: cssmcp on Jul 03, 2014, 01:01 pm
Hi spch,
Thank you very much:) for sharing opinion very useful for me again thanks a lot.
Title: Re: Control Livolo switches / Livolo switch library
Post by: dadarara on Sep 27, 2014, 06:58 pm
Hello people

looking for help.
I am trying to make  Domotiga (www.domotiga.nl)  control my LIVOLO lights at home.
Hope maybe some of you the experts, would be willing to try and make this work? And instruct me how to do it.
I am not expirianced in Linux and all my knowledge is from reading and learning from the net.
I know how to make the Domotiga work on RaspberryPi, I also made the XBMC work together on the same install.

I know that I need WiringPi  to work in domotiga. There is some development going on on this https://www.domotiga.nl/projects/domotiga/wiki/WiringPi

I don't have enough knowledge to make all this work together :  the library of the LIVOLO switches + WiringPi in Domotiga.

So maybe one of you would read this and be willing to try.
Title: Re: Control Livolo switches / Livolo switch library
Post by: infantilo on Oct 03, 2014, 09:31 am
HI!
I'm just wondering, if we could use the great livolo library (AND the cool livolo receiving code from dadarara) together with the rcswitch library????

I'm using the rcswitch library to receive data from my window contacts, smke detectors,motion detectos and remotecontrols and for switching my powerplugs. It would be great if i could switch my livolo switches from the same sketch, too.
(and i'd prefer to be able to receive the livolos keychain remote command within the sketch and display them there for easier future configuration.)

Any hints?

many thanks for any help!!!!
Title: Re: Control Livolo switches / Livolo switch library
Post by: samehhady on Oct 19, 2014, 06:01 pm
Hello Guys,

First of all thank you for this great library!
I am having an issue with the transmitting range, I can perfectly control the switches with maximum 2m range away from switches, I am already using 15 cm wire as an antenna.

Anyone facing the same issue or is it just my transmitter?
Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Oct 23, 2014, 11:18 pm
HI!
I'm just wondering, if we could use the great livolo library (AND the cool livolo receiving code from dadarara) together with the rcswitch library????

I'm using the rcswitch library to receive data from my window contacts, smke detectors,motion detectos and remotecontrols and for switching my powerplugs. It would be great if i could switch my livolo switches from the same sketch, too.
(and i'd prefer to be able to receive the livolos keychain remote command within the sketch and display them there for easier future configuration.)

Any hints?

many thanks for any help!!!!
I don't see why not. I was using Livolo before, but I am using another similar switch now together with RCSwitch. You probably need to call the RCSwitch setup function again after every transmission to your switch.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Oct 23, 2014, 11:27 pm
Hello Guys,

First of all thank you for this great library!
I am having an issue with the transmitting range, I can perfectly control the switches with maximum 2m range away from switches, I am already using 15 cm wire as an antenna.

Anyone facing the same issue or is it just my transmitter?
The commonly used 433 transmitter supports up to 12v, maybe you can try increasing the voltage. I get very good range powering it with 12v along with a helical antenna.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Rberg on Nov 11, 2014, 12:26 am
The commonly used 433 transmitter supports up to 12v, maybe you can try increasing the voltage. I get very good range powering it with 12v along with a helical antenna.
That is correct,
I've experienced a range increase by using 12V.
Title: Re: Control Livolo switches / Livolo switch library
Post by: zachnfine on Dec 19, 2014, 07:10 pm
Man how I wish these switches were UL listed. They look like fun and are probably fine. But I can't go installing switches in my house that my homeowners' insurance might use as an excuse to invalidate my coverage should there ever be an electrical event or fire.
Title: Re: Control Livolo switches / Livolo switch library
Post by: craigcurtin on Dec 20, 2014, 10:44 am
It's not possible wirelessly because Livolo switch doesn't contain a transmitter.

However, if you open up the Livolo switch, you'll able to tap on the LED pins on their microcontroller & connect it to Digital Input on Arduino. It's not a very clean solution though.
You should be able to put a volatage/current sensing circuit onto the output of the Livolo switch and have the output of that feedback to your Arduino to know if the Livolo is turned on or off - but natively no there is not any feedback mechanism from the switch itself
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jan 03, 2015, 05:04 pm
Happy New year everyone!

Recently I've been promted that Livolo switch library won't work when used together with famous IRremote library (https://github.com/shirriff/Arduino-IRremote).

My best guess is that IRremote relies on interrupts which, in turn, mess up Livolo library's timings. I have at least one confirmation that call to Livolo switch library wrapped in noInterrupts()/interrupts() works just right.

Tried to do wrap directly in library, but it won't compile then. Still you can try to disable interrupts in your code.
Title: Re: Control Livolo switches / Livolo switch library
Post by: ukjbrown on Mar 03, 2015, 02:12 pm
Has anyone tried this with the Broadlink light switches? I'm pretty sure they are made by the same company, but are designed to be controlled using the Broadlink RM2 smart controller rather than a handheld controller. They're still 433mhz.
Title: Re: Control Livolo switches / Livolo switch library
Post by: alhinai21 on May 23, 2015, 12:47 am
any one try to remove the RF-receiver on the switch and replace it with something different ESP8266 for example ??

that is what i'm trying to do. put I did not get it to work i have tried every thing i know!

any one to help? even with ideas?
 

(http://s11.postimg.org/fb53iji3n/IMG_20150523_023106_01.jpg)  
the image show the RF-receiver and it have 5 pins
ANT GND 3VDC DER DATA

the red wires i just put them for testing, i was trying to read the signal but i cant  :smiley-confuse:

there is this video showing it possible without RF
https://www.youtube.com/watch?v=9kSBTUN_2as
 (https://www.youtube.com/watch?v=9kSBTUN_2as)
but there is no info how he did it ?

and also this post http://www.futuretab.com/?p=298 (http://www.futuretab.com/?p=298)
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Jun 12, 2015, 03:40 pm
any one try to remove the RF-receiver on the switch and replace it with something different ESP8266 for example ??

You could try connecting you reading wires to GND and DATA. In case you have pules there when pressing remote button, you can use these to feed codes to the switch.

Then you will have to find a way to teach ESP8266 to generate proper codes or send them via wi-fi from another ESP8266 or compatible hardware.
Title: Re: Control Livolo switches / Livolo switch library
Post by: ranhaber on Jun 17, 2015, 02:32 pm
Does anybody know what kind of touch pad they use in the Livolo switch?
How\Where can I buy them?
My thoughts are building the touch pcb by myself with my controller, so I don't need to live with the "hell protocol" Livolo made.
Title: Re: Control Livolo switches / Livolo switch library
Post by: platenspeler on Aug 13, 2015, 06:29 pm
Hi to all! really require your help! I bought kopou switches and try to manage them with the arduino. Tried to alter the code https://github.com/platenspeler/LamPI-1.9/blob/master/receivers/kopou/kopou.cpp (https://github.com/platenspeler/LamPI-1.9/blob/master/receivers/kopou/kopou.cpp) for arduino, but the result can be got :) anyone have a working sketch for arduino for these switches?
It has been a loooooong time, but I bought my first Arduino 2 weeks back and I have ported the Livolo/Kopou receiver as part of my LamPI project. You can find the latest Arduino code on http://github.com/platenspeler and then look for the Arduino code for the gateway.

You may have to do some work though, but the Transceiver433.ino sketch shows how the code works. The sketch will listen for Kaku, Impuls/Action, Kopou and Livolo messages and reports the values read over the USB line to the Raspberry.

Also if you have a terminal connection to the Arduino, you can use a teminal screen and give commands and see responses that way.

Maarten
Title: Re: Control Livolo switches / Livolo switch library
Post by: baikonur on Sep 05, 2015, 04:07 pm
Hi Guys,

Do you know whether there is any conflict with IRlib library and livolo ?
If I use only livolo.h I can decode and also send the commands and all work OK, however if in the same sketch I use IRlib.h with  My_Receiver.enableIRIn(); // Start the receiver then the transmitter does not send the command.

I tried to change the interrupt in the IRLibTimer.h, but it does not help.

Any ideas?
Title: Re: Control Livolo switches / Livolo switch library
Post by: naghmeh on Sep 07, 2015, 06:41 pm
Hi Guys,

I have bought this light switch:

http://www.livoloeurope.eu/livolo-wifi-touch-light-switch-with-glass-panel-vl-c701-11 (http://www.livoloeurope.eu/livolo-wifi-touch-light-switch-with-glass-panel-vl-c701-11)

Does anyone know if it works well with http://www.broadlink.com.cn/home/product.php?mod=RMPro#pro-head0 (http://www.broadlink.com.cn/home/product.php?mod=RMPro#pro-head0) Rm Pro Broadlink?


If it works please let me know which type of broadlink is better for me "Rm Pro" Or "Rm Home"

Thanks in advance

Naghmeh
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Oct 15, 2015, 10:53 am
Hi,

There is indeed a conflict. You must disable interrupts before calling Livolo functions and enable them after that.

Do you know whether there is any conflict with IRlib library and livolo ?
Any ideas?
Title: Re: Control Livolo switches / Livolo switch library
Post by: pichalsi on Dec 03, 2015, 03:42 pm
Hi,
I am waiting for the delivery of my ordered Livolo switch to experiment with it. In the mean time one question I saw a few times in this thread but no definitive answer:
Is there a button/code to send just "on"? E.g. I want the Arduino to turn the light on, but not off if its already on (based on sensor input or whatever).

Thanks!
Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Dec 14, 2015, 03:34 am
Hi,
I am waiting for the delivery of my ordered Livolo switch to experiment with it. In the mean time one question I saw a few times in this thread but no definitive answer:
Is there a button/code to send just "on"? E.g. I want the Arduino to turn the light on, but not off if its already on (based on sensor input or whatever).

Thanks!
Not to my knowledge. There seems to be only a command to toggle the status of the switch, and a command to turn off ALL switches(if more than 1 gang will turn off all at once).
Title: Re: Control Livolo switches / Livolo switch library
Post by: izumo on Dec 14, 2015, 07:01 pm
Hi
I try to control livolo switch by tv pilot.
Can anyone tell me what i do wrong?

Code: [Select]

#include <IRremote.h>
#include <livolo.h>
#define irPin 9
IRrecv irrecv(irPin);
decode_results results;
Livolo livolo(8);

void setup() {
 Serial.begin(9600);
  irrecv.enableIRIn();
}

void loop() {
 if (irrecv.decode(&results)) {

     switch (results.value) {
        case 0xBDA857:
           livolo.sendButton(20313, 15);
           delay(1000);
           break;      
  }

  irrecv.resume();
  }
}


When i checked in serial monitor, ir recive code from tv pilot, but program do not send rf code to livolo switch.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Dec 15, 2015, 01:18 am
Does it work when you exclude the IR code? Have you tried pairing and using the predetermined keycodes and IDs included in the example sketch?
Title: Re: Control Livolo switches / Livolo switch library
Post by: pichalsi on Dec 17, 2015, 10:45 am
Not to my knowledge. There seems to be only a command to toggle the status of the switch, and a command to turn off ALL switches(if more than 1 gang will turn off all at once).
Thanks
another question - what kind of range/reliability are you getting with the switches? Using the default settings, over 5m and 1 concrete wall, the switch won't work 1 out of 5 times. I have tried 9v battery which improved the success rate, and then a 17cm whip into the antena which didn't help at all (only plug not soldered - maybe thats the problem?)
So should I invest in tuning the transmitter or is this error rate normal?
Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Dec 17, 2015, 11:06 am
Thanks
another question - what kind of range/reliability are you getting with the switches? Using the default settings, over 5m and 1 concrete wall, the switch won't work 1 out of 5 times. I have tried 9v battery which improved the success rate, and then a 17cm whip into the antena which didn't help at all (only plug not soldered - maybe thats the problem?)
So should I invest in tuning the transmitter or is this error rate normal?

To get maximum range, I am applying 12v to it. I am using this DIY antenna (https://arduinodiy.wordpress.com/2015/07/25/coil-loaded-433-mhz-antenna/) which you can make using wire, and it appears to be working very well. Initially I tested 3m through 3 concrete wall and had no problems.
Title: Re: Control Livolo switches / Livolo switch library
Post by: pichalsi on Dec 17, 2015, 09:16 pm
Thanks, I played with the switch today and got much better results. Yesterday I used raspberry and the antenna was right next to it, and maybe 3 out of 10 transmission failed. Today Arduino and powered the transmitter with 9V battery, and it was already a little bit better. Then I tried your antenna and got maybe 9/10 successful transmissions over 5m, 2 walls. Last improvement was dipole as explained in 2nd post of this thread - https://forum.arduino.cc/index.php?topic=320294.0 (https://forum.arduino.cc/index.php?topic=320294.0), and that also made a nice difference, now maybe only 1 in 40 fails, but that's hard to measure manually - finally I am satisfied with it :)

And one more thing - I found out I don't have Livolo switches, previously I thought it's a cheaper copy, but they are different. Turns out I can program one button for switch, one for ON and one for OFF. And they are very easy to reverse using rc-switch - it detects the code right away. It is this one http://www.aliexpress.com/item/Remote-1-Gang-1-Way-EU-Standard-Touch-Switch-Black-White-Gold-Crystal-Glass-Switch-Panel/32344370639.html  (http://www.aliexpress.com/item/Remote-1-Gang-1-Way-EU-Standard-Touch-Switch-Black-White-Gold-Crystal-Glass-Switch-Panel/32344370639.html)
A month ago I thought it impossible to find a switch without a neutral line, now this one even works with my 10W LEDs... So now that I can control it it's perfect :)
Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Dec 18, 2015, 09:17 am
Good to know, there weren't as many choice 2 years ago as currently. Now there are many copies at very attractive prices. I actually stopped using Livolo for quite some time, I am using this now https://www.itead.cc/smart-home/switch/itead-touch-network-intelligent-switch-with-2-touch-buttons.html (https://www.itead.cc/smart-home/switch/itead-touch-network-intelligent-switch-with-2-touch-buttons.html). I bought it mainly because of it's feedback ability, and it also has dedicated on/off commands, instead of toggle.

The feedback mechanism tells you the status of the switch, which you can receive via 433 receiver. But I discovered the reliability is terrible. It's hit and miss, sometimes the command is not sent at all, sometimes when you request the status from the switch, it turns on the light instead.

Frankly if I have to buy a new switch today, I won't choose livolo(the old one I have), as they don't have the dedicated on/off command, which is very useful for automation, and knowing that other switches can now be decoded using rc-switch.
Title: Re: Control Livolo switches / Livolo switch library
Post by: bnikos83 on Dec 19, 2015, 12:33 pm
Frankly if I have to buy a new switch today, I won't choose livolo(the old one I have), as they don't have the dedicated on/off command, which is very useful for automation, and knowing that other switches can now be decoded using rc-switch.
Hello to everyone,

i recently also ordered a livolo wall switch/dimmer and i am bumped to see that its commands are not easily duplicated.

Does anyone have a good alternative to recommend for an EU wireless wall led switch/dimmer that will be good for automation purposes?

Thank you in advance,
Nick
Title: Re: Control Livolo switches / Livolo switch library
Post by: izumo on Dec 26, 2015, 10:59 pm
when i load program
Code: [Select]

#include <IRremote.h>
#define irPin 9
IRrecv irrecv(irPin);
decode_results results;
 
void setup() {
   Serial.begin(9600);
   irrecv.enableIRIn();
}
 
void loop() {
   if (irrecv.decode(&results)) {
 
      switch (results.value) {
         case 0xBDA857:
            Serial.println("ir");
            digitalWrite(6, HIGH);
            delay(1000);
            digitalWrite(6, LOW);
            break;
 
         }
 
   irrecv.resume();
   }
}


i see text "ir" in serial monitor and voltage on pin 6

if i load program
Code: [Select]

#include <livolo.h>
Livolo livolo(8);

void setup() {
 pinMode(6, OUTPUT);

}

void loop() {
  if (digitalRead(6) == HIGH){
   livolo.sendButton(20313, 13);
      }
}


arduino turn on and off livolo switch when i press button connected to pin6


but if i load program
Code: [Select]

#include <IRremote.h>
#include <livolo.h>
#define irPin 9
IRrecv irrecv(irPin);
decode_results results;
Livolo livolo(8);

void setup() {
  Serial.begin(9600);
   irrecv.enableIRIn();
   pinMode(6, OUTPUT);
  

   }

void loop() {
  if (irrecv.decode(&results)) {
 
      switch (results.value) {
         case 0xBDA857:
           Serial.println("ir");
           digitalWrite(6, HIGH);
          
          
         break;
                
   }
 
   irrecv.resume();
   }
   if (digitalRead(6) == HIGH){
   livolo.sendButton(20313, 13);
   delay(1000);
   digitalWrite(6, LOW);
   }
   }


i see text "ir" in serial monitor but my livolo switch didnt work, arduino do not send rf code.
So maybe someone could tell me what i do wrong.
I am very noob about this arduino staff :)

I think this 2 libraries IRremote.h and livolo.h cant work together for some reason
Title: Re: Control Livolo switches / Livolo switch library
Post by: thecrater on Jan 02, 2016, 12:38 am
Hello to everyone,

i recently also ordered a livolo wall switch/dimmer and i am bumped to see that its commands are not easily duplicated.

Does anyone have a good alternative to recommend for an EU wireless wall led switch/dimmer that will be good for automation purposes?

Thank you in advance,
Nick
I would also like to your recommendations for switches with status reporting ability (bi-directional communication) but also reasonably priced. There are some Livolo switches on AliExpress for under £10.
Title: Re: Control Livolo switches / Livolo switch library
Post by: zeroprime790 on Jan 04, 2016, 09:31 pm
Hello,

I would like to know if it is possible to reverse the process. In detail, I would like to re-use the livolo remote and use the RF frequency of one button in order to send a command to arduino.

For example i want a LED to blink when the arduino RF receiver get the signal from the remote.

Is that possible?

Thank you,
George
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Feb 05, 2016, 11:49 am
I think this 2 libraries IRremote.h and livolo.h cant work together for some reason
Yes, they can not work together, and this has been reported at least twice in this thread. Disable interrupts (https://www.arduino.cc/en/Reference/NoInterrupts) before calling livolo part of the code and enable them after that.
Title: Re: Control Livolo switches / Livolo switch library
Post by: spch on Feb 05, 2016, 11:59 am
I would like to know if it is possible to reverse the process. In detail, I would like to re-use the livolo remote and use the RF frequency of one button in order to send a command to arduino.
Check daleldalel's code (http://forum.arduino.cc/index.php?topic=153525.msg1560970#msg1560970) to receive Livolo remote codes. This shoud be enough for the start.
Title: Re: Control Livolo switches / Livolo switch library
Post by: seederp2p on Mar 10, 2016, 10:01 pm
Hello!

Sorry for the off-topic.

I want to do a little automation in my house.

I don't want to use arduino or raspberry because I'm not a programmer.

This topic came into my research because it has lots of information on how livolo switches work.

I want to use a Broadlink RM2 Pro device where I can teach the RF codes. The problem is, as many of you already mentioned, the lack of a seperate on / off function.

I can live with that as far as I can at least turn off all the "gags" separately (per switch).


In lay terms, if I buy 1 small remote for each switch will it interfere with other switches synced with diferent remotes?

This would allow me, at least, to turn off all the lights from a specific room... leaving others on (if it's on).

Thank you!
Title: Re: Control Livolo switches / Livolo switch library
Post by: gilzin on Mar 13, 2016, 08:23 pm
guys and girls
really need your help
i am using RPI 2 and just cant control my livolo switches
i have tried this :
https://github.com/platenspeler/LamPI-2.0/tree/master/transmitters/livolo
but still, i cant find the right syntax
does anybody in the world did it? controlling livolo light switches with RPI?

regards
G
Title: Re: Control Livolo switches / Livolo switch library
Post by: victorhalla on Mar 15, 2016, 02:27 pm
Hello,

I1m using arduino to act as a remoto control to sync with Livolo Switches, then I'm using Broadlink RM Pro to learn the codes and be able to control the switches remotelly.

I can suscessfully control the switches with Arduino, but the code Broadlinkll RM Pro learns does not work as desired. If I send the command from Broadlink RM Pro it fails about 50% (5/10).

Someone knows how the Broadlink send de codes or can share a code that works better, not fail 50%.

Attached is the code I created to sync remoteid with switch and send command to switches:

#include <livolo.h>

Livolo livolo(8); // transmitter connected to pin #8

#define HELP_HEADER 'h'   // Header tag for help function
#define RUN_HEADER 'r'   // Header tag for remote function
#define SYNC_HEADER 's'   // Header tag for sync function

// Buffer to store incoming commands from serial port
String inData;
String title = "Livolo Arduino Controller v.1";
String prompt = "Command: ";
String cme = "Error";
String cmo = "Ok";
String cmu = "Unknow command";
int pos = 0;
char command;
int remoteID = 6400;
int remoteCMD = 120;

void setup() {
 pinMode(13, OUTPUT);
 
 // start serial port
 Serial.begin(9600);

 // Inital Screen
 Serial.println();
 Serial.println(title);
 Serial.print(prompt);

}

void loop() {
 // Read from Serial
 ReadFromSerial();
 delay(1000);
}

// Read Data from Serial Console
void ReadFromSerial () {
 while (Serial.available() > 0) {
   char recieved = Serial.read();
   pos++;
   inData += recieved;
   if (pos == 1) command = recieved;
   if (recieved == '\n' || recieved == '\r') {
     switch (command) {
       // Show Help
       case HELP_HEADER:
         ShowHelp();
         break;
       // Run Switch with RemoteID and Command
       case RUN_HEADER:
         RunCommand(inData);
         break;
       // Sync Switch with RemoteID
       case SYNC_HEADER:
         SyncCommand(inData);
         break;
       default:
         Serial.println(cmu);
     }
     
     inData = ""; // Clear recieved buffer  
     pos = 0;
     Serial.print(prompt);
   }    
 }
}

void RunCommand(String command) {
 Serial.println(command);
 if(command.length() > 7) {
   String work = command.substring(2);
   int l = work.indexOf(" ");
   remoteID = work.substring(0,l).toInt();
   remoteCMD = work.substring(l).toInt();

   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
   livolo.sendButton(remoteID, remoteCMD);
   digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
 
   Serial.println(cmo);
 } else {
   Serial.println(cme);
 }
}

void SyncCommand(String command) {
 Serial.println(command);
 if(command.length() == 7) {
   String work = command.substring(2);
   int l = work.indexOf(" ");
   remoteID = work.substring(0,l).toInt();

   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
   livolo.sendButton(remoteID, 120);
   delay(1000);
   livolo.sendButton(remoteID, 120);
   delay(1000);
   livolo.sendButton(remoteID, 120);
   digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
   
   Serial.println(cmo);
 } else {
   Serial.println(cme);
 }
}

void ShowHelp() {
 Serial.println(command);
 Serial.println(title);
 Serial.println("r <remoteid> <command>- Run command to Licolo Switch, ex: s 6400 120 (Send the command 120 to 6400");
 Serial.println("s <remoteid> - Sync with Licolo Switch, ex: s 6400 (Send the command 120 to remoteid");
 Serial.println("h - Show this help");
}
Title: Re: Control Livolo switches / Livolo switch library
Post by: tabvn on Jun 24, 2016, 12:26 pm
i 'm looking for helps with TC2 broadlink as well. i 'm still configure what kind of rf code need send when Switch flashing in learning mode.


here is inside of TC2 switch 3 gang http://i.imgur.com/9fSTeb5.jpg?1
Thank you
Title: Re: Control Livolo switches / Livolo switch library
Post by: Fourm on Aug 18, 2016, 10:21 pm
I really like the design of the levolo type switches and I'd like to use them, thing is i don't want all the mess with RF signals blasting everywhere and falling on deaf ears half the time, and i'm also not crazy about running mains power through cheap Chinese junk. No offense intended but a lot of the Chinese devices I've tested are essentially electrocution devices.

What i WOULD very much like is to use a levolo type switch on LOW voltage (5v would be great but i'd be willing to settle for 12) and use it as a simple switch to tell the arduino to turn the light on/off/dim etc.

But i don't see any way of doing this without seriously hacking up the switch itself to basically strip out the mains circuitry and convert it to a LV switch... which seems kind of a waste.

Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Aug 19, 2016, 07:01 am
I really like the design of the levolo type switches and I'd like to use them, thing is i don't want all the mess with RF signals blasting everywhere and falling on deaf ears half the time, and i'm also not crazy about running mains power through cheap Chinese junk. No offense intended but a lot of the Chinese devices I've tested are essentially electrocution devices.

What i WOULD very much like is to use a levolo type switch on LOW voltage (5v would be great but i'd be willing to settle for 12) and use it as a simple switch to tell the arduino to turn the light on/off/dim etc.

But i don't see any way of doing this without seriously hacking up the switch itself to basically strip out the mains circuitry and convert it to a LV switch... which seems kind of a waste.
First of all yes there is a lot of Chinese junk electronics, but this is not one of them. The responses in this thread prove that many are using it without issue. I personally had used the Livolo switch for a few years without any issue, before switching to another Chinese made switch, which has been running for 3 years now without problem.

The RF protocol used is accurate and stable, so I do not know where you get the "falling on deaf ears half the time" from. It works once and every time the signal is sent. And saying "RF signals blasting everywhere" only proves your lack of knowledge in RF.

If you want a low voltage version, you just need to get a little creative, it is not a hard project to build using the Arduino, TTP223, RF receivers/transmitters, and some simple materials.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Fourm on Aug 20, 2016, 05:08 pm
First of all yes there is a lot of Chinese junk electronics, but this is not one of them. The responses in this thread prove that many are using it without issue. I personally had used the Livolo switch for a few years without any issue, before switching to another Chinese made switch, which has been running for 3 years now without problem.

The RF protocol used is accurate and stable, so I do not know where you get the "falling on deaf ears half the time" from. It works once and every time the signal is sent. And saying "RF signals blasting everywhere" only proves your lack of knowledge in RF.

If you want a low voltage version, you just need to get a little creative, it is not a hard project to build using the Arduino, TTP223, RF receivers/transmitters, and some simple materials.
Ok well, thanks for your time, but I don't think i'll be using RF when i got perfectly good signal wire already in place and ready to go.
Title: Re: Control Livolo switches / Livolo switch library
Post by: snowbord on Oct 12, 2016, 10:54 pm
I personally had used the Livolo switch for a few years without any issue, before switching to another Chinese made switch, which has been running for 3 years now without problem.
Can you be so kind as to enlighten me regarding what switches you are now using? I am due to kit out a house with at least 15 switches and would not like to not get it 'right' the first time. I am using the RFXcom module.

Thanks.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Byork on Oct 14, 2016, 08:45 am
Can you be so kind as to enlighten me regarding what switches you are now using? I am due to kit out a house with at least 15 switches and would not like to not get it 'right' the first time. I am using the RFXcom module.

Thanks.
Yes  :)  but I don't think it would be much help. I am using a switch made by itead studio, however they don't seem to make that model anymore. It uses their own proprietary protocol, but they provided the arduino code for it. Maybe someone else can help you better.
Title: Re: Control Livolo switches / Livolo switch library
Post by: snowbord on Oct 18, 2016, 11:02 pm
Yes, I noticed that they don't do them anymore. They do have some other switch though, called the 'Sonoff Touch' - https://www.itead.cc/sonoff-touch.html (https://www.itead.cc/sonoff-touch.html)

I'm not convinced however. I did notice the following comment by pichalsi:

And one more thing - I found out I don't have Livolo switches, previously I thought it's a cheaper copy, but they are different. Turns out I can program one button for switch, one for ON and one for OFF. And they are very easy to reverse using rc-switch - it detects the code right away. It is this one http://www.aliexpress.com/item/Remote-1-Gang-1-Way-EU-Standard-Touch-Switch-Black-White-Gold-Crystal-Glass-Switch-Panel/32344370639.html  (http://www.aliexpress.com/item/Remote-1-Gang-1-Way-EU-Standard-Touch-Switch-Black-White-Gold-Crystal-Glass-Switch-Panel/32344370639.html)
A month ago I thought it impossible to find a switch without a neutral line, now this one even works with my 10W LEDs... So now that I can control it it's perfect :)
Has anyone else used these Aoyan switches? How well are they supported? They appear incredibly good value. https://www.aliexpress.com/af/aoyan.html (https://www.aliexpress.com/af/aoyan.html)
Title: Re: Control Livolo switches / Livolo switch library
Post by: snowbord on Oct 18, 2016, 11:15 pm
Also, what would you guys say to using standard Livolo switches and adding a custom 433 RF receiver relay of some sort, in order to avoid Livolo's dodgy protocol? The lack of dedicated on/off is a concern to me.

In that case, what solution would you recommend? I am just getting into this...
Title: Re: Control Livolo switches / Livolo switch library
Post by: Silvain on Oct 20, 2016, 05:59 pm
Hello everyone,

I trying to replace the PIC inside the livolo dimmer by a ESP8266. But There are 2 PIC inside, do you know witch one is the main controller ?

Thanks,
Title: Re: Control Livolo switches / Livolo switch library
Post by: Silvain on Oct 21, 2016, 12:08 am
Hello,

Bad news, the esp8266 consumes too much (80mA) and the power supply circuit does not hold the load.
But I found what pin that allows to control the relay.

There are two tracks where I will look:

Reprogram the pic and add a small sending module RF433.
or
Use a Bluetooth Low Energy Module nrf51822

See you for news
Title: Re: Control Livolo switches / Livolo switch library
Post by: snowbord on Oct 23, 2016, 01:03 am
Another mostly on-topic question.. I have noticed that Livolo do 2-way switches but no 2-way dimmers. To overcome this I was wondering if it would be possible to wire up a standard 1-way switch to a dimmer or a 2-way switch to a dimmer? Will this work and will this then mean the switch powers on at the level of the dimmer?

The only workaround here being LightwaveRF 2-way dimmers or Z-wave. Or if anyone has any creative solutions with Chinese 433 mhz relays, please be my guest and help me resolve this issue. A final idea being (Lightwave)RF / Z-wave dimmers placed after the Livolo switches...

This is actually a huge issue for me. Ideas very much welcome!
Title: Re: Control Livolo switches / Livolo switch library
Post by: Silvain on Oct 24, 2016, 06:04 pm
I think you can put a dimmer livolo then 1 relay (2 channels) for dimmer 2 lamps. But you can not light the 2 lamps at a time (there will be one that will remain off while you control another).

It is necessary that your circuit remains closed (by a lamp or the other) so that the dimmer livolo works.
Title: Re: Control Livolo switches / Livolo switch library
Post by: tyjtyj on Oct 29, 2016, 03:50 am
Hi All,

After struggling decoding the scene code. Finally, I managed to decode the scene.

The key code is
Scene 1 - 90
Scene 2 - 114
Scene 3 - 10
Scene 4 - 18

With this i managed to set the light to on and off.

Using different remoteID to send all off and send sceneid to get the correct scene.
Title: Re: Control Livolo switches / Livolo switch library
Post by: peca89 on Nov 01, 2016, 09:01 am
Did anyone try pairing Livolo switch with standard (EV1527 or similar) remote?

I suppose it does not work though, since everybody is talking about Livolo proprietary protocol...
Title: Re: Control Livolo switches / Livolo switch library
Post by: eyco on Nov 28, 2016, 09:03 pm
Hi All,

Do you know if the remote codes and the livolo library is also applicable to light switches from series C7 of livolo?

I am trying to send code to the light switch during the sync phase and it is not working.

I will appreciate any help.

Thx
Title: Re: Control Livolo switches / Livolo switch library
Post by: tsonga on Jan 18, 2017, 06:23 am
Thanks, I played with the switch today and got much better results. Yesterday I used raspberry and the antenna was right next to it, and maybe 3 out of 10 transmission failed. Today Arduino and powered the transmitter with 9V battery, and it was already a little bit better. Then I tried your antenna and got maybe 9/10 successful transmissions over 5m, 2 walls. Last improvement was dipole as explained in 2nd post of this thread - https://forum.arduino.cc/index.php?topic=320294.0 (https://forum.arduino.cc/index.php?topic=320294.0), and that also made a nice difference, now maybe only 1 in 40 fails, but that's hard to measure manually - finally I am satisfied with it :)

And one more thing - I found out I don't have Livolo switches, previously I thought it's a cheaper copy, but they are different. Turns out I can program one button for switch, one for ON and one for OFF. And they are very easy to reverse using rc-switch - it detects the code right away. It is this one http://www.aliexpress.com/item/Remote-1-Gang-1-Way-EU-Standard-Touch-Switch-Black-White-Gold-Crystal-Glass-Switch-Panel/32344370639.html  (http://www.aliexpress.com/item/Remote-1-Gang-1-Way-EU-Standard-Touch-Switch-Black-White-Gold-Crystal-Glass-Switch-Panel/32344370639.html)
A month ago I thought it impossible to find a switch without a neutral line, now this one even works with my 10W LEDs... So now that I can control it it's perfect :)
I got a similar light switch panel with dedicated on/off, I also bought their remote. But I am unable to sniff its remote code using rcswitch library.  As I don't have the knowledge to hack the remote, would you share your experience with the light switch u mentioned in terms of how easy to integrate with adrunio + esp8266 board? Thanks.
(https://world.taobao.com/item/45556723964.htm?fromSite=main&spm=a1z0k.7628869.0.0.nGt1Fk&_u=t2dmg8j26111)
Title: Re: Control Livolo switches / Livolo switch library
Post by: gui59169 on Jan 27, 2017, 01:45 pm
Hi All,

After struggling decoding the scene code. Finally, I managed to decode the scene.

The key code is
Scene 1 - 90
Scene 2 - 114
Scene 3 - 10
Scene 4 - 18

With this i managed to set the light to on and off.

Using different remoteID to send all off and send sceneid to get the correct scene.
perfect !
really usefull !

now have a real ON / OFF switch :) with 2 separate button :) GOOD
Title: Re: Control Livolo switches / Livolo switch library
Post by: leopucci on Jan 31, 2017, 12:58 am
seems that this has been achieved already
http://milillicuti.com/an-api-to-connect-your-broadlink-rm-pro-irrf-wifi-bridge-to-your-home-automation-system/
Title: Re: Control Livolo switches / Livolo switch library
Post by: tsonga on Feb 08, 2017, 04:54 pm
Just in case someone was looking for arduino code to decode Livolo remotes.

Code: [Select]

#define SIGNAL_IN 0 // INTERRUPT 0 = DIGITAL PIN 2 - use the interrupt number in attachInterrupt

volatile byte impulse = 0; // kolejny puls
volatile int bufor[53];
volatile boolean header = false;
volatile unsigned long StartPeriod = 0; // set in the interrupt
volatile boolean stop_ints = false;


void setup()
{
  attachInterrupt(SIGNAL_IN, calcInput, CHANGE);

  Serial.begin(9600);
}

void loop()
{
  if (stop_ints) //data in buffer
  {
    unsigned long binary = 1;
    //byte i = 0;
    for (byte j = 0; j < 46; j++)
    {
      //Serial.print(binary);
      if ((bufor[j] > 220) &&
          (bufor[j] < 400))
      {
        binary <<= 1;
        //binary |= 1;
        //i++;
        bitSet(binary,0);
      }
      else if ((bufor[j] > 90) &&
               (bufor[j] < 220) && (bufor[j + 1] > 90) &&
               (bufor[j + 1] < 220)) {
        binary <<= 1;
        j++;
        
      }
      else if ((bufor[j] > 90) &&
               (bufor[j] < 220) && (bufor[j + 1] > 220) &&
               (bufor[j + 1] < 400)) {
        binary <<= 1;
        bitSet(binary,0);
        //i += 2;
        j++;
      }
      else break;
          }
          //Serial.println(bitRead(binary,4));
    if (bitRead(binary,23))
    {
      bitClear(binary,23);
      Serial.print("remoteID:");
      Serial.print((binary / 128) & 65535);
      Serial.print(" - ");
      Serial.print("key code:");
      Serial.println(binary & 127);
    }
    else {
      Serial.println("wrong code  ");
      Serial.println(binary, BIN);
    }
    delay (1000);
    header = false;
    impulse = 0;
    stop_ints = false;

    // }
  }
}

// interrupt below...


void calcInput()
{
  // get the time using micros
  unsigned int duration = (int)(micros() - StartPeriod); // save pulse length to bufor
  StartPeriod = micros(); //begin next impulse
  //Serial.println(StartPeriod);
  if (stop_ints) return;
  if ((duration < 90) || (duration > 600)) goto reset; //impulse not right
  bufor[impulse++] = duration;
  if (duration < 415) return;
  if (!header)
  {
    header = true;
    impulse = 0;
    return;
  }
  else
  {
    if ((impulse < 23) || (impulse > 52)) goto reset; //too long or too short info
    stop_ints = true;
    return;
  }
reset:
  header = false;
  impulse = 0;
  return;
}




Thanks to platenspeler and spch

Improved code
Livolo has 2 kinds of remotes, the VL-RMT-03 & VL-RMT-04 (differ in the number of room buttons).
Would someone kindly confirm whether this code will decode the remote id of either or both? Thanks alot.

VL-RMT-03
https://www.aliexpress.com/store/product/Free-Shipping-Livolo-New-Style-Touch-Remote-Controller-Wall-Light-Remote-Switch-Controller-VL-RMT-03/500715_1583279856.html?spm=2114.12010608.0.0.DKXAde

VL-RMT-04
https://www.aliexpress.com/store/product/Free-Shipping-Livolo-New-Style-Touch-Remote-Controller-Wall-Light-Remote-Switch-Controller-VL-RMT-03/500715_32732528137.html?spm=2114.12010612.0.0.tvugAx

Title: Re: Control Livolo switches / Livolo switch library
Post by: tyjtyj on Mar 04, 2017, 12:07 am
I have VL-RMT-03 and it works.

I dont see any reason 04 wont work. The button numbering may be different but i dont see any possible the rf code is different.
Title: Re: Control Livolo switches / Livolo switch library
Post by: tsonga on Mar 04, 2017, 06:08 pm
Thanks for your reply.  After decoding my VL-RMT-04 remote, I realize that the remote id change for different room, while the keycodes remain the same.
Title: Re: Control Livolo switches / Livolo switch library
Post by: arduinotko on Mar 30, 2017, 05:23 am
Hi All,

After struggling decoding the scene code. Finally, I managed to decode the scene.

The key code is
Scene 1 - 90
Scene 2 - 114
Scene 3 - 10
Scene 4 - 18

With this i managed to set the light to on and off.

Using different remoteID to send all off and send sceneid to get the correct scene.
Hi,

How did you manage to set the light to on and off? I don't understand. Please advise. Thanks.
Title: Re: Control Livolo switches / Livolo switch library
Post by: wallyllama on Apr 18, 2017, 03:16 pm
Sorry if this is slightly off topic. I have Livolo switches without RF, I want to hard wire them. It tried connecting to the pads for the RF module; gnd, tx, der, and I blew up the switch, sounded like AC, magic smoke was released(relay board, not the pic). Anyone try this and suceed? If so is there code on he pic to recieve these codes. I'm assuming the rf module just transmits bits, and those same bits coming via a wire should work the same as an rf module.   

I have seen a project that changes firmware in the pic to provide a serial port, it looks like the use the actual rx line on the pic, ( on my board der is connected to rb6)
Title: Re: Control Livolo switches / Livolo switch library
Post by: elik745i on Apr 28, 2017, 05:54 pm
Sorry if this is slightly off topic. I have Livolo switches without RF, I want to hard wire them. It tried connecting to the pads for the RF module; gnd, tx, der, and I blew up the switch, sounded like AC, magic smoke was released(relay board, not the pic). Anyone try this and suceed? If so is there code on he pic to recieve these codes. I'm assuming the rf module just transmits bits, and those same bits coming via a wire should work the same as an rf module.   

I have seen a project that changes firmware in the pic to provide a serial port, it looks like the use the actual rx line on the pic, ( on my board der is connected to rb6)
Same question, just bought 2 switches without RF module, found that original RF module is based on micrf211 and it's possible to just add it and buzzer to get it working with remote. Searching for that RF module at the moment...
Title: Re: Control Livolo switches / Livolo switch library
Post by: Cleverhouse on Jun 11, 2017, 09:29 pm
I use decoding code in NodeMCU (ESP8266) board.
Reciever connected to D2 = GPIO 5 (interrupt 5, as i understand).
Press buttons on VL-RMT-04 remote and got nothing.
What i do whong?
Title: Re: Control Livolo switches / Livolo switch library
Post by: Cleverhouse on Jun 16, 2017, 11:11 pm
Fussion of Livolo lib and Livolo recieve code here: https://goo.gl/nzwYCH
Title: Re: Control Livolo switches / Livolo switch library
Post by: joevpt on Aug 24, 2017, 03:35 pm
Hi,

How did you manage to set the light to on and off? I don't understand. Please advise. Thanks.
I'm working on this now,  but the simple way to get On and Off to work, is to use a scene.  When you put the Livolo switch into learn mode (hold the button for 5 seconds or so), and set the button to the desired state (On or Off), then if you send a scene code from a remote, then switch will go to that state.  You have four scenes available for each switch, so use one of them for ON (and another for OFF if you need to).

In my case, I use a different RemoteID for eah room.  The All Off code switches off the lamp for me in that room, and now Scene 1 turns on the lamp for me in that room. Using the other scenes is not essential for me as I want to be able to turn ON or turn OFF the lamp (not toggle it).

Thanks to the guys who bought the remotes for posting the scene codes.

[ By the way, the scene codes listed above are not valid for the four button remotes. The codes in the four button remotes are A=8, B=16, C=56 and D=42 (All OFF) ]
Title: Re: Control Livolo switches / Livolo switch library
Post by: GoGs99 on Sep 13, 2017, 01:26 am
Hello, thanks for the code. it work perfect...
just little change code with about delay...
If get error, it will go for next  read.

Code: [Select]

#define SIGNAL_IN 0 // INTERRUPT 0 = DIGITAL PIN 2 - use the interrupt number in attachInterrupt

volatile byte impulse = 0; // kolejny puls
volatile int bufor[53];
volatile boolean header = false;
volatile unsigned long StartPeriod = 0; // set in the interrupt
volatile boolean stop_ints = false;


void setup()
{
 attachInterrupt(SIGNAL_IN, calcInput, CHANGE);

 Serial.begin(9600);
}

void loop()
{
 if (stop_ints) //data in buffer
 {
   unsigned long binary = 1;
   //byte i = 0;
   for (byte j = 0; j < 46; j++)
   {
     //Serial.print(binary);
     if ((bufor[j] > 220) &&
         (bufor[j] < 400))
     {
       binary <<= 1;
       //binary |= 1;
       //i++;
       bitSet(binary,0);
     }
     else if ((bufor[j] > 90) &&
              (bufor[j] < 220) && (bufor[j + 1] > 90) &&
              (bufor[j + 1] < 220)) {
       binary <<= 1;
       j++;
       
     }
     else if ((bufor[j] > 90) &&
              (bufor[j] < 220) && (bufor[j + 1] > 220) &&
              (bufor[j + 1] < 400)) {
       binary <<= 1;
       bitSet(binary,0);
       //i += 2;
       j++;
     }
     else break;
         }
         //Serial.println(bitRead(binary,4));
   if (bitRead(binary,23))
   {
     bitClear(binary,23);
     Serial.print("remoteID:");
     Serial.print((binary / 128) & 65535);
     Serial.print(" - ");
     Serial.print("key code:");
     Serial.println(binary & 127);
     delay (1000);
   }
   else {
     Serial.println("wrong code  ");
     Serial.println(binary, BIN);
     delay (100);
   }
   
   header = false;
   impulse = 0;
   stop_ints = false;

   // }
 }
}

// interrupt below...


void calcInput()
{
 // get the time using micros
 unsigned int duration = (int)(micros() - StartPeriod); // save pulse length to bufor
 StartPeriod = micros(); //begin next impulse
 //Serial.println(StartPeriod);
 if (stop_ints) return;
 if ((duration < 90) || (duration > 600)) goto reset; //impulse not right
 bufor[impulse++] = duration;
 if (duration < 415) return;
 if (!header)
 {
   header = true;
   impulse = 0;
   return;
 }
 else
 {
   if ((impulse < 23) || (impulse > 52)) goto reset; //too long or too short info
   stop_ints = true;
   return;
 }
reset:
 header = false;
 impulse = 0;
 return;
}
Title: Re: Control Livolo switches / Livolo switch library
Post by: mmib on Sep 19, 2017, 01:55 pm
Hi,


any idea how to work with livolo dimmers? It seems this code working with switches only but dimmers has some different codes.

I have 4 button and 20 buttons transmitters for this dimmers/switches and it work. But arduino code works with switches only.

Maybe someone can point to link to decode RF signal from remote? (need decoder to get id and button key, not just lib to get pulses).
Title: Re: Control Livolo switches / Livolo switch library
Post by: tyjtyj on Dec 22, 2017, 09:33 am
This was the dimmer code given based on thread 23

1) "+": 92  ; "-": 116

2) "+": 126; "-": 36


I dont have dinner so i cant verified.

I wrote a javascript to generate livolo code to hex and base64

http://www.tyjtyj.com/livolo.php
Title: Re: Control Livolo switches / Livolo switch library
Post by: brewster_ on Jan 01, 2018, 11:33 am
Hi and Happy new year!

Thanks for all who made titanic work with intagration of Livolo and Arduino. Library is very nice - special thanks to topic starter.

But there is one problem. There is not full description how  Arduino make to send commands only ON and only OFF. Joevpt try to do it but...

I wrote simple code for programming Livolo Switches. If you want  - "Code for dummies" (And now i'm dummie in Arduino coding too :) )

Code: [Select]

#include <livolo.h>

byte trport =12;              // port of 433-transmitter
Livolo livolo(trport);        // transmitter connected to pin trport
int onoff = 10;               // data from Serial
unsigned int ID = 6400;       // ID of Remote - type your own ID/ f.e. 6400; 19303; 10550; 8500; 7400
unsigned int IDB = 0;         // Number of remote's button #1: 0, #2: 96, #3: 120, #4: 24, #5: 80, #6: 48, #7: 108, #8: 12, #9: 72; #10: 40, #OFF: 106
unsigned int SCENE1 = 90;     // Number of scene (available 90, 114, 10, 18)

void setup() {
Serial.begin(9600);  // serial init
}

void loop() {

// Serial reading
//
if (Serial.available() > 0)
{
onoff = Serial.read()-48;
Serial.println(onoff);
}

if (onoff == 1)
{
  livolo.sendButton(ID, IDB);
  Serial.println("Button");
  delay (1000);
}

if (onoff == 2)
{
  livolo.sendButton(ID, SCENE1);
  Serial.println("Scene");
  delay (1000);
}

if (onoff == 0)
{
  
  livolo.sendButton(ID, 106);
  Serial.println("off");
  delay (1000);
}
}




There are steps for programming below:
1. wrote in header of code your ID, number off button and Scene.
2. compile and download in Arduino
3. open Serial monitor
4. press Livolo switch for 5 seconds (untill BEEP)
5. type 1 in Serial monitor and send - Livolo switch will BEEP
6. press Livolo switch for 5 seconds again (untill BEEP)
7. type 2 in Serial monitor and send - Livolo switch will BEEP
fin

Now You can test switch via sending same commands in Serial monitor.


Make it with all swithes in your location with individual Remote ID for each switch.

Now you can use 3 code for manage livolo switch from Arduino:

1. Standart on/off in single button with code you write in header

livolo.sendButton(RemoteID, Button)


2. Only ON via sending code of scene

livolo.sendButton(RemoteID, Scene)


3. Only OFF via sending code 106

livolo.sendButton(RemoteID, 106)
Title: Re: Control Livolo switches / Livolo switch library
Post by: Watcher on Feb 10, 2018, 07:43 pm
Does any one know if its possible to get feedback status indication from these devices via the RF link or otherwise?  That is, does the switch send back  info on its current position ON or OFF ?
Title: Re: Control Livolo switches / Livolo switch library
Post by: sircb on Feb 14, 2018, 01:14 pm
Hello,

first i would like to thank you all for this community, i learned a lot from this forum.

second i would like to say something on this subject:

all the ids work but they work differently - Some of them are for 4 button remotes and some are for the touch remotes.

Get a random number from range 1 - 65500.

convert it to binary (you can use web/computer calculators)

count the "1"
if the number of  "1"  is an odd number  the code is for the touch remotes
if the number of  "1"  is an even number  the code is for  4 button remotes

4 button remote  codes:  A=8, B=16, C=56 and D=42

Obs:
- also found code 40 turns off
- on dimer switch  - when off dimming up (B=16) starts from first lvl  (does not matter last on level) 


touch remotes codes:   #1: 0, #2: 96, #3: 120, #4: 24, #5: 80, #6: 48, #7: 108, #8: 12, #9: 72; #10: 40, #OFF: 106
Scene 1 - 90
Scene 2 - 114
Scene 3 - 10
Scene 4 - 18

obs:
For rooms you need to change the remote id - every room has different remote id.



i also have a few questions:
1. is there an ON code for small remote (not Toggle) ?   
2. how can i dim (+) or (-) by sending codes?  ON code for touch remote (not Toggle)?
    now is use scenes..  sc1 - off  sc2- 33%  sc3-66%  sc4-100% but i have to sync 4 scenes etc... maybe there is a better way...










Title: Re: Control Livolo switches / Livolo switch library
Post by: DmitryP on Feb 17, 2018, 01:36 pm
Hello and thank you all for great job!

1. is there an ON code for small remote (not Toggle) ?   
I have done brute force of all button values in range 0 and 128. The working ones were only 8=10=A, 16=18=B, 56=58=C and 42=40=D. The answer is no, however there is a working solution when using touch remote. You probably know that each dimmer can register multiple remotes, even both 4-button and touch together.

2. how can i dim (+) or (-) by sending codes?  ON code for touch remote (not Toggle)?
    now is use scenes..  sc1 - off  sc2- 33%  sc3-66%  sc4-100% but i have to sync 4 scenes etc... maybe there is a better way...
For the touch remotes I have found that values 68=70 toggle between 5 dimming modes, I think 20%, 40%, 60%, 80% and 100%. You can register additional 4-button remote to use dim +/-. ON function without toggle for touch remotes, as you wrote, can be mapped to some scene. But there is more.

Values 4=6 enter dimmer into scene programming mode. After dimmer makes 4 beeps you can change dimmer level and press any scene button to store dimmer state. One beep means that the scene is saved and two beeps mean that scene is deleted. Unfortunately, no other button values than 90=88, 114=112, 10=8 and 18=16 can be mapped to a scene. So we can define constantly (without toggle) OFF + 4 states, say for example OFF, 25%, 50%, 75% and 100%.

For a conclusion, we can combine two remotes as follows.

Remote ID 18287 (VL-RMT-02, 4 button):
8=10 - ON/OFF (toggle)
16=18 - DIM UP (6 modes)
56=58 - DIM DOWN  (6 modes)
42=40 - OFF

Remote ID 18288 (VL-RMT-03 or VL-RMT-04, touch):
0=2 - ON/OFF (toggle)
4=6 - SAVE/DELETE SCENE
68=70 - TOGGLE DIM (5 modes)
106=104 - OFF
90=88 - DIM 25%
114=112 - DIM 50%
10=8 - DIM 75%
18=16 - ON

Yes, there could be more scenes. But what if we combine multiple touch remotes? :)

UPDATE
Despite value 68 (for touch remotes) changes direction only when dimmer level reaches it's minimum or maximum, it is way more useful than we think. I have discovered that it can do much more dim steps than 5 as described above. By default LivoloRS library repeats each command 180 times and that makes 5 steps. I tried repeat count of 50 which also worked excellent on 5 meter distance with small antenna using LamPI-3.x/livolo and that made about 15 dimmer levels. It works the same way as we press touch button on the dimmer itself - the dimmer level changes while RF signal is sent.

Dmitry P
Title: Re: Control Livolo switches / Livolo switch library
Post by: DmitryP on Feb 17, 2018, 02:35 pm
Does any one know if its possible to get feedback status indication from these devices via the RF link or otherwise?  That is, does the switch send back  info on its current position ON or OFF ?
I have checked if VL-C701DR sends any RF signals on 433 MHz band. The answer is no. Otherwise = connect wires to indicator LEDs.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Watcher on Feb 19, 2018, 09:39 pm
I have checked if VL-C701DR sends any RF signals on 433 MHz band. The answer is no. Otherwise = connect wires to indicator LEDs.
So if these devices are integrated in a building automation system, there is no way for the master device  (sender)to know if a command has been successful or not. Right?
Title: Re: Control Livolo switches / Livolo switch library
Post by: DmitryP on Feb 21, 2018, 12:41 pm
So if these devices are integrated in a building automation system, there is no way for the master device  (sender)to know if a command has been successful or not. Right?
You can try to scan other frequencies with RTL-SDR for example. This super-cheap SDR can receive RF range from ~50 MHz to ~1700 MHz. Maybe you'll get lucky.

Dmitry P
Title: Re: Control Livolo switches / Livolo switch library
Post by: rastone on Mar 09, 2018, 07:07 pm
If anyone is interested,here is the codes for my VL-RMT-04 touch remote


room 1                                     button

remoteID:26339 - key code:0          1
remoteID:26339 - key code:96        2
remoteID:26339 - key code:120      3
remoteID:26339 - key code:24        4
remoteID:26339 - key code:108      5
remoteID:26339 - key code:72        6
remoteID:26339 - key code:48        7
remoteID:26339 - key code:12        8
remoteID:26339 - key code:80        9
remoteID:26339 - key code:106      Alloff
remoteID:26339 - key code:90       scene1
remoteID:26339 - key code:114     scene2

dim
remoteID:26339 - key code:68        1
remoteID:26339 - key code:78        2
remoteID:26339 - key code:86        3
remoteID:26339 - key code:102      4
remoteID:26339 - key code:92        5
remoteID:26339 - key code:126      6
remoteID:26339 - key code:34        7
remoteID:26339 - key code:116      8
remoteID:26339 - key code:36        9

room 2
remoteID:26348

room 3
remoteID:26131


Also would like to ask DmitryP what do you mean by  eg. 106=104 - OFF
106 is all off  but 104 does nothing when i try it (probably i am missing something obvious here)
Title: Re: Control Livolo switches / Livolo switch library
Post by: DmitryP on Mar 11, 2018, 01:20 pm
Hi, rastone!

Thanks for posting VL-RMT-04 codes!

Also would like to ask DmitryP what do you mean by  eg. 106=104 - OFF
106 is all off  but 104 does nothing when i try it (probably i am missing something obvious here)
I have tested these codes on Arduino and Raspberry Pi using different Livolo libraries. Both codes 106 and 104 have same behavior. User sircb also reported that there are duplicates: key code 40 does same as 42. I think this could be cheap RF transmitter issue...


dim
remoteID:26339 - key code:68        1
remoteID:26339 - key code:78        2
remoteID:26339 - key code:86        3
remoteID:26339 - key code:102      4
remoteID:26339 - key code:92        5
remoteID:26339 - key code:126      6
remoteID:26339 - key code:34        7
remoteID:26339 - key code:116      8
remoteID:26339 - key code:36        9
What do these codes? Do they change dimmer level from 10% to 90%?
If so, how did you get them working? I tried to pair this remote by entering the dimmer in programming mode and sending ID 26339 and key code 0, but these key codes did not work.

Dmitry P
Title: Re: Control Livolo switches / Livolo switch library
Post by: rastone on Mar 11, 2018, 01:34 pm
Hi

I'll check again your codes when i am home

Yes,they change dimmer state
With remote id 26339 and key code  0(button 1 on remote)your  switch should pair .Then with key code 68 dims
up/down
Of course i did all the pairing with the VL-RMT-04(i used number 3 for my dimmer switch) but guess should work also with the arduino
Title: Re: Control Livolo switches / Livolo switch library
Post by: DmitryP on Mar 11, 2018, 04:15 pm
Hi rastone and thanks for fast reply!

Pairing remote id 26339 completes and codes 0 (on/off toggle), 68 (dim up/down) and 106 (all off) work fine. How did you make key codes 78, 86, 102, 92 126, 34, 116 and 36 to change dimmer level?

Dmitry P
Title: Re: Control Livolo switches / Livolo switch library
Post by: rastone on Mar 11, 2018, 08:06 pm
i just decoded the signals my remote was sending
Each dim code is for a different button.So for code eg. 78 to work you must 1st pair the switch with
button 2(key code 96).The dim codes are what the touch remote is sending when you press the
corresponding button for more than 1sec and you keep it pressed for up/down dimming.Hope that helps
Title: Re: Control Livolo switches / Livolo switch library
Post by: DmitryP on Mar 12, 2018, 06:35 pm
Thanks, now it's clear. So all these dim codes control different dimmers but not dimmer levels on single dimmer.
Title: Re: Control Livolo switches / Livolo switch library
Post by: rastone on Mar 13, 2018, 01:15 am
Exactly.One dim code for each button
Title: Re: Control Livolo switches / Livolo switch library
Post by: kriss13 on Apr 11, 2018, 10:21 pm
Hi and Happy new year!

Thanks for all who made titanic work with intagration of Livolo and Arduino. Library is very nice - special thanks to topic starter.

But there is one problem. There is not full description how  Arduino make to send commands only ON and only OFF. Joevpt try to do it but...

I wrote simple code for programming Livolo Switches. If you want  - "Code for dummies" (And now i'm dummie in Arduino coding too :) )

Code: [Select]

#include <livolo.h>

byte trport =12;              // port of 433-transmitter
Livolo livolo(trport);        // transmitter connected to pin trport
int onoff = 10;               // data from Serial
unsigned int ID = 6400;       // ID of Remote - type your own ID/ f.e. 6400; 19303; 10550; 8500; 7400
unsigned int IDB = 0;         // Number of remote's button #1: 0, #2: 96, #3: 120, #4: 24, #5: 80, #6: 48, #7: 108, #8: 12, #9: 72; #10: 40, #OFF: 106
unsigned int SCENE1 = 90;     // Number of scene (available 90, 114, 10, 18)

void setup() {
Serial.begin(9600);  // serial init
}

void loop() {

// Serial reading
//
if (Serial.available() > 0)
{
onoff = Serial.read()-48;
Serial.println(onoff);
}

if (onoff == 1)
{
  livolo.sendButton(ID, IDB);
  Serial.println("Button");
  delay (1000);
}

if (onoff == 2)
{
  livolo.sendButton(ID, SCENE1);
  Serial.println("Scene");
  delay (1000);
}

if (onoff == 0)
{
 
  livolo.sendButton(ID, 106);
  Serial.println("off");
  delay (1000);
}
}




There are steps for programming below:
1. wrote in header of code your ID, number off button and Scene.
2. compile and download in Arduino
3. open Serial monitor
4. press Livolo switch for 5 seconds (untill BEEP)
5. type 1 in Serial monitor and send - Livolo switch will BEEP
6. press Livolo switch for 5 seconds again (untill BEEP)
7. type 2 in Serial monitor and send - Livolo switch will BEEP
fin

Now You can test switch via sending same commands in Serial monitor.


Make it with all swithes in your location with individual Remote ID for each switch.

Now you can use 3 code for manage livolo switch from Arduino:

1. Standart on/off in single button with code you write in header

livolo.sendButton(RemoteID, Button)


2. Only ON via sending code of scene

livolo.sendButton(RemoteID, Scene)


3. Only OFF via sending code 106

livolo.sendButton(RemoteID, 106)

Hi

I am a noob too sort of.
Could you tell a dummy, that pins did you connect (transmitter to Arduino)?
I have a Nano.v3.
I am trying to setup mine, but all I have are bits of info from everywhere.

I wonder if I can use my nodemcu and Blynk app to sent commands to Livolo.


thank you.
Title: Re: Control Livolo switches / Livolo switch library
Post by: kriss13 on Apr 19, 2018, 10:08 pm
anyone? :)
Title: Re: Control Livolo switches / Livolo switch library
Post by: brewster_ on May 13, 2018, 10:42 am
anyone? :)
Hi!

Sorry for delay - was very busy.

I use port 12 in my Mega - this is PWM-port.

"And one more thing" - i use DIY antenna with the transmitter. Without it Livolo work bad and unstable.
Title: Re: Control Livolo switches / Livolo switch library
Post by: kriss13 on May 18, 2018, 10:17 pm
Hi!

Sorry for delay - was very busy.

I use port 12 in my Mega - this is PWM-port.

"And one more thing" - i use DIY antenna with the transmitter. Without it Livolo work bad and unstable.
Just got it to work and successfully turned the light on/off .
I use nodemcu D6 (12 in the scketch) (dear lord the designation of pins for nodemcu is a mess :))
Also on my Nano worked.

I know try to make it work with Blynk app (my final goal), as the native app is...well ..Chinese :))

Thanks all for the great work about Livolo!
Title: Re: Control Livolo switches / Livolo switch library
Post by: brewster_ on May 18, 2018, 10:25 pm
Yes - Blynk is very interesting application. I use it in my Smart house project.

I want to write about this project but I haven't time for it now. May be later.
Title: Re: Control Livolo switches / Livolo switch library
Post by: Hbadotti on Feb 12, 2019, 11:32 pm
Just in case someone was looking for arduino code to decode Livolo remotes.

Code: [Select]

#define SIGNAL_IN 0 // INTERRUPT 0 = DIGITAL PIN 2 - use the interrupt number in attachInterrupt

volatile byte impulse = 0; // kolejny puls
volatile int bufor[53];
volatile boolean header = false;
volatile unsigned long StartPeriod = 0; // set in the interrupt
volatile boolean stop_ints = false;


void setup()
{
  attachInterrupt(SIGNAL_IN, calcInput, CHANGE);

  Serial.begin(9600);
}

void loop()
{
  if (stop_ints) //data in buffer
  {
    unsigned long binary = 1;
    //byte i = 0;
    for (byte j = 0; j < 46; j++)
    {
      //Serial.print(binary);
      if ((bufor[j] > 220) &&
          (bufor[j] < 400))
      {
        binary <<= 1;
        //binary |= 1;
        //i++;
        bitSet(binary,0);
      }
      else if ((bufor[j] > 90) &&
               (bufor[j] < 220) && (bufor[j + 1] > 90) &&
               (bufor[j + 1] < 220)) {
        binary <<= 1;
        j++;
       
      }
      else if ((bufor[j] > 90) &&
               (bufor[j] < 220) && (bufor[j + 1] > 220) &&
               (bufor[j + 1] < 400)) {
        binary <<= 1;
        bitSet(binary,0);
        //i += 2;
        j++;
      }
      else break;
          }
          //Serial.println(bitRead(binary,4));
    if (bitRead(binary,23))
    {
      bitClear(binary,23);
      Serial.print("remoteID:");
      Serial.print((binary / 128) & 65535);
      Serial.print(" - ");
      Serial.print("key code:");
      Serial.println(binary & 127);
    }
    else {
      Serial.println("wrong code  ");
      Serial.println(binary, BIN);
    }
    delay (1000);
    header = false;
    impulse = 0;
    stop_ints = false;

    // }
  }
}

// interrupt below...


void calcInput()
{
  // get the time using micros
  unsigned int duration = (int)(micros() - StartPeriod); // save pulse length to bufor
  StartPeriod = micros(); //begin next impulse
  //Serial.println(StartPeriod);
  if (stop_ints) return;
  if ((duration < 90) || (duration > 600)) goto reset; //impulse not right
  bufor[impulse++] = duration;
  if (duration < 415) return;
  if (!header)
  {
    header = true;
    impulse = 0;
    return;
  }
  else
  {
    if ((impulse < 23) || (impulse > 52)) goto reset; //too long or too short info
    stop_ints = true;
    return;
  }
reset:
  header = false;
  impulse = 0;
  return;
}




Thanks to platenspeler and spch

Improved code
Doesn't work for arduino due!