Raw Infrared Data Problem for IR Remote Controller

Hello everyone,
I am not using Linux, I am using Windows 8. I have a problem when receiving raw infrared data. When I receive this kind of signal, I get data in this form:
641D1E1E
Unknown encoding: 641D1E1E (32 bits)
Raw (100): -5676 3800 -1800 550 -400 500 -1350 550 -400 500 -1350 550 -400 500 -1350 500 -450 500 -1350 500 -450 500 -1350 500 -450 500 -1350 500 -1350 500 -450 500 -1350 500 -450 500 -1350 550 -1300 500 -1400 450 -1400 500 -450 500 -400 500 -1400 500 -1350 500 -450 450 -450 550 -400 500 -400 550 -1350 500 -400 550 -400 500 -450 500 -1350 500 -1350 500 -1400 450 -1400 500 -400 500 -450 500 -450 500 -450 500 -1350 500 -400 550 -400 500 -450 450 -1400 500 -450 450 -450 500 -450 500

However, I know that if I want to resend this signal, I have to put all the values in an array and ignore the negative sign, so is there a quick way to do this using some kind of a smart code without having to do that through Linux commands?

You could change the IRrevcDump sketch to output the raw data with commas:

 for (int i = 0; i < count; i++) {
      Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
      Serial.print(",");
    }

Then you can use cut and paste to put the data into your sketch.

If you want to recognize signals from remotes that don't use a recognized format:

thanks for your reply..it now prints it just the way i want :slight_smile: the problem still occurs that the air conditioner im trying to turn on is not working..im using a Sharp air conditioner so i dont know what the frequency of it might be as the 38 is definitely not working with it

AC units often use VERY long IR codes. You will need to make changes to the IR library to record the full message. There was a long message thread a short time ago about this. Perhaps a search would find it for you.

I imported your raw data into AnalysIR and saved a copy of the signal trace below.

As per previous post your message is being truncated by hitting the (default) max buffer length within IRremote. You need to go into your copy of the library and up the size until you get the full message. A search will find what to change if you are not sure.

PS: The image shows the same signal at different zoom levels

#define RAWBUF 100 // Length of raw duration bufferin IRremote.h

Attached is an image of a similar SHARP AC signal which is compared to your truncated signal.

You will need to up RAWBUF to circa 220 to capture this signal with IRremote (min 212).

Here is some autogenerated code to send ON, OFF for SHARP AC for you to try (They look similar to your signal)

/*
Automatically Generated by AnalysIR - Batch Export Utility
Registered to: 
Session History
Type : Key : Value : Bits
0 : RAW : ON :  : 0
1 : RAW : OFF :  : 0
*/
// NB: Not all protocols are supported by IRremote or IRLib. You may need to edit the code below manually
// Automatically Generated by AnalysIR for , visit http://www.AnalysIR.com or email info@....... for further details

unsigned int Signal_ON_0[] = {3828,1824,532,408,536,1348,536,408,560,1324,536,408,536,1348,536,408,560,1328,512,432,536,1348,536,408,536,1352,564,1324,540,404,536,1356,532,408,536,1348,540,1352,536,1348,536,1352,560,380,540,404,536,1348,540,1348,536,408,536,404,536,408,560,380,564,1324,536,408,532,416,560,380,536,1348,536,412,532,408,564,1328,536,404,564,384,532,408,536,404,540,1352,560,384,536,404,536,408,536,1348,536,412,536,404,536,404,540,408,532,1352,536,408,532,412,532,408,536,1352,536,404,540,404,540,404,536,408,536,408,532,412,536,408,536,404,564,380,536,412,536,404,540,404,540,404,536,1352,536,408,544,400,540,408,532,408,560,380,540,404,564,380,536,404,540,408,532,408,564,376,540,1352,536,404,536,408,536,408,536,404,564,380,564,380,568,372,564,380,536,412,532,408,540,404,564,380,536,1352,536,1356,536,1352,536,1352,540,1352,536,408,536,408,532,412,532,412,536,1348,536,408,536,1352,536}; //AnalysIR Batch Export - RAW
irsend.sendRaw(Signal_ON_0, sizeof(Signal_ON_0)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:  ON


unsigned int Signal_OFF_1[] = {3832,1820,540,404,536,1356,532,408,536,1352,536,404,540,1348,560,380,536,1352,560,376,536,1352,536,404,540,1348,536,1348,536,408,536,1348,536,412,536,1348,536,1356,536,1352,532,1352,540,408,532,408,536,1352,564,1328,532,404,564,380,536,408,536,404,536,1352,536,404,540,404,564,380,536,1348,564,380,536,404,536,1352,532,404,540,404,536,412,532,412,536,1348,564,380,536,404,544,404,532,412,536,1348,564,384,536,408,560,380,536,1352,540,408,536,404,532,412,536,1348,536,408,512,428,536,408,532,412,536,404,536,404,536,408,536,404,540,404,536,408,536,404,540,404,564,380,536,1352,540,404,536,408,560,384,536,404,536,412,532,408,540,404,536,408,536,408,536,408,536,408,512,1372,540,404,540,408,532,408,536,408,532,412,532,412,536,404,536,408,532,412,536,404,564,380,536,408,560,1324,564,1324,536,1352,536,1352,536,1356,508,440,528,408,536,408,540,1348,536,412,536,404,564,1328,536}; //AnalysIR Batch Export - RAW

irsend.sendRaw(Signal_OFF_1, sizeof(Signal_OFF_1)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:  OFF

let me know if these signals work on your SHARP AC

PS: set khz to 38

sadly, it didnt work... i opted the rawbuf size to be 220 in the irremote.h file and this is my code:

#include <IRremote.h>

IRsend irsend;

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long value;
unsigned int Signal_ON_0[] =  {30394, 3750, 1850, 500, 400, 550, 1350, 500, 400, 500, 1350, 500, 450, 500, 1350, 500, 450, 500, 1350, 550, 400, 500, 1350, 500, 450, 500, 1350, 500, 1400, 500, 400, 500, 1350, 500, 450, 550, 1350, 500, 1350, 500, 1350, 500, 1350, 500, 450, 500, 450, 500, 1350, 500, 1350, 500, 450, 500, 450, 500, 400, 500, 450, 500, 1350, 500, 450, 500, 400, 550, 400, 500, 450, 500, 400, 500, 450, 500, 1350, 500, 450, 500, 400, 500, 450, 500, 450, 500, 1350, 550, 400, 500, 400, 500, 450, 500, 1350, 550, 400, 500, 450, 500, 400, 500, 1400, 500, 400, 500, 450, 500, 400, 500, 450, 500, 1350, 550, 400, 500, 450, 500, 400, 500, 450, 500, 450, 450, 450, 550, 400, 500, 400, 550, 400, 500, 450, 500, 450, 450, 450, 500, 450, 500, 1350, 500, 450, 450, 450, 550, 400, 500, 450, 450, 450, 550, 400, 500, 400, 500, 450, 500, 450, 500, 400, 550, 400, 500, 1350, 550, 400, 500, 450, 450, 450, 550, 400, 500, 400, 550, 400, 500, 450, 500, 450, 500, 400, 500, 450, 500, 1350, 500, 450, 500, 1350, 500, 1350, 550, 1350, 500, 1350, 500, 1350, 500, 450, 500, 450, 500, 400, 500, 450, 500, 400, 550, 1350, 500, 1350, 500}; 
void setup()
{
  Serial.begin(9600);
    irrecv.enableIRIn(); // Start the receiver

}

void loop() {
  while(Serial.available()>= 0){
         if (Serial.read() == '0') {
         Serial.println("Transmitting");
         for (int i = 0; i < 3; i++) {
irsend.sendRaw(Signal_ON_0, sizeof(Signal_ON_0)/sizeof(int), 38); //AnalysIR Batch Export - RAW

            delay(40);

         }
       }else if (irrecv.decode(&results)) {
       Serial.println("Receiving");
       Serial.println(results.value, HEX);
       value = results.value;

      irrecv.resume(); // Receive the next value
         }
  }
}

change the following...
unsigned int Signal_ON_0[] = {30394, 3750, 1850, 500,............
to
unsigned int Signal_ON_0[] = { 3750, 1850, 500,........

sendRAW must start with a Mark(High) and the 30394 is a Space(Low) but treated by sendRaw as HIgh.....This is is an occasional bug with Irremote when decoding in RAW mode. The impact would have been an inverted signal

Also, post a copy of the IRdump output for the signal

i'll test that thank you!
but about the IRdump output, im not sure what u mean... the array i just posted is the one i got from the dump..did i get you right?

i kind of got confused :smiley: i only added the space after the curly brace and spaces after each coma, i didnt get it when u mentioned the sendRAW function itself...should i remove the space after its bracket or what did u mean?

...the output from the IRrecvDUMP eaxmple that comes with the library.

looks like: Raw (139): 8996,-4428,688,-516,680,-516,684,....................etc

heidiheweidy:
i kind of got confused :smiley: i only added the space after the curly brace and spaces after each coma, i didnt get it when u mentioned the sendRAW function itself...should i remove the space after its bracket or what did u mean?

....just delete the first value and comma '30394,'

ahaaaa..thank u alot really :slight_smile:

i tried to use the output just as it is from the IRRecvDump (with the negative signs) but it didnt work and i also tried it again ignoring the negative sign.
I tried it after i fixed the spacing problem as mentioned above and i deleted the first value and tried..but again was not successful.
As for the buffer size, I didnt change it because i did not find any change when i did so once.
is there any other way i could try?
here's my irrecvdump output as it is:

unsigned int Signal_ON_0[] = { -31454, 3800, -1800, 500, -450, 500, -1350, 500, -450, 500, -1350, 500, -450, 450, -1400, 500, -400, 500, -1400, 500, -450, 500, -1350, 500, -400, 500, -1400, 500, -1350, 500, -450, 450, -1400, 500, -450, 450, -1400, 500, -1350, 500, -1400, 450, -1400, 500, -400, 550, -400, 500, -1350, 500, -1400, 500, -400, 550, -400, 500, -450, 500, -400, 500, -1400, 500, -400, 500, -450, 500, -450, 450, -1400, 500, -1350, 500, -1350, 550, -1350, 500, -400, 500, -450, 500, -400, 500, -450, 500, -1400, 450, -450, 550, -400, 500, -400, 550, -1350, 450, -450, 550, -400, 500, -450, 500 };

and here's how i call the sending function:

irsend.sendRaw(Signal_ON_0, sizeof(Signal_ON_0)/sizeof(int), 38); //AnalysIR Batch Export - RAW

This is not the output for IRrecvdump....see my earlier post for what it looks like... Raw(xx) etc....

You have still left in the leading space which means it will not work....your data array should start at the 3800 value(or 3750)...also mentioned in my earlier post.

Also you need to leave the rawbuf size at 220 or else it will not work when receiving a signal.

Summary:
1: Make sure you are sending a signal with more than 100 (actually over 200 bytes). If the lenght is circa 100 it is wrong.
2: make sure the signal starts with a value of 3800 or 3750
3: Send me the output of IRrecvdump using rawbuf set to 220

Hello, here's my IRRecvDump output:

4A6D830F
Unknown encoding: 4A6D830F (32 bits)
Raw (212): 32428, 3750, -1850, 500, -400, 500, -1350, 550, -400, 500, -1350, 500, -450, 500, -1350, 550, -400, 500, -1350, 500, -450, 500, -1350, 500, -450, 500, -1350, 500, -1350, 500, -450, 500, -1350, 500, -450, 500, -1350, 500, -1400, 450, -1400, 500, -1350, 500, -450, 500, -400, 500, -1400, 450, -1400, 500, -450, 500, -400, 550, -400, 500, -450, 500, -1350, 500, -400, 550, -400, 500, -450, 500, -400, 500, -450, 500, -450, 450, -1400, 500, -450, 450, -450, 500, -450, 500, -450, 450, -1400, 500, -400, 500, -450, 500, -450, 500, -1350, 500, -450, 500, -400, 500, -450, 500, -1350, 550, -400, 500, -400, 550, -400, 500, -450, 450, -1400, 500, -450, 450, -450, 550, -400, 500, -450, 500, -400, 500, -450, 500, -400, 500, -450, 500, -450, 500, -400, 550, -400, 500, -450, 500, -400, 550, -1350, 500, -400, 500, -450, 500, -400, 550, -400, 500, -450, 500, -400, 500, -450, 500, -450, 450, -450, 550, -400, 500, -400, 500, -1400, 500, -450, 500, -400, 500, -450, 500, -400, 500, -450, 500, -450, 500, -400, 500, -450, 500, -450, 450, -450, 550, -1300, 500, -450, 500, -1350, 500, -1400, 450, -1400, 500, -1350, 500, -1400, 500, -400, 550, -400, 500, -450, 500, -400, 500, -450, 500, -1350, 500, -1350, 500,

Good...

Attached is an image of the signal trace, which looks clean.

Below is some automatically generated C code from AnalysIR to send this signal using IRremote. You should just incorporate this into your sketch.

/*
Automatically Generated by AnalysIR - Batch Export Utility
Registered to:
Session History
Type : Key : Value : Bits
0 : RAW :  :  : 0
*/
int khz=38;//modulation frequency of 38kHz

// NB: Not all protocols are supported by IRremote or IRLib. You may need to edit the code below manually
// Automatically Generated by AnalysIR for xx, visit http://www.AnalysIR.com or email info@....... for further details


unsigned int Signal_0_0[] = {3750,1850,500,400,500,1350,550,400,500,1350,500,450,500,1350,550,400,500,1350,500,450,500,1350,500,450,500,1350,500,1350,500,450,500,1350,500,450,500,1350,500,1400,450,1400,500,1350,500,450,500,400,500,1400,450,1400,500,450,500,400,550,400,500,450,500,1350,500,400,550,400,500,450,500,400,500,450,500,450,450,1400,500,450,450,450,500,450,500,450,450,1400,500,400,500,450,500,450,500,1350,500,450,500,400,500,450,500,1350,550,400,500,400,550,400,500,450,450,1400,500,450,450,450,550,400,500,450,500,400,500,450,500,400,500,450,500,450,500,400,550,400,500,450,500,400,550,1350,500,400,500,450,500,400,550,400,500,450,500,400,500,450,500,450,450,450,550,400,500,400,500,1400,500,450,500,400,500,450,500,400,500,450,500,450,500,400,500,450,500,450,450,450,550,1300,500,450,500,1350,500,1400,450,1400,500,1350,500,1400,500,400,550,400,500,450,500,400,500,450,500,1350,500,1350,500,1000}; //AnalysIR Batch Export - RAW

irsend.sendRaw(Signal_0_0, sizeof(Signal_0_0)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:

I am not sure which AC unit you are trying to control. Please let us know the AC model & the model of remote control, just for reference.

However, the signal has some of the characteristics of a Panasonic signal. If I am correct the signal above can be cleaned up further by replacing the values to one of the following.
3840
1920
480
1380
Just replace the values in the code above to the nearest ones in this list, if the code example does not work out.

PS: could you also let me know which model of IR receiver you are using? tnx

it's working now!!! thank u so much! :smiley:
im using arduino uno
i just want to know what exactly u did to convert such an array into those values that u sent

Great...

heidiheweidy:
i just want to know what exactly u did to convert such an array into those values that u sent

I just imported the 'RAW' IRremote output you posted into AnalysIR, which also has a facility to export the 'C' code of any imported or recorded Infrared signal in IRremote, IRLib and several other common IR formats. For other signals all you have to do is just replace the timing values to match the new signal.

Also, please let us know, for future reference:

  1. The model no of your Sharp Air Conditioner
  2. The model no of your remote control
  3. The model no of the IR receiver you used (or a link to the data sheet)
  4. Finally, it might be useful to others if you posted the final Arduino code that worked for you.

so, my remote controller is CRMC-A808JBEZ
my AC is SHARP model is AY-A12LSE
my ir receiver type is: Infrared Receiver Diode IR004
and the code that finally made turning the AC on work (thanks to analysir) is:

/*
 * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
 * An IR LED must be connected to Arduino PWM pin 3.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>

IRsend irsend;

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
unsigned long value;
/*
Automatically Generated by AnalysIR - Batch Export Utility
Registered to:
Session History
Type : Key : Value : Bits
0 : RAW :  :  : 0
*/
int khz=38;//modulation frequency of 38kHz

// NB: Not all protocols are supported by IRremote or IRLib. You may need to edit the code below manually
// Automatically Generated by AnalysIR for xx, visit http://www.AnalysIR.com or email info@....... for further details


unsigned int Signal_0_0[] = {3750,1850,500,400,500,1350,550,400,500,1350,500,450,500,1350,550,400,500,1350,500,450,500,1350,500,450,500,1350,500,1350,500,450,500,1350,500,450,500,1350,500,1400,450,1400,500,1350,500,450,500,400,500,1400,450,1400,500,450,500,400,550,400,500,450,500,1350,500,400,550,400,500,450,500,400,500,450,500,450,450,1400,500,450,450,450,500,450,500,450,450,1400,500,400,500,450,500,450,500,1350,500,450,500,400,500,450,500,1350,550,400,500,400,550,400,500,450,450,1400,500,450,450,450,550,400,500,450,500,400,500,450,500,400,500,450,500,450,500,400,550,400,500,450,500,400,550,1350,500,400,500,450,500,400,550,400,500,450,500,400,500,450,500,450,450,450,550,400,500,400,500,1400,500,450,500,400,500,450,500,400,500,450,500,450,500,400,500,450,500,450,450,450,550,1300,500,450,500,1350,500,1400,450,1400,500,1350,500,1400,500,400,550,400,500,450,500,400,500,450,500,1350,500,1350,500,1000}; //AnalysIR Batch Export - RAW



void setup()
{
  Serial.begin(9600);
    irrecv.enableIRIn(); // Start the receiver

}

void loop() {
  while(Serial.available()>= 0){
         if (Serial.read() == '0') {
         Serial.println("Transmitting");
         for (int i = 0; i < 3; i++) {
irsend.sendRaw(Signal_0_0, sizeof(Signal_0_0)/sizeof(int), khz); //AnalysIR Batch Export - RAW
 // AnalysIR IR Protocol: RAW, Key:  
            delay(40);

         }
       }else if (irrecv.decode(&results)) {
       Serial.println("Receiving");
       Serial.println(results.value, HEX);
       value = results.value;

      irrecv.resume(); // Receive the next value
         }
  }
}