Fujitsu AC (heat pump) integration via ESPHome [ESP32]

Hello !!

I´m checking my circuit and my program but don´t work. To check y only want turn-on my unit. This is my little code. It´s correct?

#include <Arduino.h>

#include “FujiHeatPump.h”

FujiHeatPump hp;

void setup() {

hp.connect(&Serial2, true); // use Serial2, and bind as a secondary controller

delay(1000);

if(hp.waitForFrame()) { // attempt to read state from bus and place a reply frame in the buffer

delay(60);     

}

hp.setOnOff(true);

hp.setMode(static_cast<byte>(FujiMode::COOL));

hp.setFanMode(4);

hp.setTemp(18);  

}

void loop() {

}

Hi everyone, again, thanks for the appreciation!
I did not forget to share with you the link with the Gerber files, rather I took advantage of this week that I spent in bed due to a minor surgery to be able to design a second version of the “Fuji Atom Interface”.
Specifically, the intent was to bring all the components to one side and to use SMT technology exclusively so that I could have all the circuitry protected between the Atom and the PCB and consequently be able to facilitate the placement of the whole thing everywhere without worrying too much about pins popping up randomly (as happens in the first version I showed you).
In addition, I preferred to implement a small modification on Unreality’s schematic, preferring to power the Atom with 5V instead of 3.3V to fit perfectly within the manufacturer’s specifications.
I managed to find a very good and ridiculously small DC/DC converter from TI that allowed me not to have to buy the converter separately and then solder it in that odd position that overlaps the converter chip.

Now I am really pleased with the shape this little project has taken, even if I cannot use it for myself.

Here the link to the GitHub repository: FUJI ATOM INTERFACE





1 Like

So, after a month of running without issues, the device started showing as unavailable on Home Assistant (although still online on ESPHome).

I suspected faulty soldering, and after testing continuity, I found that the LIN pin was wobbly, so I resoldered everything, but this was to no avail.

It seems to be stuck in an infinite reboot loop, so I can’t obtain logs wirelessly (and it’s powered by a buck converter, so I’m afraid serial port debugging produce backfeeding - don’t want to risk damaging the heat pump unit).

Any idea on how to obtain logs for the device in this scenario?

Thanks!

Edit:
Trying to obtain logs wirelessly yields the following:

INFO Reading configuration /config/esphome/ac-thermostat.yaml...
INFO Starting log output from ac-thermostat.local using esphome API
WARNING Can't connect to ESPHome API for ac-thermostat.local: Error connecting to ('192.168.1.134', 6053): [Errno 111] Connect call failed ('192.168.1.134', 6053)
INFO Trying to reconnect to ac-thermostat.local in the background

Ok, figured it out. Due to having poorly documented the design (that I posted previously in this thread), I have made a pretty big mistake when re-soldering into a PCB: I had connected RX on the MCP2025 to TX on the ESP32 and viceversa.

After fixing it, I’m able to see logs again, and Home Assistant is able to connect to the device, but it’s unable to change the operation mode or set temperature (I can see in the logs that it receives the message from the API, but it reverts on the UI after a few seconds).

What are the odds I fried either the Arduino or the MCP2025?

PS: Adding a note to the previously posted design so that nobody makes the same mistake.

Edit: This is the error why I’m suspecting I fried something:

[16:41:15][V][component:199]: Component api took a long time for an operation (0.20 s).
[16:41:15][V][component:200]: Components should block for at most 20-30ms.

Fixed!

After the reversed TX/RX mishap, I had indeed fried the ESP32 serial 2 (and possibly the MCP2025, but not willing to fry another serial port to test it :wink: ).

I’ve swapped the MCP2025 for a new one (thank you arrow.com for the fast turnaround!), and used serial 1 in a different pair of ports (GPIO 3 and 1) modifying the line 34 if FujitsuClimate.cpp, as follows:

    this->heatPump.connect(&Serial1, true, 3, 1);

I hope it helps others in this predicament!

I have built the board but i am having problems with the esp32

It is bootlooping and showing this in the logs:

[I][logger:258]: Log initialized
[C][ota:469]: There have been 1 suspected unsuccessful boot attempts.
[D][esp32.preferences:113]: Saving 1 preferences to flash...
[D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()...
[D][fuji:028]: Fuji initialized
[D][fuji:035]: starting task
[D][fuji:010]: reached task
[D][fuji:011]: serialTask started on core 1
E (10263) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (10263) task_wdt:  - loopTask (CPU 1)
E (10263) task_wdt: Tasks currently running:
E (10263) task_wdt: CPU 0: IDLE0
E (10263) task_wdt: CPU 1: FujiTask
E (10263) task_wdt: Aborting.
abort() was called at PC 0x401553d4 on core 0
ELF file SHA256: 0000000000000000
Backtrace: 0x4008882c:0x3ffbf820 0x40088aa9:0x3ffbf840 0x401553d4:0x3ffbf860 0x40086f69:0x3ffbf880 0x4016c9bf:0x3ffbc160 0x40156cdf:0x3ffbc180 0x4008b269:0x3ffbc1a0 0x40089aba:0x3ffbc1c0
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8

I have tried the single core version as well but while it boots normally it doesn’t control the ac

The module i have is this one

Anyone occasionally seen this error on the controller?

Will eventually clear itself.

No I don’t see this.

Which version of ESPHome do you use?
Which version of my code do you use? (single or multi cores?)
Which hardware do you use?

is this showing with your Fuji controller connected?

I dont have a controller, I want to use it as the master. Also I cant access the logs while the esp is connected to my ac because it bootloops and doesnt work over wifi. I can only access it via usb serial

I have not run the controller in master mode before.
You need to change some code if you want to make it a master.

This line needs to be:
this->heatPump.connect(&Serial2, false);

I have already done that.

I’m curious are this will work with Atlantic heat pumps? They are brand which uses Fujitsu General pumps.

Hi there.
First all many thanks @rabbit-aaron for this great work !
I had build my device and try to control my AC pump (in my case a old General duct split with a remote controller AR-3TA1 with 3 wires so similar to others that posted are working fine) and once fully assure the hardware are propperly tested and working I’m unable to make it work over ESP32 with ESPHome compiling from GitHub - rabbit-aaron/esphome-fujitsu downloaded source code.
I tested two ESP boards but stuck in boot loop with same error when trying to boot and finally boot in safe mode:
This is error are raised compiling with ESPHome version 2022.8.3:

I see in this treath @spokosjr had same error, but I not see if he solved his problem.

I tested single-core FujitsuHeatPump files and then it boot fine but with they cannot control the AC unit and remains “waiting frames” forever seems without success to sync over the LIN bus.

Really appreciate if anyone can help to sort out that issue.
Thank you.

1 Like

First of all, thank you @rabbit-aaron for this great integration! Good thing I had another look around for a cheap solution before buying those expensive Intesis modules!
As many of you, just stumbled upon your project and now I can’t wait to get my hands on the electronic components to try it. :rofl:

@xploss: thanks for the tip on the arrow.com website. However, I also live in Europe and can’t get past the VAT ID field when trying to complete an order. How did you manage to do it?

Cheers

Hi.
I reply to myself some findings about this issue.

I have reviewed the possible cause of the problem that causes the ESP to restart when trying to start the vtask and it seems that in ESPHome they may have changed something in the core that prevents the task from executing with a priority higher than 1 and that causes wdt error.
Changing the vtask definition with priority to 1: “xTaskCreatePinnedToCore(serialTask, “FujiTask”,* *10000, (void *)this, 1, &(this->taskHandle), 1);” , I can run without no more wdt crashes.

Issue is now that still cannot control the AC pump. My main controller no show any error and the ESP is not updating values on the ESPHome climate and if I change some value the AC pump and the controller seems not reacting at all.

I enable print debug with #define DEBUG_FUJI (on “FujiHeatPump.cpp” file) I can see incoming frames (mSrc: mDst: mType: write: login: unknown: onOff: temp: mode: cP: uM: cTemp: acError:) changing quick to the ESP32 mainly with login 1 and 0 and values reflecting good the current system status and because that I think LIN bus seems are readed good from the ESP32 and I see that values on this frames are reflecting what is configured on my main controller and any change on the primary controller are propperly reflected on the frames received and printed, but this values are not udated on the ESPHome climate and if I try to change anything on the ESPHome climate control I can see the message ESPHome are triying change them, but no reaction from AC pump or main controller about this new value.

At this moment I want using this ESPHome module with local mode (AP mode, not connected to Home Assistant) with only the autogenerated ESPHome webpage with the climate control.
This is my yaml:

esphome:
  name: fujitsu
  platform: ESP32
  board: esp32doit-devkit-v1
  includes:
    - FujitsuClimate.h
    - FujitsuClimate.cpp
    - FujiHeatPump.h
    - FujiHeatPump.cpp

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ""
  reboot_timeout: 0s

web_server:
  port: 80
  local: true

ota:
  password: ""

wifi:
  #ssid: "SSIDXX"
  #password: "PASSWXXXXXXXXXXXXXX"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Fujitsu"
    password: "12345678"

So still struggling to figure what are now the issue because hardware (ESP32, LIN transceiver, etc…) seems fime but still unable to make it working propperly.

Any help will be really appreciate.

1 Like

Good news on this new brand year.

I simply update all the information I have in case this can help someone in the future who suffers the same problems or doubts

I finally managed to get the module working.
In addition to the bootloop problem mentioned by the uart vtask statement, the problem is that my AC system had the main thermostat set to only one primary thermostat.
Changing the switch (in my case 1) in dual controller mode (primary+secondary) everything started to work. Bellow a pic. to configure my controller from Fujitsu Intallation doc:
Fuji_Contr_Master-Slave Switch

Now all seems fine and ESPHome module are working (in my case in stand alone AP Mode without connection to mqtt or HA).

I have only noticed that in some moments the change orders are not “applied” and it seems that they are not received by the primary controller and/or the indoor unit does not recognize them and it is necessary to repeat (sometimes several times) the order until the system accepts the change.

Best wishes and hope all the best to all people in this new year.

2 Likes

Hello, I have the same problem as @spokosjr, I have reviewed what @jirm comments but I still have the same problems. I have not yet connected the esp32 with the MCP2025 to the air conditioning unit (I don’t know if that could be the problem). @jirm, I don’t have the same definition of vtask that you mention, could you copy and paste the code as you modified it? Has anyone else had the problem and found a solution? I would appreciate if someone help me to solve the problem. Thanks in advance.

Hi @revecas, I modified in the library file “FujitsuClimate.cpp” in the setup function the
xTaskCreatePinnedToCore() statament changing only the priority parameter to 1, bellow I copy all the statement and you can see the value I changed:

void FujitsuClimate::setup() {
    ESP_LOGD("fuji", "Fuji initialized");
    this->lock = xSemaphoreCreateBinary();
    xSemaphoreGive(this->lock);
    this->pendingUpdate = false;
    memcpy(&(this->sharedState), this->heatPump.getCurrentState(), sizeof(FujiFrame));
    this->heatPump.connect(&Serial2, true);
	hpisBound = this->heatPump.isBound(); //bound to main controller status. initialize forcing first update
    ESP_LOGD("fuji", "starting task");
    xTaskCreatePinnedToCore(serialTask, "FujiTask", 10000, (void *)this,
                            1, &(this->taskHandle), 1);

Then I upload this modified file to my ESPHome folder and build the device.
I belive you can build and flash the ESPHome device and boot the ESP32 without error even though LIN transceiver (MCP2025) are not attached to it and only try the ESP32board, but I don´t understand what you want achieve with this and I don’t think either will be a good “test” because the device cannot initialize propperly the UART and receive/transmit anything from it.

If I can help to anything more don’t dubt to post here, and I try do my best.

Hope you can solve the issue.

Regards.

1 Like

Thaks @jirm