Go Down

Topic: Control Livolo switches / Livolo switch library (Read 52233 times) previous topic - next topic

winnaing

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

spch

#16
Oct 21, 2013, 07:42 pm Last Edit: Oct 25, 2013, 07:19 am by spch Reason: 1
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;     
  }
}

winnaing

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

spch

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.

baustromverteiler

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

spch

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.

baustromverteiler

thanks for your really fast reply  -  I'm really looking forward to test the dimmer feature :) keep up the great work!

winnaing

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

spch

#23
Oct 23, 2013, 07:31 pm Last Edit: Oct 24, 2013, 09:17 am by spch Reason: 1
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.

baustromverteiler

Thanks for the keycodes - I'll let you know how it worked out

winnaing

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

spch

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


spch

Hi eltin,

These should be just fine. My transmitter looks exactly the same.

spch

#29
Oct 25, 2013, 04:47 pm Last Edit: Dec 02, 2013, 10:56 am by spch Reason: 1
Hi folks,

It is now a Livolo switch control library.

Get it here: https://drive.google.com/file/d/0B0DQ7La4EBHlU2ltTmlmeHhya3M/edit?usp=sharing or download as attachment to this post (as of 1 dec 2013 attachment is a bit outdated, use download link if you would like to save several bytes of code).

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!

Go Up