Wednesday, 10 March 2021

Home Assistant control of Mitsubishi MCFZ-A24 WV A/C - Part 1

I was looking for things to automate with Home Assistant and the air conditioning in the conservatory should have been an easy win. The A/C is around 15 years old but has the "CN105" connector which on many models allows for bi-directional communication. I built a cable and compiled mitsubishi2MQTT. Unfortunately I didn't get any response from the A/C so I guess it either requires a different protocol or just doesn't support serial control.

My next plan was to use infrared as that's how the standard remote operates. Air conditioning IR remotes work a bit differently to remotes used for TVs and set top boxes. Instead of sending individual commands, they send the complete state the A/C should be in (mode, fan speed, temperature etc) on every keypress. To control the A/C this means generating the IR codes along with a CRC instead of a simple look-up table.

Luckily this functionality is all built into Tasmota. I built myself a breadboard IR circuit that could be driven by an ESP8266. I tried all the different IR protocols supported by Tasmota but got no response. Having never built an IR sender before I had no idea if the problem was the circuit or the protocol. Therefore the first task was the prove the circuit so I found some Panasonic codes and was able to control my TV. The range was poor but easily improved by changing the resistor and therefore increasing the brightness of the IR LED. I now had a working IR so the next step was to capture and analyse the signal sent by the Mitsubishi remote to see if I could reproduce it.

I found an IR receiver from a scrap digital TV box and connected that to a Raspberry Pi. I used this guide for inspiration as the IR decoding tools in Raspbian weren't able to read the codes. Capturing button presses from the remote and then decoding the result gave me codes like these: 

1100010011010011011001001000000000000000001001000001000011100000010110000000000000000000000000000000000001000110 (on)

1100010011010011011001001000000000000000000001000001000011100000010110000000000000000000000000000000000001111010 (off)

Each code was a consistent 112 bits long and I could see how different remote settings were changing bits in the code. I figured out how to send raw codes with the Tasmota IRSend console command and I was rewarded with a "beep" from the A/C. Progress!

At this point I was confused why the MITSUBISHI112 protocol in Tasmota didn't work as it seemed very similar. Looking at the source code I found Tasmota uses the IRremoteESP8266 library. I eventually figured out the MITSUBISHI112 protocol assumes the A/C vanes have both horizontal and vertical controls. On the MCFZ A/C only vertical vane controls are available and if the horizontal vane bits are set to anything other than 0000 then the command is ignored. I modified the code to add kMitsubishi112SwingHOff, compiled a new firmware binary and finally had IR control working.

With a working prototype I could now build a PCB, add a temperature sensing and integrate with Home Assistant.

No comments:

Post a Comment

Heltec v3 and Wireless Tracker poor Bluetooth

The Heltec LoRa32 v3 and Wireless Tracker both seem to suffer from a limited Bluetooth range. In my experience unless you are in the same r...