Go Down

Topic: rf433 code for ELRO Flamingo home devices (FA500) (Read 34285 times) previous topic - next topic

johanm

Hallo,

Has somebody already decoded the RF433 protocol for the ELRO Flamingo home devices (model numer starts with FA500)?
In the Netherlands o.a. sold by the Kruidvat stores.

If have tried it to decode by using the receive and transmit code from both the RemotSwitch and RCSwitch libraries. Without any succes. With both I receive a code but when I try to resend these code the devices do not react. The code received by Remoteswith differs from the RCSwitch.

Anyone any ideas how I can solve this?

spch

Hi,

I've used NewRemoteSwitch library for similar switches.

Regards,
Sergey.

johanm

Sergey thanks for your response.

I do receive a code from my remote with the ShowReceivedCode from NewRemoteSwith library, the result:

Addr 20496 unit 1 off, period: 271us.

But when I try to send an On or Off signal to the device with the LightShow sketch provided as demo, the device does not recognise this signal and does not switch. 

Did you do something special to send out the signal? I use:

NewRemoteTransmitter transmitter(20496, 11, 271, 3);
transmitter.sendUnit(1, true);

My old Kaku and X10 devices working fine with this setup.

Regards,
Johan


Haenzel

Are you aware that you probably will have to link the device within 10 seconds after plugging the switch into the socket? Not sure, but the manual says so to be able to operate it with the standard remote control. Imagine the same is applicable for your arduino transmitter....

johanm

The device can be programmed with the remote controller ( multiple remotes /codes per device supported).

I have tried to analyse the signal with a digital analyser and it seem to be the 24 bits protocol that I also had detected witb RCSwitch showcode scetch. But when I tried to sent the same signal the device does not react. I found a diffrence in the sync /start signal. RCRemote use 1 pulse high and 31 pulses low. My remote send 1pulse high and 15 pulses low. But when I changed that the device still does not react.

I need to do more investigation work I supose :-(

probono

#5
Jun 29, 2014, 11:43 am Last Edit: Jun 29, 2014, 11:45 am by probono Reason: 1
Possibly the FA500 remote control is sending more required data than just the 24 bit code.

Using the Arduino sketch from the RCSwitch library, I get:

Code: [Select]
# A on

Decimal: 4260117 (24Bit) Binary: 010000010000000100010101 Tri-State: F00F000F0FFF PulseLength: 329 microseconds Protocol: 1
Raw data: 10232,392,928,988,332,388,924,388,932,388,928,384,940,380,928,988,336,380,928,384,940,380,928,384,940,384,928,380,940,384,932,980,340,380,932,376,948,376,932,984,340,376,940,976,348,372,936,980,344,


However, when I analyze the same signal using the rtl_433 tool from https://github.com/merbanan/rtl_433, I get:

Code: [Select]
# A on

*** signal_start = 38594077, signal_end = 38825145
signal_len = 231068, pulses = 614
Iteration 1. t: 161 min: 73 (528) max: 249 (86) delta 245
Iteration 2. t: 161 min: 73 (528) max: 249 (86) delta 0
Pulse coding: Short pulse length 73 - Long pulse length 249

Short distance: 197, long distance: 1237, packet distance: 2528

p_limit: 161

[00] {182} 13 72 39 b0 9b 91 cd 84 dc 8e 6c 26 e4 73 60 00 00 00 00 00 00 00 00 : 00010011 01110010 00111001 10110000 10011011 10010001 11001101 10000100 11011100 10001110 01101100 00100110 11100100 01110011 01100000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[01] {66} 00 00 00 00 00 00 00 00 00 : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[02] {66} 00 00 00 00 00 00 00 00 00 : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[03] {1} 00 : 00000000
[04] {58} 00 00 00 00 00 00 00 00 : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[05] {58} 00 00 00 00 00 00 00 00 : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[06] {58} 00 00 00 00 00 00 00 00 : 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[07] {25} 41 01 15 00 : 01000001 00000001 00010101 00000000
[08] {25} 41 01 15 00 : 01000001 00000001 00010101 00000000
[09] {25} 41 01 15 00 : 01000001 00000001 00010101 00000000
[10] {25} 41 01 15 00 : 01000001 00000001 00010101 00000000
[11] {25} 41 01 15 00 : 01000001 00000001 00010101 00000000


What seems suspicious is that the Arduino code apparently is only concerned with lines [07] to [11] above, totally ignoring lines [01] to [11]. Possibly this is why we cannot get sending to work using the the RCSwitch library.

Does anyone know that lines [01] to [11] could be? Interestingly, some bits in these lines change every time while others do not. Could it be some sort of collission protection scheme?

I have put more log output and an Arduino sending sketch on https://gist.github.com/probonopd/331674026839b96cd8d7.

johanm

When I saw your post I did realize that I have not post my last experiences with these devices. I manage to decode the signal. It was very hard because the remote controller of the FA500 send out a sequence of 4 different codes (each code also sent multiple times). With RCSwitch / Remoteswitch and Newremote switch you can "catch" some of these codes but node the ones that switches the FA500.

I first tried to "catch" the codes with OLS, Open Bench Logic sniffer (ols.lxtreme.nl ) with  arduino as sump client (https://github.com/gillham/logic_analyzer). It is very hard to start the analyser and the remote at the same time but I managed to receive 3 different codes. But none of these codes was able to switch the FA500.

At the end I tried it with audacity and the soundcard as Analyser: (see: http://hblok.net/blog/posts/2012/09/02/home-automation-on-433-92-mhz-with-arduino/ and http://davehouston.net/learn.htm) . Then I realize there was one code more in the signal. That first code in the sequence switches my FA500.

Attached schreen picture of the audacity output voor all codes and a detail picture of the first code (the one FA500 uses).

I manage to detect all 8 codes (4 units on/off for 2 remotes). I did not manage to find the logic behind these codes. I hard coded them in my arduino and can switch now my FA500 devices.

Below  the "subroutine code" I use in my Arduino domotica program (als use for X10 and Klik aan / Klik Uit switching).
Because of that I more or less standardised the call of these routine:

Flamingo_Send(house, unit, command);

Where housecode is A-D (code on the remote, like x10/KAKU housecode) and unit is remote unit number (0 or 1, like x10 / KAKU unit number)). Command is 0 or 1 (on or off).

I have added also a lot of debug stuf because it was not easy to get it working.
Hope you can use this the switch your FA500 devices.

Regards,
Johan


/******************************************************************************
** Flamingo_send                                                             **
**                                                                           **   
**       Flamingo device commands (on/off)hard coded (not deciphered yet)    **
**       code is 28 byte long. To transfer it in 32 bit code 4 *0            **
**       is added to the left. For programming reason hex code representation**
**       of device code is used. E.g. Remote 0,C,On:                         ** 
**         code 28 bits: 0001100110111111110100100110                        **
**         code 32 bits: 00011001101111111101001001100000                    **
**         Hex:          19BFD260                                            ** 
**                                                                           **   
**        "Sync" 1 pulse High, 15 pulse low                                  **   
**        "1"    1 pulse High, 3 pulse low                                   **   
**        "0"    3 pulse High, 1 pulse low                                   **   
**        "end"  N/A                                                         **   
**                                                                           **   
**       For internal ref: Unit 0 = white remote , unit 1 = black remote     **
**                                                                           **   
******************************************************************************/
//Compiler only coding
#define FREMOTE 2                                  /*amount supported remotes */
#define FUNITS  4                                  /* Amount of units supported per remote */
#define FCMDN   2                                  /* Amount of CMD 0 = AAN, 1 = UIT */

//define device codes:

uint32_t fdev[FREMOTE][FUNITS][FCMDN] = {0xD9762A10,            /* Remote 0, Unit A, Aan */
          0xDAA47850,                                           /* Remote 0, Unit A, Uit */
          0xDBDA22E0,                                           /* Remote 0, Unit B, Aan */
          0xDBA27220,                                           /* Remote 0, Unit B, Uit */ 
          0x19BFD260,                                           /* Remote 0, Unit C, Aan */
          0x195EEAA0,                                           /* Remote 0, Unit C, Uit */ 
          0x984CC650,                                           /* Remote 0, Unit D, Aan */ 
          0x9A8C1050,                                           /* Remote 0, Unit D, Uit */ 
          0xDBFFFE90,                                           /* Remote 1, Unit A, Aan */
          0xD91CEF10,                                           /* Remote 1, Unit A, Uit */ 
          0xDBC52FA0,                                           /* Remote 1, Unit B, Aan */
          0xD9E35160,                                           /* Remote 1, Unit B, Uit */ 
          0x19B0FE60,                                           /* Remote 1, Unit C, Aan */
          0x19682B20,                                           /* Remote 1, Unit C, Uit */ 
          0x9924E7D0,                                           /* Remote 1, Unit D, Aan */
          0x9BA928D0};                                          /* Remote 1, Unit D, Uit */ 


//Define Flamingo_send variables / constants

  int fpulse = 300;                              /* Pulse witdh in microseconds */
  int fretrans = 5;                              /* Code retransmission         */
  uint32_t fsendbuff;
  uint32_t fdatabit;
  uint32_t fdatamask = 0x80000000;

void Flamingo_Send(int fhousec, int funitc, int fcmd)
  {

  //Test if used codes are valid
 
  if ((funitc < 1) || (funitc >  2)){                   // check if unit code between 1-2 (Remote 0 of 1)
            sendcmd_error = true;                      // no => command error             
           #if defined DEBUG
            Serial.print("Unit error: ");
            Serial.println(funitc);
            #endif
            return;
            }     
      else  {
            funitc = funitc - 1;                        //To address right code in array
      }   
     
  if ((fhousec < 0) || (fhousec >  3)){                // check if house code between 1-4 (A-D)
            sendcmd_error = true;                      // no => command error             
            #if defined DEBUG
               Serial.print("House error: ");
               Serial.println(fhousec);
            #endif   
            return;     
            }   
//      else  {
//            fhousec = fhousec - 1;                      //To address right code in array
//      }
     
if ((fcmd < 0) || (fcmd > 1)){                        // check if command = 0 (off) or 1 (on)
          #if defined DEBUG
            Serial.print("Command error: ");
            Serial.println(fcmd);
          #endif 
          sendcmd_error = true;                      // no => command error             
          return;     
          }
  //End test used codes       
         
#if defined DEBUG
    Serial.println("Send Flamingo command ");
    Serial.print("Flamingo House/Device code = :");
    Serial.println(fhousec);
    Serial.print("Flamingo Unit/remote code = :");
    Serial.println(funitc);
    Serial.print("command = :");
    Serial.println(fcmd);
    Serial.println();
  #endif   
 
  //Zend Command
 
    for (int nRepeat=0; nRepeat <= fretrans; nRepeat++) {
 
    fsendbuff = fdev[funitc][fhousec][fcmd];
     
  // send SYNC 1P High, 15P low     
  //    Serial.println("Zend sync");
 
      digitalWrite(rfPin, HIGH);
      delayMicroseconds(fpulse * 1);         
      digitalWrite(rfPin, LOW);
      delayMicroseconds(fpulse * 15);
     
  // end send SYNC
 
  // Send command
 
    for(int i = 0; i < 28; i++)                                  //Flammingo command is only 28 bits */
       {                                             
         //read data bit         
         fdatabit = fsendbuff & fdatamask;                         //Get most left bit
         fsendbuff = (fsendbuff << 1);                            //Shift left
                     
         if (fdatabit != fdatamask)
           {                                                   //Write 0 
            digitalWrite(rfPin, HIGH);
            delayMicroseconds(fpulse * 3);         
            digitalWrite(rfPin, LOW);
            delayMicroseconds(fpulse * 1);     
           }
         else
           {                                                   //Write 1
            digitalWrite(rfPin, HIGH);
            delayMicroseconds(fpulse * 1);         
            digitalWrite(rfPin, LOW);
            delayMicroseconds(fpulse * 3);   
           }
        }
    }
}

probono

#7
Jun 30, 2014, 11:20 pm Last Edit: Jun 30, 2014, 11:54 pm by probono Reason: 1
Hi Johan,

thanks for your reply. You are a great example of why I love the Arduino community :) Maybe I will keep the Flamingo set after your encouraging post (was thinking of returning it to the shop).

Unfortunately, your code is not compiling for me, I get

Quote
Flamingo_send.ino: In function 'void Flamingo_Send(int, int, int)':
Flamingo_send:59: error: 'sendcmd_error' was not declared in this scope
Flamingo_send:71: error: 'sendcmd_error' was not declared in this scope
Flamingo_send:87: error: 'sendcmd_error' was not declared in this scope
Flamingo_send:112: error: 'rfPin' was not declared in this scope


Like this, I get it to compile:

Code: [Select]

/******************************************************************************
** Flamingo_send                                                             **
**                                                                           **
**       Flamingo device commands (on/off)hard coded (not deciphered yet)    **
**       code is 28 byte long. To transfer it in 32 bit code 4 *0            **
**       is added to the left. For programming reason hex code representation**
**       of device code is used. E.g. Remote 0,C,On:                         **
**         code 28 bits: 0001100110111111110100100110                        **
**         code 32 bits: 00011001101111111101001001100000                    **
**         Hex:          19BFD260                                            **
**                                                                           **
**        "Sync" 1 pulse High, 15 pulse low                                  **
**        "1"    1 pulse High, 3 pulse low                                   **
**        "0"    3 pulse High, 1 pulse low                                   **
**        "end"  N/A                                                         **
**                                                                           **
**       For internal ref: Unit 0 = white remote , unit 1 = black remote     **
**                                                                           **
******************************************************************************/
// Compiler only coding
#define FREMOTE 2                                  /*amount supported remotes */
#define FUNITS  4                                  /* Amount of units supported per remote */
#define FCMDN   2                                  /* Amount of CMD 0 = On, 1 = Off */

int rfPin = 10;

// define device codes:

uint32_t fdev[FREMOTE][FUNITS][FCMDN] = {0xD9762A10,                                           /* Remote 0, Unit A, On  */
                                        0xDAA47850,                                           /* Remote 0, Unit A, Off */
                                        0xDBDA22E0,                                           /* Remote 0, Unit B, On  */
                                        0xDBA27220,                                           /* Remote 0, Unit B, Off */
                                        0x19BFD260,                                           /* Remote 0, Unit C, On  */
                                        0x195EEAA0,                                           /* Remote 0, Unit C, Off */
                                        0x984CC650,                                           /* Remote 0, Unit D, On  */
                                        0x9A8C1050,                                           /* Remote 0, Unit D, Off */
                                        0xDBFFFE90,                                           /* Remote 1, Unit A, On  */
                                        0xD91CEF10,                                           /* Remote 1, Unit A, Off */
                                        0xDBC52FA0,                                           /* Remote 1, Unit B, Aan */
                                        0xD9E35160,                                           /* Remote 1, Unit B, Off */
                                        0x19B0FE60,                                           /* Remote 1, Unit C, On  */
                                        0x19682B20,                                           /* Remote 1, Unit C, Uit */
                                        0x9924E7D0,                                           /* Remote 1, Unit D, On  */
                                        0x9BA928D0                                            /* Remote 1, Unit D, Uit */
                                       };                                          


// Define Flamingo_send variables / constants

int fpulse = 300;                              /* Pulse witdh in microseconds */
int fretrans = 5;                              /* Code retransmission         */
uint32_t fsendbuff;
uint32_t fdatabit;
uint32_t fdatamask = 0x80000000;

void Flamingo_Send(int fhousec, int funitc, int fcmd)
{

 // Test if used codes are valid

 if ((funitc < 1) || (funitc >  2)) {                  // check if unit code between 1-2 (Remote 0 of 1)
   Serial.print("Unit error: ");
   Serial.println(funitc);
   return;
 }
 else  {
   funitc = funitc - 1;                               // To address right code in array
 }

 if ((fhousec < 0) || (fhousec >  3)) {               // check if house code between 1-4 (A-D)
   Serial.print("House error: ");
   Serial.println(fhousec);
   return;
 }

 if ((fcmd < 0) || (fcmd > 1)) {                       // check if command = 0 (off) or 1 (on)
   Serial.print("Command error: ");
   Serial.println(fcmd);
   return;
 }
 
 //End test used codes

 Serial.println("Send Flamingo command ");
 Serial.print("Flamingo House/Device code = :");
 Serial.println(fhousec);
 Serial.print("Flamingo Unit/remote code = :");
 Serial.println(funitc);
 Serial.print("command = :");
 Serial.println(fcmd);
 Serial.println();


 // Send Command

 for (int nRepeat = 0; nRepeat <= fretrans; nRepeat++) {

   fsendbuff = fdev[funitc][fhousec][fcmd];

   // send SYNC 1P High, 15P low
   Serial.println("Send sync");

   digitalWrite(rfPin, HIGH);
   delayMicroseconds(fpulse * 1);
   digitalWrite(rfPin, LOW);
   delayMicroseconds(fpulse * 15);

   // end send SYNC

   // Send command

   for (int i = 0; i < 28; i++)                                 // Flamingo command is only 28 bits */
   {
     // read data bit
     fdatabit = fsendbuff & fdatamask;                         // Get most left bit
     fsendbuff = (fsendbuff << 1);                             // Shift left

     if (fdatabit != fdatamask)
     { // Write 0
       digitalWrite(rfPin, HIGH);
       delayMicroseconds(fpulse * 3);
       digitalWrite(rfPin, LOW);
       delayMicroseconds(fpulse * 1);
     }
     else
     { // Write 1
       digitalWrite(rfPin, HIGH);
       delayMicroseconds(fpulse * 1);
       digitalWrite(rfPin, LOW);
       delayMicroseconds(fpulse * 3);
     }
   }
 }
}

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

void loop() {
 Flamingo_Send(0, 1, 1);
 delay(1000);
 Flamingo_Send(0, 1, 0);
 delay(3000);
}


Unfortunately, my Flamingos do not react. Do you have any way to determine, based on my information on https://gist.github.com/probonopd/331674026839b96cd8d7 what I need to change?

Thanks!
probono

johanm

At first sight the code looks fine to me. At this momment I cannot test it on my Arduino (maybe later this week).

Just te be sure: Have you programmed the Flamingo device to listen to this code?

Regards,
Johan

probono

#9
Jul 01, 2014, 06:31 pm Last Edit: Jul 01, 2014, 06:51 pm by probono Reason: 1
Hi Johan,

you are absolutely right -- I was (wrongly) assuming that pressing "A on" on my physical remote control would send the same code as your sketch (which did not work). After programming the Flamingos to listen to the sketch, it is now working wonderfully.

Out of curiosity, is it possible to translate the codes I have sniffed into the notation your sketch is using?

Thanks,
probono

johanm

Oke I am glad it is working.

You now have the codes of my two remote controllers. I hope you do not live nearby :-)

As you proably know It is possible to program a flamingo device to listen to multiple code's. So you can program it to react to your remote controller and my codes via the arduino.

I do not think that you have received the right codes with the standards tools to detect the codes the remote is sending for the flamingo devices. As described before the flamingo remote controller is sending out 4 different codes. The one you received with the rcswitch (or other tools) is code 2,3 or 4. I was only possible to detect the first code, the flamingo code, using audacity and the aux in of the soundcard as analyser.  It took me some days to recognized this.

So if you want the detect the codes of your remote then you have put some effort in it. Maybe with the knowledge I have now can write a detection utility but don't count on it.

If you can read dutch I can send you my notes on my "flamingo journey" with some exploination about the detected codes /protocols.

Regards,
Johan

probono

...or so I tought.

In the end I was able to switch them on but not off. I decided to return my Flamingos to the shop because I don't like the fact that there are not physical switches to encode the addresses. It feels like I can never be sure which codes they react to, and the whole addressing thing feels a bit fragile to me.

Still, I would be interested in reading your full Flamingo journey with the help of Google translate.

Thanks,
probono

laurensV

I don't have an arduino, but this was the only forum mentioning this problem. I am trying to setup the ELRO Flamingo switches (FA500) in Domoticz on the raspberry PI. Is there any way to fix this problem for domoticz? I am using a rfxcom transceiver. It can 'learn' the signal from the remote, but then when I am transmitting the signal back to the Flamingo switches, they do not respond to that signal.


@johanm: Any way I can convert your code to work on the raspberry pi with domoticz (or some other platform)?

PS. @johanm I am also dutch by the way.

mmooren94

@johanm,

Dear johanm,
i have also purchased some flamingo FA500. But when i use your sketch i can't 'teach' my arduino to your codes. I have emptied the memory of the flamingos, but no result. Can you please help me?

btw i'm also Dutch:)

greeting,
Michel

timleferink

I'm also trying to use these switches in my microcontroller, but I have a weird problem.
We checked all the signals sent out by the remote using an osciloscope and tried all protocols using a modified RCSwitch library. After these tests we determined that the second protocol that is sent out; is the correct one for the switches.
So after this we wanted to connect a few devices, and see if everything worked.
Only we noticed at this point, that when we assign A to outlet1, B to outlet2 and C to outlet3, no matter what channel we choose, all switches turn on and off at all channels!!
So when I press A on, all devices turn on, and C off, all devices turn off. All switches seem to have accepted all codes. And all of this is happening using the original remote! When we try to use the Arduino we have the exact same problem.

Is there anyone else that has had this problem? And is there a way to fix it? It allmost seems like the switches have some kind of ROM that has been written to.

Go Up