Mitsubishi IR AC remote decoding Problem

I am new here. I Want to decode Mitsubishi AC IR Remote . I have the following problems.
1: else if (results->decode_type == PANASONIC)
this condition becomes true, but i am using Mitsubishi AC Remote.
2:“Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)”
this output always comes even if i change the value of remote by changing temprature, fan speed mode or thing else.

#include <IRremote.h>

int RECV_PIN = 3;

IRrecv irrecv(RECV_PIN);

decode_results results;

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

// Dumps out the decode_results structure.
// Call this after IRrecv::decode()
// void * to work around compiler issue
//void dump(void *v) {
//  decode_results *results = (decode_results *)v
void dump(decode_results *results) {
  int count = results->rawlen;
  if (results->decode_type == UNKNOWN) {
    Serial.print("Unknown encoding: ");
  } 
  else if (results->decode_type == NEC) {
    Serial.print("Decoded NEC: ");
  } 
  else if (results->decode_type == SONY) {
    Serial.print("Decoded SONY: ");
  } 
  else if (results->decode_type == RC5) {
    Serial.print("Decoded RC5: ");
  } 
  else if (results->decode_type == RC6) {
    Serial.print("Decoded RC6: ");
  }
  else if (results->decode_type == PANASONIC) {	
    Serial.print("Decoded PANASONIC - Address: ");
    Serial.print(results->panasonicAddress,HEX);
    Serial.print(" Value: ");
  }
  else if (results->decode_type == JVC) {
     Serial.print("Decoded JVC: ");
  }
  Serial.print(results->value, HEX);
  Serial.print(" (");
  Serial.print(results->bits, DEC);
  Serial.println(" bits)");
  Serial.print("Raw (");
  Serial.print(count, DEC);
  Serial.print("): ");

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


void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    dump(&results);
    irrecv.resume(); // Receive the next value
  }
}

Code:

64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): -3190 3050 -1650 500 -1100 450 -1100 500 -350 450 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -1100 500 -300 500 -1100 500 -350 450 -350 500 -1100 500 -1050 500 -350 500 -1050 500 -1100 500 -350 450 -350 500 -1100 450 -350 500 -350 500 -1050 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -1100 500 -350 500 -300 500 -1100 500 -300 500 -350 500 
FFFFFFFF
FFFFFFFF (0 bits)
Raw (100): -16200 3050 -1650 500 -1100 450 -1100 500 -350 450 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -1100 500 -300 500 -1100 500 -350 450 -350 500 -1100 450 -1100 500 -350 500 -1050 500 -1100 500 -350 450 -350 500 -1100 450 -350 500 -350 500 -1050 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 450 -1100 500 -350 450 -350 500 
64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): -26492 3050 -1650 500 -1100 500 -1050 500 -350 500 -350 450 -350 500 -1100 450 -350 500 -350 500 -1050 500 -1100 500 -350 450 -1100 500 -350 500 -300 500 -1100 500 -1050 500 -350 500 -1050 500 -1100 500 -350 450 -350 500 -1100 500 -300 500 -350 500 -1100 450 -350 500 -350 500 -350 450 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -1100 500 -350 500 -350 450 -1100 500 -350 450 -350 500 
64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): 29448 3100 -1600 500 -1100 500 -1050 500 -350 500 -350 500 -300 500 -1100 500 -300 500 -350 500 -1100 450 -1100 500 -350 450 -1100 500 -350 500 -350 450 -1100 500 -1100 450 -350 500 -1100 450 -1100 500 -350 500 -300 500 -1100 500 -300 500 -350 500 -1100 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -1050 500 -350 500 -350 450 -1100 500 -350 450 -350 500 
64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): 24444 3050 -1650 500 -1050 500 -1100 500 -300 500 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -1100 450 -350 500 -1100 500 -300 500 -350 500 -1050 500 -1100 500 -350 450 -1100 500 -1050 500 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -300 500 -1100 500 -350 450 -350 500 -1100 450 -350 500 -350 500

It sounds as though the IR commands are not being decoded correctly but try this simpler test code

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

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

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}

Don’t worry about the type of signal that is being sent (Panasonic, etc) as long as the codes themselves work. Manufacturers may well use coding schemes that are also used by others.

Looks like you have the same problem as me, it is decoding the code correctly but the code is actually 96 bits long not 48. I am just trying to figure out all the commands for my air con at the moment. This is what an off command looks like from my remote.

BIN 11000100 11010011 01100100 10000000 00000000 00000100 11000000 01100000 10100000 00000000 00000000 00000000 00000000 11000010 HEX C4,D3,64,80,0,4,C0,60,A0,0,0,0,0,C2 DEC 196,211,100,128,0,4,192,96,160,0,0,0,0,194

Hi, I have a similar problem .I have a couple of weeks trying to crack the code of this command and the problem I have is always pressing the same key code always changes, whereas in a TV remote control to always press the same key code is always the same. could be the time to measure the code issuing the command? because as I read mitsubishi protocol is x-sat and not nec. this is what shows me to make the FAN button:

877DE001 Auto FFFFFFFF 6C96DCEB level 1 FFFFFFFF 1C60D627 level 2 FFFFFFFF F1355AB3 level3 FFFFFFFF C1B11485 level 4 FFFFFFFF A9C212CC Auto again FFFFFFFF

a greeting

@UKHeliBob ..Problem is yet same.nothing change.

Using the code that I posted are you saying that pressing the same key twice in succession outputs different Hex codes ? Is there any pattern to this ? ie does the output flip between 2 values ? What output do you get if you hold the key down ?

@UKHeliBob....Following is the output of your code. 64800024 this figure comes every time when i press any key except off button.nothing change in hex value.only change comes when i switch it off and on ac off value=64800004 ac on value =64800024

64800024
64800024
64800024
64800024
64800024
64800024
64800024
64800024
64800024
64800024
64800004

I think you will find the code is longer. The IR library code you are using assumes a 48 bit code from the C4D3 and drops the rest of the data, if you modify it to 112 bits you will see all the data. It wont convert it to hex as it is storing the entire code in a 16 bit unsigned integer. but it will give you all the timings.

arslankhan: Code:

64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): -3190 3050 -1650 500 -1100 450 -1100 500 -350 450 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -1100 500 -300 500 -1100 500 -350 450 -350 500 -1100 500 -1050 500 -350 500 -1050 500 -1100 500 -350 450 -350 500 -1100 450 -350 500 -350 500 -1050 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -1100 500 -350 500 -300 500 -1100 500 -300 500 -350 500 
FFFFFFFF
FFFFFFFF (0 bits)
Raw (100): -16200 3050 -1650 500 -1100 450 -1100 500 -350 450 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -1100 500 -300 500 -1100 500 -350 450 -350 500 -1100 450 -1100 500 -350 500 -1050 500 -1100 500 -350 450 -350 500 -1100 450 -350 500 -350 500 -1050 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 450 -1100 500 -350 450 -350 500 
64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): -26492 3050 -1650 500 -1100 500 -1050 500 -350 500 -350 450 -350 500 -1100 450 -350 500 -350 500 -1050 500 -1100 500 -350 450 -1100 500 -350 500 -300 500 -1100 500 -1050 500 -350 500 -1050 500 -1100 500 -350 450 -350 500 -1100 500 -300 500 -350 500 -1100 450 -350 500 -350 500 -350 450 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -1100 500 -350 500 -350 450 -1100 500 -350 450 -350 500 
64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): 29448 3100 -1600 500 -1100 500 -1050 500 -350 500 -350 500 -300 500 -1100 500 -300 500 -350 500 -1100 450 -1100 500 -350 450 -1100 500 -350 500 -350 450 -1100 500 -1100 450 -350 500 -1100 450 -1100 500 -350 500 -300 500 -1100 500 -300 500 -350 500 -1100 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -1050 500 -350 500 -350 450 -1100 500 -350 450 -350 500 
64800024
Decoded PANASONIC - Address: C4D3 Value: 64800024 (48 bits)
Raw (100): 24444 3050 -1650 500 -1050 500 -1100 500 -300 500 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -1100 450 -350 500 -1100 500 -300 500 -350 500 -1050 500 -1100 500 -350 450 -1100 500 -1050 500 -350 500 -350 500 -1050 500 -350 500 -350 500 -1050 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 500 -300 500 -350 500 -350 450 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -300 500 -1100 500 -350 450 -350 500 -1100 450 -350 500 -350 500

Notice the Raw (100) part. Its no coincidence that the raw data buffer in IRremote.h is set to 100. The rest is overflowing. Up the buffer to about 240 and you will see this.

Raw (228): -20216 3000 -1700 450 -1100 450 -1100 450 -350 450 -400 400 -400 450 -1100 450 -350 450 -400 450 -1100 450 -1050 450 -400 450 -1100 400 -400 450 -350 450 -1150 400 -1100 450 -400 450 -1100 400 -1100 450 -400 450 -350 450 -1100 450 -350 450 -400 450 -1100 400 -400 450 -400 400 -400 450 -350 450 -400 450 -350 450 -400 450 -350 450 -400 400 -400 450 -400 400 -400 450 -350 450 -400 400 -400 450 -400 450 -350 450 -1150 400 -350 450 -400 400 -1150 400 -400 450 -400 400 -1150 400 -1100 450 -400 400 -400 450 -350 450 -400 450 -350 450 -400 450 -350 450 -1150 400 -1100 450 -350 450 -400 400 -400 450 -400 400 -400 450 -1100 450 -350 450 -1100 450 -400 400 -400 450 -350 450 -400 450 -400 400 -400 450 -350 450 -400 450 -350 450 -400 400 -400 450 -350 450 -400 450 -350 450 -400 450 -350 450 -400 400 -400 450 -350 450 -400 450 -400 400 -400 450 -350 450 -400 400 -400 450 -350 450 -400 450 -350 450 -400 450 -350 450 -400 400 -400 450 -400 400 -400 450 -350 450 -400 450 -350 450 -1100 450 -1100 450 -1100 450 -350 450 -400 400 -400 450 -1100 450 -350 450

If you look closely you will see your raw data is exactly the same as mine until your buffer fills. all the data you are looking for is further down the command. I have the files from my oscilloscope if you would like to see the real world data to compare.

UKHeliBob: Using the code that I posted are you saying that pressing the same key twice in succession outputs different Hex codes ? Is there any pattern to this ? ie does the output flip between 2 values ? What output do you get if you hold the key down ?

Yes, if I press the same key I have always different codes, never none not repeated. before I also passed that only code 64800024 less OFF button, but now with the sketch you put different codes always leave me.

techshifter: I think you will find the code is longer. The IR library code you are using assumes a 48 bit code from the C4D3 and drops the rest of the data, if you modify it to 112 bits you will see all the data. It wont convert it to hex as it is storing the entire code in a 16 bit unsigned integer. but it will give you all the timings.

Sorry for my ignorance, I do not wear much in the arduino world, but how it could change the IR library to see these 112bits? a greeting

If you edit IRremote.h on line 112 you can change RAWBUF to 240. However because they bitshift the data in, it will push the beginning of the code out and it will no longer be recognized as a Panasonic code.

I could open the other file (IRremoteInt.h) and this appears a type mitsubishi and what times to crack the code?. the solution might be here? but I have not gotten changed anything, maybe I have not done well. I’ve also changed the rawbuf and still the same.
about in line 119 the IRremoteInt.h show this:
// #define MITSUBISHI_HDR_MARK 250 // seen range 3500
#define MITSUBISHI_HDR_SPACE 4000 // 750+100
#define MITSUBISHI_ONE_MARK 2050 // 41
50-100
#define MITSUBISHI_ZERO_MARK 1050 // 17*50-100
// #define MITSUBISHI_DOUBLE_SPACE_USECS 800 // usually ssee 713 - not using ticks as get number wrapround
// #define MITSUBISHI_RPT_LENGTH 45000

thank you very much @techshifter... i got it . you are right. i make the following changes and hex output changed against each pressed key

#define RAWBUF 240 // Length of raw duration buffer
#define PANASONIC_BITS 112

i don't know why not recognize it as panasonic, I can't change the number of bits this is that show me:

Unknown encoding: F6F5174A (32 bits) Raw (240): 31648 3450 -1650 400 -1300 450 -1250 400 -450 400 -450 400 -450 400 -1350 450 -400 400 -450 400 -1300 450 -1250 400 -450 400 -1300 400 -450 400 -450 400 -1300 400 -1350 350 -500 450 -1250 400 -1300 400 -450 400 -450 400 -1300 400 -450 400 -450 500 -1250 450 -400 400 -450 450 -400 400 -450 500 -400 350 -500 350 -500 450 -400 400 -450 500 -350 400 -450 400 -450 500 -400 350 -500 400 -450 400 -450 400 -450 400 -450 500 -350 500 -400 450 -1250 400 -450 400 -450 400 -450 400 -450 400 -450 400 -1300 400 -1300 500 -400 450 -400 400 -450 400 -450 500 -350 500 -350 500 -350 400 -500 350 -500 400 -450 450 -400 500 -350 400 -1300 400 -1300 400 -450 500 -1250 450 -1250 350 -500 400 -450 400 -450 400 -450 400 -450 400 -450 400 -1300 400 -500 350 -500 350 -1350 450 -400 400 -1300 400 -450 400 -1300 400 -450 400 -1300 450 -1250 500 -350 500 -400 350 -500 400 -450 400 -450 400 -450 400 -450 400 -450 500 -350 400 -450 400 -500 350 -500 350 -500 400 -450 400 -450 400 -450 500 -350 400 -500 350 -500 450 -400 400 -450 450 -400 500 -350 500 -350 400 -450 400 -450 400 -500 450 -400 450 -400 400 -450 500 -350 400

Looks like your IR pulse is longer than 240 also, turn it up a little further until you don't get any more raw data. That IR library wont work with an IR command that long, it is trying to store it in a single 4 byte block and it doesn't fit. The library will either need to be heavily modified or best to just start from scratch with only the codes you need.

Hey,

I'm currently going through the same thing of trying to emulate an AC remote control.

I found these two blog posts which might help:

Reading the codes: http://dduino.blogspot.in/2011/11/improved-ir-code-reciever.html

Sending the codes: http://dduino.blogspot.in/2011/11/use-sonar-to-control-tv.html

I haven't completely tried these - so do let me know if they work!

As some very helpful posters have mentioned earlier, the buffer limit on line 112 of IRremote.h need to be increased too.

Thanks, R

After my long struggle I am still unsuccessful, I got the raw data then make hex code but it did not work. I am posting here my work .Kindly tell me the better way to get the exact code.

#define RAWBUF 255 // Length of raw duration buffer
#include <avr/interrupt.h>
#include <avr/io.h>

#define TIMER_RESET  TCNT1 = 0
#define SAMPLE_SIZE  255

int IRpin = 3;
unsigned int TimerValue[SAMPLE_SIZE];
char direction[SAMPLE_SIZE];
byte change_count;
long time;

void setup() {
  Serial.begin(115200);
  Serial.println("Analyze IR Remote");
  TCCR1A = 0x00;          // COM1A1=0, COM1A0=0 => Disconnect Pin OC1 from Timer/Counter 1 -- PWM11=0,PWM10=0 => PWM Operation disabled
  // ICNC1=0 => Capture Noise Canceler disabled -- ICES1=0 => Input Capture Edge Select (not used) -- CTC1=0 => Clear Timer/Counter 1 on Compare/Match
  // CS12=0 CS11=1 CS10=1 => Set prescaler to clock/64
  TCCR1B = 0x03;          // 16MHz clock with prescaler means TCNT1 increments every 4uS
  // ICIE1=0 => Timer/Counter 1, Input Capture Interrupt Enable -- OCIE1A=0 => Output Compare A Match Interrupt Enable -- OCIE1B=0 => Output Compare B Match Interrupt Enable
  // TOIE1=0 => Timer 1 Overflow Interrupt Enable
  TIMSK1 = 0x00;          
  pinMode(IRpin, INPUT);
}

void loop()
{
  Serial.println("Waiting...");
  change_count = 0;
  while(digitalRead(IRpin) == HIGH) {}                                 
  TIMER_RESET;
  TimerValue[change_count] = TCNT1;
  direction[change_count++] = '0';
  while (change_count < SAMPLE_SIZE) {
    if (direction[change_count-1] == '0') {
      while(digitalRead(IRpin) == LOW) {}
      TimerValue[change_count] = TCNT1;
      direction[change_count++] = '1';
    } else {
      while(digitalRead(IRpin) == HIGH) {}
      TimerValue[change_count] = TCNT1;
      direction[change_count++] = '0';
    }
  }
  Serial.println("Bit stream detected!");
  change_count = 0;
  time = (long) TimerValue[change_count] * 4;
  Serial.print(time);
  Serial.print("\t");
  Serial.println(direction[change_count++]);
  while (change_count < SAMPLE_SIZE) {
    time = (long) TimerValue[change_count] * 4;
    Serial.print(time);
    Serial.print("\t");
    Serial.println(direction[change_count-1]);
    Serial.print(time);
    Serial.print("\t");
    Serial.println(direction[change_count++]);    
  }
  Serial.println("Bit stream end!");
  delay(2000);
}

result

Analyze IR Remote
Waiting...
Bit stream detected!
0	0
3548	0
3548	1
5180	1
5180	0
5684	0
5684	1
6864	1
6864	0
7364	0
7364	1
8548	1
8548	0
9044	0
9044	1
9380	1
9380	0
9888	0
9888	1
10224	1
10224	0
10724	0
10724	1
11060	1
11060	0
11564	0
11564	1
12744	1
12744	0
13248	0
13248	1
13584	1
13584	0
14084	0
14084	1
14420	1
14420	0
14928	0
14928	1

Copy the result and past it in notpad, save it as dat extension file.
Open this file in gnuplot .(explain in uploaded figure named “gnuplot command”). Press enter to see the graph.
Graph shows mark and spaces.
code decoding is explained in the figure"gnuplot explain"
I got the following hex codes against each button
C4D36480000418D06CDE000000000000 (on button)
C4D36480000418206CDE000000000000 (25 temprature)

#include <IRremote.h>

IRsend irsend;


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

void loop() {
  if (Serial.read() != -1) {
    
    irsend.sendMitsubishi(0xC4D36480,0x000418D0,0x6CDE0000,0x00000000);
    delay(3000);
   
  }
}

IRremote.cpp

void IRsend::sendMitsubishi(unsigned long data1,unsigned long data2,unsigned long data3,unsigned long data4)
{
	Serial.write("data: ");
	unsigned long check = 0x80000000;

	enableIROut(38);
	int counter=0;
	unsigned long dataCopy ;
		
	for(int repeat=0; repeat < 1; repeat++)
	{
	        unsigned long D1=data1;
            unsigned long D2=data2;
            unsigned long D3=data3;
            unsigned long D4=data4;
  
    	mark(MITSUBISHI_HDR_MARK);        // SAMSUNG_HDR_MARK   3400
		space(MITSUBISHI_HDR_SPACE);      // SAMSUNG_HDR_SPACE  1550
		Serial.write("Start ");
	
		for (int byte = 0; byte < 4; byte++) 
        {

			for (int i = 0; i < 8; i++) 
            {
				if (D1 & check) 
                {
					mark(MITSUBISHI_BIT_MARK);                     // MITSUBISHI_BIT_MARK  425
					space(MITSUBISHI_ONE_SPACE);                   // MITSUBISHI_ONE_SPACE 1200
					Serial.write("1");
				} 
				else 
                {
					mark(MITSUBISHI_BIT_MARK);                     // MITSUBISHI_BIT_MARK  425
					space(MITSUBISHI_ZERO_SPACE);                  // MITSUBISHI_ZERO_SPACE 380
					Serial.write("0");
				}
				D1 <<= 1;
			}
				
		}
		
		for (int byte = 0; byte < 4; byte++) 
        {
		
			for (int i = 0; i < 8; i++) 
            {
				if (D2 & check) 
                {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ONE_SPACE);
					Serial.write("1");
				} 
				else 
                {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ZERO_SPACE);
					Serial.write("0");
				}
			    D2 <<= 1;
			}
		
		}
		          

		for (int byte = 0; byte < 4; byte++) 
        {

			for (int i = 0; i < 8; i++) 
            {
				if (D3 & check) 
                {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ONE_SPACE);
					Serial.write("1");
				} 
				else 
                {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ZERO_SPACE);
					Serial.write("0");
				}
			    D3 <<= 1;
			}
		}
		
		for (int byte = 0; byte < 4; byte++) 
        {
	      counter++;
	       	for (int i = 0; i < 8; i++) 
            {
				if (D4 & check) {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ONE_SPACE);
					Serial.write("1");
				}
				else {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ZERO_SPACE);
					Serial.write("0");
				}
                D4 <<= 1;
			}
		
				
		}
    
    for (int byte = 0; byte < 4; byte++) 
        {
	      counter++;
	       	for (int i = 0; i < 8; i++) 
            {
				if (D4 & check) {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ONE_SPACE);
					Serial.write("1");
				}
				else {
					mark(MITSUBISHI_BIT_MARK);
					space(MITSUBISHI_ZERO_SPACE);
					Serial.write("0");
				}
                D4 <<= 1;
			}
		
				
		}
	
					
                   
         
		Serial.write(" End ");
		
		Serial.println();
		Serial.println();
    }
	
}

But it did not work. I think still some pulses are missing. Any suggestion would be appreciated
Thanks to all

gnu command.png

Hmm… I got nothing…
Did you try reading out the RAW Data (with the example sketch, IRrecvDump) and sending it as RAW Data to see if that works?!

From http://arduinostuff.blogspot.pt/2011/05/receiving-and-sending-ir-with-arduino.html:
Some devices use their own protocols such as Samsung, but you can get the raw data from them. To clean the raw data you get from the dump -demo, you need to erase the first number, then convert all negative numbers to positive and place commas between the numbers.

Here’s an example:

Raw data: 4802, -620, 500, -420, 600, -440…

Sending:

unsigned int[68] power_ON ={620,500,420,600,440… …};
Irsend.sendRaw(power_ON, 68, 38);

68 is the length of the unsigned integer.

I never used RAW Data before, but i assume it should work with about any IR protocol…
Good Luck!

Regards, Delphiño

diegt: i don't know why not recognize it as panasonic, I can't change the number of bits this is that show me:

Unknown encoding: F6F5174A (32 bits) Raw (240): 31648 3450 -1650 400 -1300 450 -1250 400 -450 400 -450 400 -450 400 -1350 450 -400 400 -450 400 -1300 450 -1250 400 -450 400 -1300 400 -450 400 -450 400 -1300 400 -1350 350 -500 450 -1250 400 -1300 400 -450 400 -450 400 -1300 400 -450 400 -450 500 -1250 450 -400 400 -450 450 -400 400 -450 500 -400 350 -500 350 -500 450 -400 400 -450 500 -350 400 -450 400 -450 500 -400 350 -500 400 -450 400 -450 400 -450 400 -450 500 -350 500 -400 450 -1250 400 -450 400 -450 400 -450 400 -450 400 -450 400 -1300 400 -1300 500 -400 450 -400 400 -450 400 -450 500 -350 500 -350 500 -350 400 -500 350 -500 400 -450 450 -400 500 -350 400 -1300 400 -1300 400 -450 500 -1250 450 -1250 350 -500 400 -450 400 -450 400 -450 400 -450 400 -450 400 -1300 400 -500 350 -500 350 -1350 450 -400 400 -1300 400 -450 400 -1300 400 -450 400 -1300 450 -1250 500 -350 500 -400 350 -500 400 -450 400 -450 400 -450 400 -450 400 -450 500 -350 400 -450 400 -500 350 -500 350 -500 400 -450 400 -450 400 -450 500 -350 400 -500 350 -500 450 -400 400 -450 450 -400 500 -350 500 -350 400 -450 400 -450 400 -500 450 -400 450 -400 400 -450 500 -350 400

It looks like after the header (1600/400) each bit is either 1300/400 or 400/400.

110001001101001101100100100000000000000000000010000011000000000000110110000001001010101100000000000000000000000000000000

I don't see any repeating pattern in that except for long stretches of 0 bits.

Perhaps if you encoded several keys and compared the patterns you would be able to find a key code buried in there.