RAW INPUT IR unknow protocol

Hello,

i have a remote controller for medical use who send unknow IR signal i need to know witch button are pressed in Arduino.

Everytime i use remote controller with NEC protocol and Arduino library IRremote.h

but for this project i have no choice, so with IRremote.h i get wrong data everytime i press button all value change and length too, i tried other library and with library Infrared and sample allreaders i get something readable ass you see only some value change when other button pressed at end it near 4850 or 7350
the value of column 4 are 4850 or 7350 ramdomly everytime i press button
all value are not exectly the same everytime ±50

so my question, how can i create a value like hex value for NEC protocol with this raw data ?

my idea:
compare raw data with fixed value with margin of ±50 and if match one const raw data i return a fixed hex value for corresponding button

Thanks for answer and idea, belox are output get with allreaders demo, i keep pressed button s you see vaue are same ±50:

timeout//marche arret
+200 -7300 +200 -7350 +150 -4850 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -30100
+150 -7350 +200 -7350 +150 -4850 +200 -7300 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +150 -30100
+150 -7350 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +150 -7350 +200 -30100
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -30100
+200 -7300 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +150 -30100
timeout
timeout//descendre dossier et lit
+250 -7350 +150 -7350 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -30100
+200 -7350 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -30100
timeout//monter dossier
+150 -7350 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -7350 +200 -7350 +150 -30100
+200 -7300 +200 -7350 +150 -4850 +200 -7350 +200 -4800 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +150 -7350 +200 -30100
+200 -7350 +150 -7350 +200 -4850 +200 -7300 +200 -4800 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -7350 +200 -7350 +150 -30100
+150 -7350 +200 -7350 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +150 -4850 +200 -7300 +200 -7350 +150 -30100
+150 -7350 +200 -7350 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -7350 +150 -7350 +200 -30100
+200 -7350 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4850 +150 -7350 +200 -7300 +200 -30100
+150 -7350 +200 -7300 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -7350 +200 -7350 +150 -30100
timeout//descendre dossier
+150 -7350 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +200 -4800 +200 -7350 +150 -4850 +150 -30100
+150 -7350 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -7300 +200 -4850 +150 -7350 +200 -4850 +150 -30100
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -30100
+150 -7350 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +200 -4850 +150 -7350 +200 -4800 +200 -7300 +200 -4850 +150 -30100
+200 -7350 +150 -4850 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -7350 +200 -4850 +150 -30100
+200 -7350 +150 -4850 +150 -4850 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -30100
+150 -7350 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -7350 +150 -4850 +150 -30100
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +200 -4800 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -7350 +200 -4800 +200 -30100
timeout
timeout//monter lit
+150 -7350 +200 -7350 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -30100
+150 -7350 +200 -7350 +150 -4850 +200 -7300 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4850 +150 -7350 +200 -30100
+200 -7350 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -7400 +150 -30100
+200 -7350 +150 -7350 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -7350 +150 -30100
+150 -7350 +200 -7350 +150 -4850 +200 -7300 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -30100
timeout//descendre lit
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -30100
+200 -7350 +150 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4850 +150 -7350 +150 -4850 +200 -4850 +150 -4850 +150 -30100
+150 -7350 +200 -4800 +200 -4850 +200 -7300 +200 -4800 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4800 +200 -30100
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -30100
+200 -7300 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4850 +150 -4850 +150 -30100
+150 -7350 +200 -4800 +200 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4850 +150 -30100
timeout

thanks

Are you sure your medical remote controller uses the same modulation frequency your IR sensor is calibrated to?

You say the IR remote uses an "unknown protocol", what makes you settle on the NEC protocol?

I have no idea how to interpret those numbers due to lack of information from you.

Hello,

thanks for your answer,

Are you sure your medical remote controller uses the same modulation frequency your IR sensor is calibrated to?
I have no idea, how i can get this information? i have buy this for ir https://www.amazon.fr/gp/product/B07BFNGF53/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1 and i use a arduino uno

You say the IR remote uses an "unknown protocol", what makes you settle on the NEC protocol?
I'm sorry I did not understand your question, usually I use VCR TV remotes that are recognized in most arduino library

I have no idea how to interpret those numbers due to lack of information from you.
Sorry, this is output of sample "allreaders" library "infrared" add it in Arduino run sample with "s" and default value you wil get output like i post, i don't know how use it too i read code of library for now.

thanks again for your help

alexandrev:

You say the IR remote uses an "unknown protocol", what makes you settle on the NEC protocol?
I'm sorry I did not understand your question, usually I use VCR TV remotes that are recognized in most arduino library

If it's an unknown protocol, you don't know what it is.
Yet you focus on a certain protocol.
That's contradictory. At the very least you should try multiple protocols if you don't know what it is, hoping that one of them works.

To find out what protocol it uses, and what modulation frequency, it's the easiest to ask the manufacturer.

That failing you could connect a generic IR photodiode to a scope, and see what frequency comes out. Then at least you know whether it's 38 kHz, or another frequency (e.g. 36 or 40 kHz).

with this library i get every ir pulse milliseconds so i thinked compare value with a range of error allowed.
With this i get every button pressed what do you think of it ? I don’t check every value i have no other ir remote controller sending something like that.

/*
// On/Off
+200 -7300 +200 -7350 +150 -4850 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -30100
+150 -7350 +200 -7350 +150 -4850 +200 -7300 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +150 -30100
// Bust/Bed down
+250 -7350 +150 -7350 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -30100
+200 -7350 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -30100
// Bust up
+150 -7350 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -7350 +200 -7350 +150 -30100
+200 -7300 +200 -7350 +150 -4850 +200 -7350 +200 -4800 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +150 -7350 +200 -30100
// Bust down
+150 -7350 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +200 -4800 +200 -7350 +150 -4850 +150 -30100
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +200 -4800 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -7350 +200 -4800 +200 -30100
// Bed up
+150 -7350 +200 -7350 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -30100
+200 -7350 +150 -7350 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -7350 +150 -30100
// Bed down
+150 -7350 +200 -4800 +200 -4850 +200 -7300 +200 -4800 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4800 +200 -30100
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -30100
*/

byte Analyse_IR_Receveid() {
  int dataLength = receiver->getDataLength();
  int lastSignal[24];
  if (dataLength == cSIGNAL_LENGTH)
  {
    for (unsigned int i = 0U; i < dataLength; i++) {
      lastSignal[i] = receiver->getDuration(i);
      #ifdef DEBUG
        Serial.print(lastSignal[i], DEC); Serial.print(" ");
      #endif
    }
    #ifdef DEBUG
      Serial.println();
    #endif

    // Test some value ensure signal are from correct remote infrared
    if (lastSignal[0] < 300 && lastSignal[1] > 7200 && lastSignal[2] < 300 && lastSignal[3] > 4700 &&
      lastSignal[4] < 300 && lastSignal[5] > 4700 && lastSignal[6] < 300 && lastSignal[7] > 7200)
    {
      if (lastSignal[15] > 4700 && lastSignal[15] < 5000)
      {
        if (lastSignal[19] > 4700 && lastSignal[19] < 5000 && lastSignal[21] > 7200 && lastSignal[21] < 7500)
          return cKEY_PRESSED_ON_OFF;
        else if (lastSignal[19] > 4700 && lastSignal[19] < 5000 && lastSignal[21] > 4700 && lastSignal[21] < 5000)
          return cKEY_PRESSED_BUST_BED_DOWN;        
      }
      else if (lastSignal[15] > 7200 && lastSignal[15] < 7500)
      {
        if (lastSignal[19] > 7200 && lastSignal[19] < 7500 && lastSignal[21] > 7200 && lastSignal[21] < 7500)
          return cKEY_PRESSED_BUST_UP;
        else if (lastSignal[19] > 7200 && lastSignal[19] < 7500 && lastSignal[21] > 4700 && lastSignal[21] < 5000)
          return cKEY_PRESSED_BUST_DOWN;
        if (lastSignal[19] > 4700 && lastSignal[19] < 5000 && lastSignal[21] > 7200 && lastSignal[21] < 7500)
          return cKEY_PRESSED_BED_UP;
        else if (lastSignal[19] > 4700 && lastSignal[19] < 5000 && lastSignal[21] > 4700 && lastSignal[21] < 5000)
          return cKEY_PRESSED_BED_DOWN;
      }

      // not correct comparaison, we don't find btn pressed
      return cKEY_PRESSED_UNKNOW;
      /*Serial.println(lastSignal[15]);
      Serial.println(lastSignal[19]);
      Serial.println(lastSignal[21]);*/   
    }
  }

  // something wrong ?
  return cSIGNAL_UNKNOW;
}
#define DEBUG // for get debug informations
//#undef DEBUG // for production

// libraries for get infrared code
#include <Arduino.h>
#include <IrWidgetAggregating.h>
#include <IrReceiverPoll.h>
#include <IrReceiverSampler.h>

IrReceiver *receiver;

// for get witch button are pressed
const byte cSIGNAL_UNKNOW             = 0;
const byte cKEY_PRESSED_UNKNOW        = 10;
const byte cKEY_PRESSED_ON_OFF        = 20;
const byte cKEY_PRESSED_BUST_BED_DOWN = 21;
const byte cKEY_PRESSED_BUST_UP       = 30;
const byte cKEY_PRESSED_BUST_DOWN     = 31;
const byte cKEY_PRESSED_BED_UP        = 40;
const byte cKEY_PRESSED_BED_DOWN      = 41;

const byte cSIGNAL_LENGTH = 24;

#define BAUD 115200

const unsigned int captureLength = 500;
const pin_t receiverPin          = 2;
const microseconds_t markExcess  = 50;

void setup() {
  Serial.begin(BAUD);
  Serial.setTimeout(10000);
  Serial.flush();
  
  int   beginningTimeout = 3000;
  int  endingTimeout = 30;

  receiver = IrReceiverSampler::newIrReceiverSampler(captureLength, receiverPin,
    false, markExcess, beginningTimeout, endingTimeout);
  Serial.println("Fin setup");
}

void loop() {
  receiver->receive(); // combines enable, loop, disable
  if (receiver->isEmpty())
    Serial.println(F("timeout"));
  else
  {
    switch (Analyse_IR_Receveid()) {
      case cKEY_PRESSED_ON_OFF:
        Serial.println("On/Off");
        break;
      case cKEY_PRESSED_BUST_BED_DOWN:
        Serial.println("Bust and bed down");          
        break;
    }
  }
}

Output in monitor when i press key :

timeout
200 7350 200 4800 200 4850 150 7350 200 4800 200 4850 150 4850 150 4850 200 4850 150 4850 150 7350 200 30100
On/Off
200 7350 150 7350 200 4850 150 7350 200 4800 200 4850 150 4850 150 4850 200 4850 150 4850 150 7350 200 30100
On/Off
timeout
150 7350 200 4850 150 4850 150 7350 200 4850 150 4850 150 4850 200 4800 200 4850 150 4850 200 4800 200 30100
Bust and bed down
200 7350 200 4800 200 4850 150 7400 150 4800 200 4850 150 4850 150 4850 200 4850 150 4850 150 4850 200 30100
Bust and bed down
200 7350 150 4850 200 4800 200 7350 150 4850 200 4800 200 4850 150 4850 200 4800 200 4850 150 4850 200 30100
Bust and bed down
200 7350 150 4850 150 4850 200 7350 150 4850 150 4850 200 4850 150 4850 150 4850 200 4850 150 4850 150 30100
Bust and bed down
timeout
200 7350 150 7350 200 4800 200 7350 150 4850 200 4800 200 4850 200 7300 200 4850 150 4850 150 7350 200 30100
150 7350 200 7300 200 4850 150 7350 200 4850 150 4850 150 4850 200 7350 150 4850 150 4850 200 7350 150 30100
150 7350 200 7350 150 4850 200 7350 150 4850 150 4800 250 4800 200 7350 150 4850 200 4850 150 7350 200 30100
timeout
timeout

Thanks for your help

I have no idea, how i can get this information? i have buy this for ir https://www.amazon.fr/gp/product/B07BFNGF53/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1 and i use a arduino uno

That one is good for 38kHz modulated signals. This is what most home electronics remotes use but it's not that unlikely that a manufacturer of medical devices uses another modulation frequency to not be interfered by other remotes.

So either ask the manufacturer or try the last tip of wvmarle to find that out. Posting hundreds of values that IRremote prints out won't help as long as you haven't fixed that problem.

Hi,

I am the author of the library “Infrared” (or “Infrared4Arduino”). Glad that you are using it. I hope that you agree that it does have a few advantages in comparision with IRremote…

“Unknown protocol” means, as been said before, that the software does not recognize it directly. Unless you want ro use the raw signals as is, the way to go about is to ask a knowledgeable program (or person :-)) about it. I pasted some of your signals into IrScrutinizer (which is an open source program, also by myself), and it identified the signal as RECS80, This is an old protocol by Philips, sometimes found in somewhat “uncommon” products. RECS80 is not directly recognized by IRremote or Infrared4Arduino, it is an “unknown protocol”.

Offically, the RECS80 protocol has 38kHz modulation, but sometimes implementations select another frequency. However, you are receiving “nice” and stable data, so there is a reason to believe that your 38kHz receiver actually does the job. (In case you want to measure it, use a receiver like a TSMP58000, for example like this.)

You have already written a routine analyzing the raw signals, Analyse_IR_Receveid(). It is in principle solving the poroblem. You have obviously understood what is going on!

I just could not help myself, so I implemented a RECS80 decoder for Infrared4Arduino, and checked it into my Github repository. To use, check out the branch recs80 from the Github repository. You should then be able to do something like this:

#include <IrReceiverSampler.h>
#include <Recs80Decoder.h>

#define ENDING_TIMEOUT 35U

void setup() {
...
    receiver = IrReceiverSampler::newIrReceiverSampler(BUFFERSIZE, RECEIVE_PIN);
    receiver->setEndingTimeout(ENDING_TIMEOUT);
}


void loop() {
  receiver->receive();
  if (receiver->isEmpty())
    Serial.println(F("timeout"));
  else
  {

      Recs80Decoder decoder(*receiver);
      if (decoder.getD() != 2 )
           Serial.println(F("No decode"));
      else {
    
switch (decoder.getF()) {
      case 0:
        Serial.println("On/Off");
        break;
      case 1:
        Serial.println("Bust and bed down");         
        break;
default:
        Serial.println(F("unknown command"));
    }
  }

Hope this helps. Please ask if something is unclear.

Hello,

Life is weird sometimes I was writing you an e-mail when I wanted to check if there were any new answers to my topics before sending. And then I see that it's Christmas in the middle of July.

First thank you for this great library it's a remarkable job.

I tried to understand what you wrote in Recs80Decoder but for now I have not understood everything I need to research more about this protocol.

Anyway thank you again because I compiled and tried the example Recs80Decoder and it works perfectly here is the output I have by pressing all the buttons on the remote:

timeout
timeout
timeout
timeout
timeout
// On/Off
+150 -7350 +200 -7350 +150 -4850 +200 -7300 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +200 -35100
RECS80 2 1 1
timeout
// Bust/Bed down
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +200 -4800 +150 -4850 +200 -4850 +200 -4800 +150 -35100
RECS80 2 0 0
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -35100
RECS80 2 0 0
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4850 +200 -4850 +150 -4850 +150 -4850 +200 -4800 +200 -4850 +150 -4850 +200 -35100
RECS80 2 0 0
timeout
// Bust up
+200 -7300 +200 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +150 -7350 +200 -35100
RECS80 2 11 1
+200 -7350 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +200 -7300 +200 -35100
RECS80 2 11 1
+200 -7350 +150 -7350 +200 -4800 +200 -7350 +200 -4800 +200 -4800 +200 -4850 +200 -7300 +200 -4800 +200 -7350 +200 -7300 +200 -35100
RECS80 2 11 1
timeout
// Bust down
+200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -4900 +150 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -35100
RECS80 2 10 0
+200 -7300 +200 -4800 +200 -4850 +200 -7300 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +200 -4800 +150 -7350 +200 -4850 +200 -35100
RECS80 2 10 0
+200 -7350 +200 -4800 +200 -4800 +200 -7350 +200 -4800 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -7350 +150 -4850 +200 -35100
RECS80 2 10 0
timeout
timeout
// Bed up
+200 -7350 +150 -7350 +200 -4800 +200 -7350 +200 -4800 +200 -4800 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +200 -7300 +200 -35100
RECS80 2 9 1
+150 -7350 +200 -7350 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4850 +150 -7350 +200 -4800 +200 -4850 +200 -7300 +200 -35100
RECS80 2 9 1
+150 -7350 +200 -7350 +150 -4850 +150 -7350 +200 -4850 +200 -4800 +200 -4800 +200 -7350 +150 -4850 +200 -4800 +200 -7350 +150 -35100
RECS80 2 9 1
timeout
timeout
// Bed down
+150 -7350 +200 -4800 +200 -4850 +150 -7350 +200 -4850 +150 -4850 +150 -4850 +200 -7350 +150 -4850 +200 -4800 +200 -4850 +150 -35100
RECS80 2 8 0
+150 -7350 +200 -4850 +150 -4850 +150 -7350 +200 -4850 +150 -4850 +200 -4800 +200 -7350 +150 -4800 +250 -4800 +200 -4850 +150 -35100
No decode
+200 -7300 +200 -4850 +150 -4850 +200 -7350 +150 -4850 +150 -4850 +200 -4800 +200 -7350 +200 -4800 +200 -4800 +200 -4850 +150 -35100
RECS80 2 8 0
timeout
timeout
timeout
timeout
timeout

now i only need to register F, D, T Value and test them with getF(), ...

It's way better than what I wrote as code. Once again, thank you for your work.

If I wrote you it was for something else, I looked in the sources and I do not find how you do to blink the led, I was looking for references like led, blink, on, I find definitions in boarddefs.h but after i can not find where they are used in other files.
Can you help me please tell me which file to watch. Thank you, because flashing is a problem in a room without light with a transparent case.

I read your link and IrScrutinizer seem to be amazing too, i have save it if i need analyse a new IR remote controller.

Nice that you liked it!

All your signals seems to have D ("device address") equal to 2. F ("functiion number") is the interesting one, that is telling what command it is. T ("toggle") is flipping (toggling) every time you press a button on the remote (probably...); just ignore it.

The little snippet I wrote in my message illustrates what I think is to be done.

Blinking: "Christmas tree"-blinking like in IRremote is not (presently) supported. I consider it as a debug feature that was never removed. It costs processor cycles in a time-critical loop, even if it is made to be (runtime) disable-able. Possibly you can instead turn on a LED when you have received a "good" signal (only) -- that would be more high-level. If you absolutely want the IRremote-type blinking you can modify the ISR routine in IrReceiverSampler. If you want to do it cleanly, the best method is probably to write a subclass of IrReceiverSampler. say IrReceiverSamplerBlinker.

Ok thanks now it’s working great.

my mistake, it’s tx led who bliking not with your library :slight_smile: so i will get a arduino without led for fix that

i want make it better and allow user use another remote controller (long to explain i must use recs80 but other people can use another controller)

so i modify “MultiDecoder” add “Recs80Decoder”
and in my program i want test type

if (decoder.getType() = recs80)

but type not know, how test it please, i suc… in C++ i know i must learn it.

below files i have modified:

#ifndef _MULTIDECODER_H
#define _MULTIDECODER_H

#include "IrReader.h"
#include "IrDecoder.h"

/**
 * A preliminary multi protocol decoder. Tries the Nec1- and the Rc5 decoders.
 */
class MultiDecoder : public IrDecoder {
public:
    /**
     * Enum over possible outcomes of the decoder.
     */
    enum Type {
        timeout,        ///< beginTimeout reached
        noise,          ///< nothing sensible found
        undecoded,      ///< decoding failed
        nec,            ///< NEC1 intro
        nec_ditto,      ///< NEC1 repeat
        rc5,             ///< RC5 signal (= repeat sequence)
	recs80         ///< Recs80 signal (= repeat sequence)
    };

private:
    char decode[17];
    Type type;

public:
    Type getType() const {
        return type;
    }

    /**
     * Constructs a MultiDecoder from an IrReader, containing data.
     * @param irReader IrReader with data, i.e. with isReady() true.
     */
    MultiDecoder(const IrReader &irReader);

    virtual ~MultiDecoder() {
    }

    const char *getDecode() const {
        return decode;
    }
};

#endif // ! _MULTIDECODER_H
#include "MultiDecoder.h"
#include "Nec1Decoder.h"
#include "Rc5Decoder.h"
#include "Recs80Decoder.h"
#include <string.h>

 MultiDecoder::MultiDecoder(const IrReader &IrReader) {
    if (IrReader.isEmpty()) {
        type = timeout;
        strcpy(decode, ".");
        return;
    }

    if (IrReader.getDataLength() < 3) {
        type = noise;
        strcpy(decode, ":");
        return;
    }

    Nec1Decoder nec1decoder(IrReader);
    if (nec1decoder.isValid()) {
        strcpy(decode, nec1decoder.getDecode());
        type = nec1decoder.isDitto() ? nec_ditto : nec;
        setValid(true);
        return;
    }

    Rc5Decoder rc5decoder(IrReader);
    if (rc5decoder.isValid()) {
        strcpy(decode, rc5decoder.getDecode());
        type = rc5;
        setValid(true);
        return;
    }

    Recs80Decoder recs80decoder(IrReader);
    if (recs80decoder.isValid()) {
        strcpy(decode, recs80decoder.getDecode());
        type = recs80;
        setValid(true);
        return;
    }

    // Giving up
    strcpy(decode, "***");
    type = undecoded;
}

i have tried modifying for return decoder used so i can use it instead of create it again but without success.

Thanks for your help.

It appears that it is almost working. Nice. Not 100% sure about the current problem, but

if (decoder.getType() = recs80)

is definitely wrong, should be

if (decoder.getType() == recs80)

Hope this helps.

Thanks for reply, my mistake again i miss a = in my post not in my code.

demo error i get:

// libraries for get infrared code
#include <Arduino.h>
#include <IrReceiverSampler.h>
#include <MultiDecoder.h>

IrReceiver *receiver;

#define BAUD 115200

const unsigned int captureLength = 500;
const pin_t receiverPin          = 3;
const microseconds_t markExcess  = 50;

void setup() {
  Serial.begin(BAUD);
  Serial.setTimeout(10000);
  Serial.flush();
  
  int beginningTimeout = 3000;
  int endingTimeout = 30;

  receiver = IrReceiverSampler::newIrReceiverSampler(captureLength, receiverPin,
    false, markExcess, beginningTimeout, endingTimeout);
  Serial.println("Fin setup");
}

void loop() {
  receiver->receive(); // combines enable, loop, disable
  if (receiver->isEmpty())
    Serial.println(F("timeout"));
  else
  {    
    MultiDecoder decoder(*receiver);
    if (decoder.isValid())
    {
      if (decoder.getType() == recs80) // get message: error: 'recs80' was not declared in this scope
      {
        Serial.println(Analyse_IR_Receveid(decoder));

        // how get decoder used in multidecoder so i not need create it again like that
        Recs80Decoder recs80decoder(*receiver);
        if (recs80decoder.isValid()) {
          //recs80decoder.getD()
        }
      }
    }
  }
}

Thr reason that it does not compile is that Type does not belong to the global scope, it belongs to the class MultiDecoder. So you can still access it, but with the class name, i.e. MultiDecoder::Type::recs80.

Here is my suggested solution:

#include <IrReceiverSampler.h>
#include <Nec1Decoder.h>
#include <Recs80Decoder.h>

IrReceiver *receiver;

#define BAUD 115200

const size_t captureLength = 500;
const pin_t receiverPin = 5;
const microseconds_t markExcess = 50;
const milliseconds_t beginningTimeout = 3000;
const milliseconds_t endingTimeout = 30;

void setup() {
    Serial.begin(BAUD);
    Serial.setTimeout(10000);
    Serial.flush();

    receiver = IrReceiverSampler::newIrReceiverSampler(captureLength, receiverPin,
            false, markExcess, beginningTimeout, endingTimeout);
}

void loop() {
    receiver->receive(); // combines enable, loop, disable
    if (receiver->isEmpty()) {
        Serial.println(F("timeout"));
        return;
    }

    Recs80Decoder recs80decoder(*receiver);
    if (recs80decoder.isValid()) {
        // Ignore everything with D != 2,
        // F carries the command,
        // T can be ignored.
        if (recs80decoder.getD() == 2) {
            unsigned int F = recs80decoder.getF();
            switch (F) {
                case 0:
                    Serial.println(F("Bust/Bed down"));
                    break;
                case 1:
                    Serial.println(F("On/Off"));
                    break;
                case 2:
                    Serial.println(F("xxx"));
                    break;
                // ...
                default:
                    Serial.println(F);
            }
        }
        return;
    }

    Nec1Decoder nec1decoder(*receiver);
    if (nec1decoder.isValid()) {
        Serial.println(nec1decoder.getDecode());
        //  ...
        return;
    }

    Serial.println(F("signal with unknown protocol received"));
}

Thanks you so much for your help!!!

I have followed your advice and all is working great.

Thanks everybody. Now i go in vacancy :sunglasses: