Mitsubishi IR AC remote decoding Problem

@delphino-999 … I tried to send raw data.

#include <IRremote.h>

IRsend irsend;
unsigned int arrayON[]={3500,1650,500,1200,500,1200,450,350,500,350,500,350,450,1250,450,350,500,350,500,1200,450,1200,500,350,500,1200,450,350,500,350,500,1200,450,1200,500,350,500,1200,450,1200,500,350,500,350,450,1200,500,350,500,350,500,1200,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,1200,500,350,500,350,500,350,450,400,450,350,500,1200,450,1250,450,350,500,350,500,350,450,400,450,1200,500,350,450,1250,450,350,500,350,500,350,450,400,450,350,500,1200,500,1200,450,350,500,1200,450,1250,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,1200,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350,500,350,450,400,450,350,500,350};

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

void loop() {
  if (Serial.read() != -1) {
    
    irsend.sendRaw(arrayON,255,38);
 
    delay(2000);
  }
}

result; I have send the same raw that i received.

Raw (255): -9670 3550 -1650 500 -1150 550 -1150 500 -350 500 -350 500 -300 500 -1200 500 -350 500 -350 500 -1150 500 -1200 500 -300 550 -1150 500 -350 500 -350 500 -1150 500 -1200 500 -350 500 -1150 500 -1200 500 -350 500 -300 500 -1200 500 -350 500 -300 550 -1150 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 550 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -1200 500 -350 500 -300 550 -300 500 -350 500 -350 500 -1150 500 -1200 500 -350 500 -350 500 -300 500 -350 500 -1200 500 -1150 500 -1200 500 -350 500 -300 500 -350 500 -350 500 -350 500 -1150 500 -1200 500 -350 500 -1150 500 -1200 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -1200 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 550 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -300

But not working yet. Some thing hidden in this raw.

@johnwasser. Your are right. Some key code is missing here. I think gnuplot or oscilloscope is the best option to get hidden key. I have upload gnugraph figure.that was exacly same as raw. I think gnugraph becomes fail here to find the hidden key. We have to adopt some different way to get it.

@ arslankhan and diegt

It’s seems me that you guys facing the world most difficult coding scheme. Japanese Association for Electric Home Appliances has produced a standard for IR control “Japanese code”.

and simple IRremote library haven’t capability of extracting the whole logic behind the scene.

Jap IR format.jpg

@Cybernetician.. Thanks. It seems exacly the same codding scheme. Would you like to share the discription of that scheme.

arslankhan:
@Cybernetician… Thanks. It seems exacly the same codding scheme. Would you like to share the discription of that scheme.

Ok, Why not.

PFA, In attachment lots of detail available about different coding schemes. And by modification(reverse engineering) in your code, I hope you will find the solution.

Edit: http://read.pudn.com/downloads157/sourcecode/embed/701593/docs/IR%20Formats%202.PDF

IR Formats 1.pdf (154 KB)

IR Formats 2.pdf (421 KB)

Hi All

I have been also working with Mitsubishi heat pump and my article here may help you all.

http://wiki.crowe.co.nz/Mitsubishi%20Heat%20Pump.ashx

If you are using Ken Sherrifs library you need to increase the buffer size since the Mitsubishi (well my one) sends 180 bits of data which needs 180 bytes of data to store it.

But hopefully the article will help.

I have a c# application that can read a signal - decode it and then rebuild it.

I need to continue my article and maybe able to do this over the coming weekend but hopefully it helps someone here.

Chris

@iisfaq thanks , after applying fixTimer(unsigned int t) following is the output Raw.

#define RAWBUF 255 // Length of raw duration buffer

result

Raw (255): 26026 3550 -1650 400 -1200 400 -1200 400 -400 400 -400 400 -400 400 -1200 400 -400 400 -400 400 -1200 400 -1200 400 -400 400 -1200 400 -400 400 -400 400 -1200 400 -1200 400 -400 400 -1200 400 -1200 400 -400 400 -400 400 -1200 400 -400 400 -400 400 -1200 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -1200 400 -400 400 -400 400 -400 400 -400 400 -400 400 -1200 400 -1200 400 -400 400 -400 400 -400 400 -400 400 -400 400 -1200 400 -1200 400 -400 400 -400 400 -400 400 -400 400 -400 400 -1200 400 -1200 400 -400 400 -1200 400 -1200 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -1200 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400 400 -400

I send this raw but it is also not working.

#include <IRremote.h>

IRsend irsend;
unsigned int arrayON[]={3550,1600,400,1200,400,1200,400,400,400,400,400,400,400,1200,400,400,400,400,400,1200,400,1200,400,400,400,1200,400,400,400,400,400,1200,400,1200,400,400,400,1200,400,1200,400,400,400,400,400,1200,400,400,400,400,400,1200,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,1200,400,1200,400,400,400,400,400,400,400,400,400,400,400,1200,400,1200,400,400,400,400,400,400,400,400,400,400,400,1200,400,1200,400,400,400,1200,400,1200,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,1200,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400};

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

void loop() {
  if (Serial.read() != -1) {
    
   irsend.sendRaw(arrayON,255,38);
    
    delay(2000);
  }
}

Kindly help me out …

Does your IR LED work with other devices? Some people connect a 100 mA IR LED directly to an Arduino pin and find they get very little range because the Arduino pin can’t drive a 100 mA load.

johnwasser: Does your IR LED work with other devices? Some people connect a 100 mA IR LED directly to an Arduino pin and find they get very little range because the Arduino pin can't drive a 100 mA load.

IRLED works with other devices . I have tried to use for Samsung. It works fine. So there is no issue with IRLED.

@ arslankhan and diegt

On last weekend i was blackout due to office workload, thats why i start capturing of IR code of my friend Mitsubishi RC and got the same result by putting the value of rawbuf equal to 255

#define RAWBUF 255

When rawbuf equal to 400

#define RAWBUF 400

or greater than 255 i got the garbage result of IR sample. This is the starting point of story “There is some problem with RAWBUFF value”. Ok, First step write/stole some code to capture the IR pulses by using interrupt.

And by viewing the code it is clear i need the modification in two lines

/*
  IR Capture
  Copyright 2012, all rights reserved.
  James M. Eli
  1/14/2012
 
  project parts:
    (1) arduino 16MHz
    (1) 38KHz IR receiver
    (1) breadboard
    (3) wires
 
  IR - Arduino
  SIG - D2
  GND - GND
  VCC - VCC
*/

//definitions
#define IN_PIN 2
#define MAX_CAPTURE 584  // Line number 1
 
//globals
uint32_t now, start, capture[MAX_CAPTURE];
volatile bool flag_complete;
uint16_t i;    // Line number 2 uint8_t to uint16_t Key point of RAWBUF. uint8_t maximum range 255
 
//interrupt fires on ir event (rise/fall)
void IRInterrupt(void) {
  now = micros();
  capture[i++] = now - start;
  start = now;
  if (i >= MAX_CAPTURE) {
    detachInterrupt(0);
    flag_complete = true;
  }
}
 
void setup(void) {
  flag_complete = false;
  start = 0;
  now = 0;
  i = 0;
  Serial.begin(9600);
  attachInterrupt(0, IRInterrupt, CHANGE);
  Serial.println("Ready to capture.");
}
 
void loop(void) {
  while (1) {
    if (flag_complete) {
      for (i=0; i < MAX_CAPTURE; i++) {        
        Serial.println(capture[i]);
        //Serial.print(",");
        flag_complete = false;
      }
    }
  }
}

uint16_t i; // Line number 2 uint8_t to uint16_t Key point of RAWBUF. uint8_t maximum range 255

#define MAX_CAPTURE 584 // Line number 1, Value selected after hit and trial base experiments.

Hurray 8) here is the full IR sample values = 584 samples

3548,1640,492,1188,492,1192,492,348,492,344,492,348,492,1192,492,348,492,344,492,1192,492,1192,492,344,492,1192,492,348,492,348,492,1188,492,1192,492,348,492,1188,492,1192,492,348,488,348,492,1192,492,348,492,348,492,1188,492,348,492,348,492,348,488,348,492,348,492,348,492,348,492,348,488,348,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,1192,492,348,492,344,496,344,492,348,492,348,492,1188,492,1192,492,348,492,348,492,348,488,1192,492,1192,492,1188,492,1192,492,348,492,344,492,348,492,348,492,348,492,1188,492,1192,492,348,492,1188,492,1192,492,348,492,344,496,344,492,348,492,348,492,348,492,348,492,344,492,1192,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,1188,492,348,492,348,492,1192,492,348,492,1188,492,1192,492,12916,3544,1640,492,1188,492,1192,492,348,492,348,492,344,496,1188,492,348,492,348,492,1188,492,1192,492,348,492,1188,492,348,492,348,492,1188,492,1192,492,348,492,1188,492,1192,492,348,492,344,496,1188,492,348,492,348,492,1188,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,344,496,1188,492,348,492,348,492,344,496,344,492,348,492,1192,492,1188,492,348,492,348,492,348,492,1188,492,1192,492,1188,492,1192,492,348,492,348,492,344,492,348,492,348,492,1192,488,1192,492,348,492,1192,488,1192,492,348,492,348,492,344,496,344,496,344,492,348,492,348,492,348,492,1188,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,492,348,492,344,496,344,492,348,492,348,492,348,492,348,492,344,492,348,492,348,492,348,496,344,492,344,492,348,492,1192,492,348,492,344,492,1192,492,348,492,1188,492,1192,492,

what is happening in IR code expalned in attached excel file.

Second step finding the issue of IR remote library.

typedef struct {
  uint8_t recvpin;           // pin for IR data from detector
  uint8_t rcvstate;          // state machine
  uint8_t blinkflag;         // TRUE to enable blinking of pin 13 on IR processing
  unsigned int timer;     // state timer, counts 50uS ticks.
  unsigned int rawbuf[RAWBUF]; // raw data
  uint8_t rawlen;         // counter of entries in rawbuf
} 
irparams_t;

Here it is

uint8_t rawlen; maximum range 255

Solution:

typedef struct {
  uint8_t recvpin;           // pin for IR data from detector
  uint8_t rcvstate;          // state machine
  uint8_t blinkflag;         // TRUE to enable blinking of pin 13 on IR processing
  unsigned int timer;     // state timer, counts 50uS ticks.
  unsigned int rawbuf[RAWBUF]; // raw data
  uint16_t rawlen;         // counter of entries in rawbuf
} 
irparams_t;

And hurray 292 samples

4718 3550 -1600 500 -1200 500 -1150 500 -350 550 -300 500 -350 500 -1150 500 -350 500 -350 500 -1200 450 -1200 500 -350 500 -1150 500 -350 550 -300 500 -1200 450 -1200 500 -350 500 -1200 450 -1200 500 -350 500 -350 500 -1150 500 -350 500 -350 500 -1150 500 -350 550 -300 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -1150 500 -350 500 -350 500 -350 450 -350 500 -350 500 -1200 500 -1150 500 -350 500 -350 500 -350 450 -1200 550 -1150 500 -1150 500 -1200 500 -350 500 -350 500 -300 500 -350 500 -350 500 -1200 450 -1200 500 -350 500 -1150 500 -1200 500 -350 500 -350 500 -1150 500 -1200 500 -350 500 -300 500 -350 500 -350 500 -1150 500 -350 550 -300 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -350 500 -1150 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 500 -300 500 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -350 450 -350 500 -350 500 -350 500 -1150 500 -350 500 -1200 500 -350 500 -1150 500 -1200 500 -1150 500 -1200 500

why 292 not 584?
reason is, same IR code sent twice with space of 12ms b/w them.

Now it is clear and it will take 10 min to write the code of sendMit of both of you.

Goodluck.

Edit: If you get the raw code after the above modification and send it in raw it will work.

Mitsubhsi IR Code.xlsx (21.5 KB)

Thanks @Cybernetician…You did absolutely right. Actually this is a matter of uint8_t rawlen and uint16_t i. At last I got my result. Mitsubishi AC working fine with my IR sending code.
IR Remote library code for sending .
changes in IR RemoteInt.h

#define MITSUBISHI_HDR_MARK	3400  
#define MITSUBISHI_HDR_SPACE  1550 
#define MITSUBISHI_BIT_MARK	425 
#define MITSUBISHI_ZERO_MARK  524 
#define MITSUBISHI_ONE_SPACE 1150 
#define MITSUBISHI_ZERO_SPACE 380

changes in IRremote.cpp

void IRsend::sendMitsubishi(unsigned long data1,unsigned long data2,unsigned long data3,unsigned long data4,unsigned long data5)
{
  Serial.write("data: ");
  unsigned long check = 0x80000000;
  enableIROut(38);
  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;
    unsigned long D5=data5;


    Serial.write("Start ");
    mark(MITSUBISHI_HDR_MARK);        // SAMSUNG_HDR_MARK   3400

    space(MITSUBISHI_HDR_SPACE);      // SAMSUNG_HDR_SPACE  1550	

    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++) 
    {

      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++) 
    {
      for (int i = 0; i < 4; i++) 
      {
        if (D5 & check) {
          mark(MITSUBISHI_BIT_MARK);
          space(MITSUBISHI_ONE_SPACE);
          Serial.write("1");
        }
        else {
          mark(MITSUBISHI_BIT_MARK);
          space(MITSUBISHI_ZERO_SPACE);

          Serial.write("0");
        }
        D5 <<= 1;
      }

    }

    mark(MITSUBISHI_BIT_MARK);
    space(12000);
    Serial.write(" End ");

    Serial.println();
    Serial.println();
  }

}

MItsubishi IR Remote sending

#include <IRremote.h>

IRsend irsend;

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

void loop() {
  if (Serial.read() != -1) {
for(int i=0;i<2;i++)
{
    irsend.sendMitsubishi(0xC4D36480,0x0024C0F0,0x00000000,0x0CDE0000);
}
    delay(2000);
  }
}

disappeared after a while I come back here. I have a problem when trying to load the sketch with the modified libraries, I get the following error and i don´t know why "expected primary-expression before ';' token" thanks a lot

Which sketch are you referring to ? Which line is the error reported to be in ?

diegt: disappeared after a while I come back here. I have a problem when trying to load the sketch with the modified libraries, I get the following error and i don´t know why "expected primary-expression before ';' token" thanks a lot

UKHeliBob said: Which line is the error reported to be in ?

Me to...

sorry, I have not posted the entire message.
after modifying IRmote.cpp as arslankhan friend says. I get the following error: IRremote.cpp: In member function ‘long int IRrecv :: decodeMitsubishi (decode_results *)’:
IRremote.cpp: 819: error: expected primary-expression before ‘,’ token.

the line is:

/ / Success
results-> bits = (offset - 1) / 2;
if (results-> bits <MITSUBISHI_BITS) {
results-> bits = 0;
return ERR;
}
results-> value = data;
** results-> decode_type = MITSUBISHI;**
return DECODED;
}

arslankhan , can you post the receiveing code too??

I’m strugling to get the right data.

The raw code works perfectly but I need to use the same method you’re using

diegt:
sorry, I have not posted the entire message.
after modifying IRmote.cpp as arslankhan friend says. I get the following error: IRremote.cpp: In member function ‘long int IRrecv :: decodeMitsubishi (decode_results *)’:
IRremote.cpp: 819: error: expected primary-expression before ‘,’ token.

the line is:

/ / Success
results-> bits = (offset - 1) / 2;
if (results-> bits <MITSUBISHI_BITS) {
results-> bits = 0;
return ERR;
}
results-> value = data;
** results-> decode_type = MITSUBISHI;**
return DECODED;
}

if your want to decode the IR Remote then follwoing is the skech for Decoding

#define IN_PIN 2
#define MAX_CAPTURE 584

//globals
uint32_t now, start, capture[MAX_CAPTURE];
volatile bool flag_complete;
uint16_t i;
int first,second,diff,total;
int counter=0;
int bits=0;
unsigned long data=0;
unsigned long data1=0;
unsigned long data2=0;
unsigned long data3=0;
unsigned long data4=0;
unsigned long data5=0;

//interrupt fires on ir event (rise/fall)
void IRInterrupt(void) {
  now = micros();
  capture[i++] = now - start;
  start = now;
  if (i >= MAX_CAPTURE) {
    detachInterrupt(0);
    flag_complete = true;
  }
}

void setup(void) {
  flag_complete = false;
  start = 0;
  now = 0;
  i = 0;
  Serial.begin(9600);
  attachInterrupt(0, IRInterrupt, CHANGE);
  Serial.println("Ready to capture.");
}

void loop(void) {
  while (1) {
    if (flag_complete) {
      for (i=0; i < MAX_CAPTURE; i++) {   
        counter++;  
        first=capture[i];
        second=capture[i+1];

        if(first>12900 && first<13700){
          break;
        }
  if(counter<2)
  {

          total=first+second;

          if(total<900 && total>700)
          {
            data <<= 1;
          }
          if(total>1600 && total<1800)
          {
            data = (data << 1) | 1;  
          }
          bits++;
  }
  else
  {
          counter=0;
  }
        if(bits==34)
        {
          data1=data;
        }
        else if(bits==66)
        {
          data2=data;
        }
        else if(bits==98)
        {
          data3=data;
        }
        else if(bits==130)
        {
          data5=data;
        }
        else if(bits==146)
        {
          data5=data;
          Serial.print(data1,HEX);
          Serial.print("000");
          Serial.print(data2,HEX);
          Serial.print(data3,HEX);
          Serial.print(data4,HEX);
          Serial.print("0000");
          Serial.println(data5,HEX);
        }

        flag_complete = false;
      }
    }
  }
}

juliopaveif: arslankhan , can you post the receiveing code too??

I'm strugling to get the right data.

The raw code works perfectly but I need to use the same method you're using

following the received code of temp 30 C4D364800024C0F0000000000CDE

Hi you all, i'd like to turn on my Mitsubishi kirigamine air conditioner. the codes i receive are recognized as Panasonic. ON: 64800004 Decoded PANASONIC - Address: C4D3 Value: 64800004 (48 bits) Raw (100): -21006 3500 -1650 450 -1250 500 -1200 500 -350 500 -350 500 -400 500 -1200 450 -400 500 -350 500 -1200 500 -1200 500 -400 500 -1200 500 -350 500 -350 500 -1200 500 -1250 450 -400 500 -1200 500 -1200 500 -350 500 -350 550 -1200 500 -350 500 -350 500 -1200 500 -350 500 -350 500 -400 500 -350 500 -350 500 -350 500 -350 500 -350 550 -350 450 -400 500 -350 500 -350 500 -400 450 -400 450 -400 500 -350 500 -350 500 -350 500 -400 500 -350 500 -1200 500 -350 500 -350 500

OFF: Decoded PANASONIC - Address: C4D3 Value: 64800000 (48 bits) Raw (100): -38 3450 -1650 500 -1200 500 -1200 500 -350 550 -350 450 -400 450 -1250 500 -350 500 -350 500 -1200 550 -1200 500 -350 500 -1200 500 -350 500 -400 500 -1200 500 -1200 500 -350 550 -1150 550 -1150 500 -400 450 -400 500 -1200 500 -350 500 -350 500 -1250 450 -400 500 -350 500 -350 500 -350 500 -400 450 -400 450 -400 500 -350 500 -350 500 -400 450 -400 500 -350 500 -350 500 -350 500 -400 450 -400 500 -350 500 -350 500 -350 500 -400 500 -350 500 -350 500 -350 500

this is the same problem of arslankhan.

so i tried to change buf to 240 and to follow your advices modifying the libraries but it doesn't work. Could you publish the modified libraries and help me to solve the problem?

tnx a lot

Francesco

i saw that you declared the function with 5 arguments:

 void IRsend::sendMitsubishi(unsigned long data1,unsigned long data2,unsigned long data3,unsigned long data4,unsigned long data5)

but in your arduino sketch you use only 4…so i modified 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);
    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;
        //unsigned long D5=data5;
        
        
        Serial.write("Start ");
        mark(MITSUBISHI_HDR_MARK);        // SAMSUNG_HDR_MARK   3400
        
        space(MITSUBISHI_HDR_SPACE);      // SAMSUNG_HDR_SPACE  1550
        
        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++)
        {
            
            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++)
        {
            for (int i = 0; i < 4; i++) 
            {
                if (D5 & check) {
                    mark(MITSUBISHI_BIT_MARK);
                    space(MITSUBISHI_ONE_SPACE);
                    Serial.write("1");
                }
                else {
                    mark(MITSUBISHI_BIT_MARK);
                    space(MITSUBISHI_ZERO_SPACE);
                    
                    Serial.write("0");
                }
                D5 <<= 1;
            }
            
        }*/COMMENTED
        
        mark(MITSUBISHI_BIT_MARK);
        space(12000);
        Serial.write(" End ");
        
        Serial.println();
        Serial.println();
    }
    
}

Therefore the prototype in IRremote.h…
i used your decode sketch but it doesn’t work…

help me please…