Control Livolo switches / Livolo switch library

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?

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: GitHub - sui77/rc-switch: Arduino lib to operate 433/315Mhz devices like power outlet sockets.

Sincerely,
Sergey.

Just in case someone was looking for arduino code to decode Livolo remotes.

#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

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

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

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.

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 !!!

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.

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!

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 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,

vant,

Just read your remote codes with daleldalel's sketch and use them with Livolo library as per examle.

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.

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 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 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 for.

  1. Copy and paste it 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.

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

Hi vant,

Glad to know you did what you wanted. In case you missed it: here is a port of Livolo library for Raspberry.

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

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 for arduino, but the result can be got :slight_smile: anyone have a working sketch for arduino for these switches?

Also, the manufacturer sent me a signal circuit breakers , may be it can help?

icofjm:
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