Trying to control Mitsubishi Heat Pump Air Conditioning Unit

:slight_smile: SUCCESS :slight_smile:

OK I have found what the problem was - not hardware just software.

I had been looking at the values that I receive and thought that generally they look like multiples of 400 but they are not all multiples of 400. Some values are 1550, 1150, 350 etc.

unsigned int powerOn[] = {
3200,1550,400,400,400,1200,400,350,400,400,400,1200,400,400,400,1150,400,400,400,400,400,1200,350,1200,400,1200,400,400,400,1150,
400,400,400,1200,400,1150,400,1200,400,400,400,400,350,400,400,400,400,1200,400,1150,400,400,400,1200,400,1200,350,400,400,400,
400,1200,400,400,400,350,400,1200,400,400,400,400,400,1150,400,1200,400,400,400,1150,400,1200,400,400,400,1150,400,1200,400,1200,
400,400,350,1200,400,400,400,1200,400,1150,400,400,400,400,400,400,400,1150,400,400,400,1200,400,400,350,1200,400,1200,400,1200,
350,1200,400,400,400,1200,350,1200,400,1200,400,400,400,350,400,400,400,400,400,1200,400,400,350,400,400,400,400,1200,400,1150,
400,400,400,1200,400,1200,350,400,400,400,400,1200,400,400,350,400,400,1200,400,400,400,400,400,1150,400,1200,400,400,400};

So I modified the code in irremote.cpp and modified the interrupt code added a funtion

so in the interrupt function I added

irparams.rawbuf[irparams.rawlen++] = fixTimer(irparams.timer);

case STATE_MARK: // timing MARK
if (irdata == SPACE) { // MARK ended, record time
irparams.rawbuf[irparams.rawlen++] = fixTimer(irparams.timer);
irparams.timer = 0;
irparams.rcvstate = STATE_SPACE;
}
break;
case STATE_SPACE: // timing SPACE
if (irdata == MARK) { // SPACE just ended, record it
irparams.rawbuf[irparams.rawlen++] = fixTimer(irparams.timer);
irparams.timer = 0;
irparams.rcvstate = STATE_MARK;
}
else { // SPACE
if (irparams.timer > GAP_TICKS) {
// big SPACE, indicates gap between codes
// Mark current code as ready for processing
// Switch to STOP
// Don't reset timer; keep counting space width
irparams.rcvstate = STATE_STOP;
}
}
break;

In the fixTimer function I just hard coded some values.

Since the code was using the value t * 50ms so my code really just enforces a return value of 1600,1200,400 or something > 1600 (not sure I need this)

unsigned int fixTimer(unsigned int t)
{
if (t < 20)
return 8;
else if (t < 31)
return 24;
else if (t < 33)
return 32;
else
return t;

}

Now I have two IR Raw arrays that I can use.

unsigned int powerOn[] = { // 65214,
3200,1600,400,400,400,1200,400,400,400,400,400,1200,400,400,400,1200,400,400,400,400,
400,1200,400,1200,400,1200,400,400,400,1200,400,400,400,1200,400,1200,400,1200,400,400,
400,400,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,1200,400,1200,400,400,400,1200,
400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,400,
400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,1200,400,1200,400,1200,
400,1200,400,1200,400,1200,400,1200,400,1200,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,1200,400,1200,400,1200,
400,400,400,1200,400,400,400,400,400,1200,400,400,400,400,400,400,400,1200,400};

unsigned int powerOff[] = { // 32284,
3200,1600,400,400,400,1200,400,400,400,400,400,1200,400,400,400,1200,400,400,400,400,
400,1200,400,1200,400,1200,400,400,400,1200,400,400,400,1200,400,1200,400,1200,400,400,
400,400,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,1200,400,1200,400,400,400,1200,
400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,400,400,
400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,1200,400,1200,400,1200,
400,1200,400,1200,400,1200,400,1200,400,1200,400,400,400,400,400,400,400,400,400,400,
400,400,400,400,400,400,400,400,400,1200,400,1200,400,1200,400,1200,400,1200,400,1200,
400,400,400,1200,400,400,400,400,400,400,400,400,400,400,400,400,400,1200,400};

So it looked like the Mitsubishi Heat Pump was quite particular about exactly what it saw.

So in this case it is also not Power On / Power Off - the heat pump sets all parameters at once.

So my powerOn actually sets it to Power On with the Mode set to Cooling, the temperature set to 25c, Auto fan mode, and no airflow controls set.

My powerOff actually sets it to Power Off with the Mode set to Cooling, the temperature set to 25c, Auto fan mode, and no airflow controls set.

I have spent hours and hours on this. But thanks for your help and I hope this saves some times for somone else!

chris