Hacking a Mitsubishi Heat Pump / Air Conditioner
Quite a few years back I decided that I wanted to hack my heat pump. The infrared remote control was boring, who wants to press buttons. I thought about automatically generating the infrared remote button protocol like a few others have done before but that still doesn't tell me what the heat pump is doing. Did it actually turn on after you sent those commands? I thought I could do better, so I decided to pull apart my newly installed heat pump unit and start poking around in there with a meter to see what happened.
Surprisingly, I remembered to take a couple of photos this time Here's the unit after pulling off the cover and poking around to find where all the wires were going. Try not to die if you do this with the power on - there's 240V in there.
Here I've pulled out the control board. Tiny little thing isn't it! You'll see one of the wiring looms connected here, this is what we need to connect to communicate with the unit from the outside world - thoughtfully of them they made us a serial port to talk to, it's 5V TTL UART running at 2400 bps and even parity. A little weird, I discovered that with a Saleae Logic Analyser - a very handy little hacking tool. The connector is called CN105 on the Mitsubishi board.
After I had manually poked about and figured out the CN105 pin output and discovered it was a UART, I found this picture of the pinout of the Mitsubishi CN105 connector! Would have been nice to have earlier! Posted here in case you're building your own cable. The original cable I built was actually a JST PH connector that I carved and sanded to fit in the existing PCB end - figuring out what type of connector was on the board was one of the most annoying parts of the whole thing! I've since discovered (after extensive searching!) that it's a JST PA series and I do have a few cable pigtails here so if you want one drop me a line.
At this stage I'm putting the control board assembly back into the heat pump and connecting it back up to all the factory wiring looms. Once of those is the internal temperature sensor with I did some testing on sensor as part of trying to decode the communications protocol - I think I'll go into the protocol in a separate post to keep this from getting too long.
Once I got the air conditioning unit back together it was time to implement the hack in a reusable manner. I decided to base my modification on a Raspberry Pi. I could have gone with something smaller such as an Arduino, or an ESP8266 board but I decided to go with the Pi as it would give the ability to relatively easily build a completely stand alone controller for people who don't have an existing home automation controller to interface with.
Above is the simple Raspberry Pi break out board mounted on a Raspberry Pi. The couple I have running (one in the office and one at home) are both running on a Raspberry Pi 2 as this was all done before the release of the Pi 3 with built in WiFi. It should work on the Pi 3 okay but I've not tested it as yet and there is a change in the Pi UART due to the on board Bluetooth. I guess it should still be able to handle 2400 bps okay but if you test it out let me know!
This is just the bottom of the prototype board with some hook up wiring and a 12V to 5V converter from Pololu to power the Pi. The heat pump has a 12V output on the CN105 connector so there's no external power needed for the Raspberry Pi. There's also a 5V supply on the connector but I wasn't sure how much I could draw from that so I decided it was safer to use the 12V rail.
Here's the final prototype that's running in my office. The wiring isn't the tidiest but that's probably inconsequential when you look at the rest of the office most of the time! I won't include a photo of that.
This is the console output from the program which bridges the Mitsubishi Air Conditioner / Heat Pump to an MQTT broker. The code is up on Github here, there's not a lot of documentation but you should be able to get something working from it.
This is a simple control interface in HTML using MQTT over websockets, we use this in house as part of a larger system. I haven't had a chance to extract this bit of code yet.
Update, as usual I forgot to mention a bunch of things : This is true bi-directional communication with the heat pump, meaning that you can send it commands and get back a response on whether they succeeded. The heat pump will also send unsolicited updates when things change such as using the IR remote. This means that the network interface will always be in sync with what the air conditioner unit is actually doing, no guesswork.
There's a bunch of documentation to do on this project which I've currently run out of time for - though I do hope to be able to pick it up again soon. The next post I hope to do is on decoding the serial line communication protocol. If you've got any questions let me know in the comments.