Close
0%
0%

Let me control you: Hitachi air conditioner

An attempt to wirelessly control an old Hitachi air conditioner

Similar projects worth following
My attempt to wirelessly control that old Hitachi air conditioner in my living room.
Not a classic one way communication system but one with feedback so I can detect any change done via the IR remote control but also know the unit status at any time.
The ultimate goal is to build a custom Zigbee controller for it so I can add it to my future home automation system.

I recently moved from the North of Tokyo to a new apartment situated 40km south but just 25min by train from my workplace. Bathroom and toilet separated, big kitchen, a proper living/dining room and an overall size of twice what I used to have.

There is 2 air conditioners to cool/warm up all that space:

  • one in the bedroom, quite recent and powerfull
  • one in the living/dining room, fairly old and just powerful enough

In my previous apartment, I had only one air conditioner that I controled with the dedicated remote control but also with my phone thanks to a WIFI enable IR remote control and Android app I made.

It was my first project since I moved to Japan 9 years ago and took me 7 months to complete.

Arduino, ESP8266, FUSION360, MIT App Inventor, ThingSpeak... I learnt a lot and was able to brush up my skill in C/C++ a little bit.

Only downside of this solution was that I couldn't know if the air conditioner properly received the command sent and once I used the normal remote control my system would be completely desynchronized.

For this reason, this time I want to implement a kinda of feedback so I dont' have to worry about my system being synchronized or not. I don't plan to make another IR remote or repurpose the one I built before but rather investigate to see if there is a way to talk directly with the mainboard of the air conditioner.

Moreover, I'm also digging in home automation and I plan to install a rather simple system based on Home Assistant and Xiaomi temperature sensor (Zigbee type).

The ultimate goal here is to be able to control both air conditioners directly via Home Assistant so I don't have to fear a really cold room when coming home in the winter neither to deal with an overwhelming hot apartment in the middle of summer.

CC2530ZNP-with-SBL (Z-Stack 3.0.2).hex

Z-Stack 3.0.2 ZNP with booloader firmware for CC2530 (power sleep disabled, alternative pinout option activated)

hex - 680.76 kB - 08/02/2020 at 06:53

Download

CC2530ZNP-with-SBL (Z-Stack 3.0.2).bin

Same Z-Stack 3.0.2 ZNP with bootloader firmware for CC2530 but in bin format (to be used when flashing using a LOLIN Wemos D1 mini and CC loader library)

octet-stream - 256.00 kB - 08/02/2020 at 06:53

Download

Controller _ ON _ cool _ 27 _ high.sr

Data exchanged when turning on the air conditioner with the RAC adapter and central satation connected

sr - 1.85 kB - 06/14/2020 at 03:23

Download

Analysis result (2020_06_14).xlsx

Compilation of commands that can be send via RS-232 to the air conditioner

sheet - 14.82 kB - 06/14/2020 at 03:11

Download

No controller_OFF.sr

Data exchanged between the air conditioner and RAC adapter when no central station is connected and the air conditioner is OFF.

sr - 2.19 kB - 06/13/2020 at 01:43

Download

View all 7 files

  • It's... it's working... for real!

    Floriana day ago 0 comments

    I spent my Golden Week holidays looking in depth in this GUI tool and after a week of trial and error I managed to send but also receive data from Home Assistant.

    How do you ask?

    1. first, in Home Assistant I switched from deCONZ to Zigbee2MQTT plus Mosquitto broker.
    2. using the GUI tool, I created a custom firware with OUTPUT1 set to P0.2 and to UART with a baudrate of 9600 and 0x0D as an end packet.
    3. I then flashed my ZIgbee module with that custom firware.
    4. in Home Assistant, from Zigbee2MQTT dashboard I allowed devices detection by clicking "Permit join (all)".
    5. I then connected my Zigbee module to my FTDI USB to TTL Serial Adapter, powered it up and opened Termite on my computer.
    6. After about 20 seconds, a new device appeared in Zigbee2MQTT dashboard. I renamed it "Proto" and added it to Home Assistant.
    7. Then, I went to Configuration > Integrations > Mosquitto broker > Configure and in "Publish a packet" I wrote the payload "test" to the topic zigbee2mqtt/Proto/set/action.
    8. Like magic, the text "test" appeared in my Termite window.
    9. I returned to Home Assistant and this time, in "Listen to a topic" I entered zigbee2mqtt/Proto/action and clicked "START LISTENING".
    10. Back to my Termite window I typed "test again" and... again like magic, the same text appeared in Home Assistant.

    Following this small success, I read here and there about how air conditioners are normaly controled via Home Assistant and it's all about a "climate entity" and the "thermostat" card in Lovelace.

    Hopefully, there is a way to create such a climate entity when using MQTT: MQTT HVAC
    Perfect! This week I'm gonna look for more examples on how to create such an entity and try to make on. 

    Now that I managed to transmit data to Home Assistant, the overall connection diagram should look something like that:

  • Could that be the solution?!

    Florian05/03/2021 at 02:38 0 comments

    Today I had a closer look to these sites that introduce DIY Zigbee devices and noticed something right away: the author uses the same Zigbee module as I am (E18-MS1-PCB from Ebyte).
    In the past I've tried to look for projects or information with this CC2530 based module but didn't find much but I thought it could worth another try since someone is actively building Zigbee devices with it.

    As usual I used my best friend Google. With the keyword "E18-MS1-PCB" I went right away to "Images" and just after a few scroll down this caught my attention:

    I mean... the image title speaks for itself, right? With really high hope I clicked that image and jumped to Z1 Mini Development Board lets you build custom ZigBee end devices. After reading the article, there was unfortunately nothing new on the horizon. To be sure, I had a look to the linked Wiki page and there I saw this:

    Great firwares? For the CC2530 chip... For a second I thought these firmwares could be the ones of those DIY Zigbee devices I mentionned earlier. Or maybe ready to flash firmwares to use a CC2530 as a ZNP device?

    Well it turned out to be far BETTER than that: A GUI tool for creating your own alternative Zigbee device with a flexible configuration of inputs and outputs.

    This sounds so promising and it might be the solution I was looking for to easily make a Zigbee device to enable connectivity of my air conditioner with Home Automation. Gonna spend this Golden Week holidays digging into that.

  • Long time no see ... (/ω\)

    Florian05/01/2021 at 02:22 0 comments

    A bit more than a year since my last project log entry... shame on me. COVID-19 pandemic got me stuck in an unpleasant and depressfull work - eat - sleep repeat cycle. My procrastination reached it's highest of all time level and even completing or starting a new DIY project didn't seem to motivate me enough.

    But I decided to put things in order and deal with my procrastination: completing this project while taking care of myself (personal training gym? skin care? improve my wardrobe?). Once this project is done, I will move to automate the other air conditioner I have and finally the small heater I bought last winter for my bathroom. From then I'm thinking to hack and improve the video intercom (bigger screen, adding a recording function, adding an auto-response function in case nobody is home, ultimately link it to HA?) but that's a story for another time.

    Okey now let's talk about what's new since ... well since last year: last time I successfully flashed a cheap CC2530 based module with Z-Stack 3.0.2 but not knowing a thing about Zigbee I didn't know what to do next. So I went on a frenetic search of information, hoping I would be able to gather enough material from articles/forum messages/videos or whatever to understand how to properly communicate with a Zigbee router and implement that in a structure I could program.

    Unfortunately the result was frugal:

    With that arduino program along with TI and NXP documents, I thought I could understand what should be done, in which order and manner but it turned to be far more difficult that I imagined and I gave up (at least for me it was too time consuming and fruitless). 

    So I turned my attention to public available litterature and bought the following book:

    which turned out to be a waste of time and money as it isn't a practical development handbook as stated in the front cover but rather a book that explains in depth Zigbee standard, its functionality and its radio signal implementation.

  • Successful flashing of Z-Stack 3.0.2

    Florian08/02/2020 at 06:34 0 comments

    I received my CC debugger (a cheap knockoff bought on AliExpress) and tried right away to flash my CC2530 module: success!

    Just for reference, I used this documentation on how to flash using TI SmartRFR software and for the firmware itself, I built one based on Z-Stack 3.0.2 following this tutorial I mentionned before (you can download the hex file from the Files section: CC2530ZNP-with-SBL (Z-Stack 3.0.2).hex).

    To check if my flashing was successful or not, I used TI Z-Tool software (don't forget to check "Scan all Enabled com ports (startup and manual scan)" in Tools > Settings > Serial Devices > Auto Scan). 

    Also, while I was waiting for my CC Debugger to be delivered, I looked around on the Internet for possible reasons why my previous attempts at flashing the CC2530 module failed. I didn't find anything relevant so I decided to check carefully my components and found out the solder joint of D5 on my Wemos D1 mini was cracked... A quick rework and I successfully flashed my firmware using CC loader library (for those interested, I also uploaded the bin file in the Files section).

  • Zigbee, my future nemesis?

    Florian07/19/2020 at 06:09 0 comments

    Now that I have demystified the communication protocol of this Hitachi air conditioner, it's time to work on what is gonna be the most difficult and time consuming part of this project for me: building a Zigbee interface to enable remote control from Home Assistant.

    For the past month I've been gathering information, learning basics about Zigbee, looking for hardware solutions and trying to have a Zigbee module working. Here is a kind of summary of what I've got so far.

    1) I learnt there is 3 different types of devices in a Zigbee network: router, coordinator and end device. Because I want to go for a simple solution I will make an "end device".

    2) Searching for DIY Zigbee on Google got me to look at XBee module and CC2530 based module.

    3) Because I judged XBee modules to be quite big, I digged in this SoC made my Texas Instrument and found that CC2530 based modules can either be directly programmed (Intel 8051) and used stand-alone or flashed with a specific firmware to be used as a so-called "ZigBee Network Processor (ZNP)" with an external MCU (like controlling an ESP8266 with an Arduino via AT commands). My 8051 programming skills being really rusty and not being interested in learning the SDK and the tooling from TI, I decided to go for the ZNP solution.

    4) I searched for a CC2530 based module on AliExpress and found a cheap and tiny transmitter/receiver module. Link to the actual product: https://www.aliexpress.com/item/32803052003.html?spm=a2g0s.9042311.0.0.40bc4c4dzhaeel

    5) I received the modules in about 2 weeks. I made a simple breakout board for one and tried to flash Z-Stack 3.0.2 following this excellent tutorial. Because I don't have a CC debugger, I used an alternative flashing method using an Wemos D1 and CClib (source: Zigbee CCLib Flashing). After a bit more than 2 hours, the flashing was successful but the module UART didn't seem to work. I checked that P2_0 (CFG1) was tied to GND and I carefully followed the CC2530-ZNP power-up procedure described in Z-Stack ZNP Interface Specification but I never got the SYS_RESET_IND from the module.

    6) I tried to reflash the module using another programming method which used CCLoader (tutorial: flashing CCLoader) but despite a successful flashing it didn't work either.

    7) After trying to flash multiple firmwares (router, coordinator, stock) I found on forums and GitHub using both programming methods I also tried to flash the other module I bought but never managed to have the UART working.

    8) I bought a CC debugger from China hoping it's just a problem with the flashing method... Until I receive it, I will search for more information about end device firmware, Zigbee communication work-flow and Home Assistant integration.

  • Well... that was fairly easy

    Florian06/14/2020 at 03:10 1 comment

    Yesterday I hooked up the "central station" and recorded a bunch of data. I tried as many settings as I could and worked on identifying how commands are sent to the air conditioner and how status are retrivied from the air conditioner.

    And after just 2 hours of opening PulseView files, extracting data and compiling everything in Excel here is the result.

    • status inquiry

          - RAC adapter message: MT P="address" C="checksum"[CR]

          - air conditioner response: OK P="value" C="checksum"[CR]

    • value setting

          - RAC adapter message: ST P="address","value" C="checksum"[CR]

          - air conditioner response: OK[CR]

    And that's all it is! The checksum calculation is quite straight forward so I won't explain it.
    For a list of available addresses and possible values, you can check the file "Analysis result (2020_06_14).xlsx".

    As a confirmation, I connected my FTDI USB to TTL serial adapter directly to the air conditioner, grounded the H-LINK pin and sent a few commands to the air conditioner: everything worked fine.

    So the next step will be to learn about Zigbee communication system and see how I can implement a wireless remote functionnality in Home Assistant.

  • Some basic analysis

    Florian06/13/2020 at 01:30 0 comments

    Before I realized it already a month has passed since my last log so here is a little update.

    Because my old and trusty laptop is undergoing a huge transformation to become a dedicated compact desktop computer for my hobby, all I had on hand to use with my cheap logic analyzer is my useless  Nexus 7 tablet. Since there is an Android version of PulseView available I decided to give it a go. After 2 long weeks of flashing various ROM and trying all the USB cables I had I couln'd manage to have PulseView detect my logic analyzer... Until I realized all my USB cables were not OTG type and that I had an extension USB cable laying around long enough to connect my logic analyzer in the living room to my computer in the next room. 

    It strikes me how stupid I can be sometimes.

    After this miserable failure, I hooked up everything and captured what was going on between the air conditioner and the RAC adapter with no controller connected and adjusting the settings via the remote control.

    Results are:
     - the RAC adapter sends the same message composed of 9 packets, each packet starting with "MT" and ending with 0D (hex). The time between each packet is about 48ms and the same message is sent every 4376ms. The packet structure is "MT P=xxxx C=yyyy[0D]".
     - the air conditioner responds to each packet sent after roughtly 12ms. Each response packet starts with "OK" and ends with the same 0D (hex). The packet structure is "OK P=xxxx C=yyyy[0D]" or "OK P=xx C=yyyy[0D]".

    You can check the files "Analysis (2020_06_06).xlsx" and "No controller_OFF.sr" for more details.

  • It's alive... It's alive, IT'S ALIVE!

    Florian05/07/2020 at 07:55 0 comments

    Now that I have all I need, I first decided to connect everything and see if it worked or not. Because my next move is to analyze what's going on between the RAC adapter and my air conditioner, I made a simple breakout board for easy debugging.

    And here is my full setup, ready for a test:

    After setting up the DIP switches according to the manual, performing a factory reset of the central station and waiting 10 long minutes for that station to finally boot up here is the result.

  • Finally, it's here!

    Florian05/06/2020 at 05:18 0 comments

    After a few months of patience, I managed to buy the only RAC adapter that was for sale on Ebay. Thanks to a slightly favorable exchange rate and a seller who finally accepted my offer, I obtained it for less than 12000 yens (shipping fee included).

    And while I was waiting to receive it, I looked for H-LINK compatible wired remote controls. But after a little bit of digging, I found that the RAC adapter can only be connected to what's Hitachi calls "central station" as shown in this products connectivity table:

    (the "ワンタッチコントローラー (PSC-A16RS1)" only allows to turn the air conditioner ON and OFF)

    Looking for those model numbers on Google, I discovered that even the simple PSC-5S central station retails for 70000 yens and is a built-to-order product. The cheapest touch-screen type of central station retails for 135000yens... Nevertheless I checked on Yahoo Auctions and Ebay for a possible second-hand central station but only found one PSC-A64S (seems to be the English version of PSC-A64S1) for roughtly 11000 yens excluding delivery costs.

    With some more digging, I learnt with this PDF that products starting with "PSC-" are only compatible with themselves. Kinda makes a lot of sense but with this new information I looked for PSC products on Mercari (the Japanese equivalent of Leboncoin/Craiglist/Gumtree) and found two PSC-A64GT2 for sales for less than 4000 yens each. Could that be the older version of PSC-A64GT3!? A quick search and I confirmed that indeed it was! Right away I made a 3500 yens offer to the seller and finally here I am: a RAC adapter and a central remote.

  • No much luck...

    Florian02/07/2020 at 13:01 0 comments

    Since my last update, I tried to find sites or specialized shops where I could buy a RAC adapter but failed miserably. I then turned my attention to second hand websites like Ebay or Yahoo auction but also  classified ads sites and I've been checking them everyday for the last month.

    There is one brand new RAC adapter on sale on Ebay France for something like 110 euros but doesn't seem possible to have it send to Japan...

    I reached to people around me last week and a former work acquaintance put me in contact with someone working in a small company that provides LED lighting fixtures and air conditioner systems to corporates. The quotation he provided me was pretty expensive: about 25000 yens.

    I will try to contact that French guy on Ebay, also try to reach to Hitachi directly and see from there.

View all 15 project logs

Enjoy this project?

Share

Discussions

Florian wrote 05/01/2021 at 01:32 point

Thanks for your comment.

First... so sorry for this late reply. 

Following your question I did a few tests and here is the result: even if pin 6 isn't tied to GND, the air conditioner will respond to MT commands. However, it would not respond to any ST commands.

  Are you sure? yes | no

Caleb Bramwell wrote 10/12/2020 at 20:23 point

Fascinating read, great work! Did you find you needed to control the H-Link pin6 line in the end?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates