Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi Smart Air Purifier 4 Lite - Wiki update #13

Open
smogger opened this issue Mar 10, 2024 · 11 comments
Open

Xiaomi Smart Air Purifier 4 Lite - Wiki update #13

smogger opened this issue Mar 10, 2024 · 11 comments

Comments

@smogger
Copy link

smogger commented Mar 10, 2024

Any chance to get a bit more details about the Xiaomi Smart Air Purifier 4 Lite steps?

I am trying to get my heads around with the "power on the board" step.

I tried either power on the whole unit (3 beeps from the purifier and not connecting to my UART) - since nowhere mentioned HOW should we power on the board.
And also tried directly connecting the 3V from my UART to the ESP32 chip leg (still not connecting somehow for me)

The board layout is slightly different then the previous version, so those guides doesn't really help me with the 4 Lite.

(PS: strange to me that whenever I plug the TX/RX to my UART, the power led lights up on it)

Thank you

@helgek
Copy link

helgek commented Mar 14, 2024

I flashed directly on the chip using Sensepeek PCBite while the device wasn't connected to power. Instead I used the 3.3V coming from the UART device. I had tried the test pins before as outlined in the guide but when it didn't work immediately I didn't want to invest more time to figure out this variant, instead I went straight on the esp32 pins. I've already flashed about seven devices like this (mostly yeelight lamps and one other xiaomi light).

image

@dhewg
Copy link
Owner

dhewg commented Mar 15, 2024

Does reading from uart work when the device is running the vendor fw? You should see it logging. That needs to work first, and only then can you attempt to flash a new fw.

In my case, I just powered the whole board with its standard power supply. Powering only the esp would be safer, but not as easy. Powering the esp via your uart ttl adapter might not work, depending on how reliable the power output is (you might get lucky, but assume it's not sufficient).

And is that really another revision of the rmb1 or the newer rma2 version (#14)?

@smogger
Copy link
Author

smogger commented Mar 15, 2024

In my case, I just powered the whole board with its standard power supply.

How were you been able to power on the board? In my case when I disassembled I had to unplug the display or the sensor from the board (i dont remember now) otherwise I had not enough space/long cable to remove it from the outer shell to have access to the testpoints. And without the sensor I cannot power on the board as it just beeps 3-4 times and thats it.

@smogger
Copy link
Author

smogger commented Mar 15, 2024

Does reading from uart work when the device is running the vendor fw? You should see it logging. That needs to work first, and only then can you attempt to flash a new fw.

Esphome (HA) does such thing? Honestly never tried to read out this way. I programmed blank esps only.

@dhewg
Copy link
Owner

dhewg commented Mar 15, 2024

How were you been able to power on the board? In my case when I disassembled I had to unplug the display or the sensor from the board

Same here, I detached various connectors to get to the board, but reattached them once I disassembled the device. So the wires temporarily had different paths, but the device as a whole was fully functioning.

Esphome (HA) does such thing?

Either firmware will log over uart, but in this case I meant the original vendor firmware. It's just to confirm that uart is working. Because if it's not there's no way you can flash another firmware over uart (duh ;)

@smogger
Copy link
Author

smogger commented Mar 20, 2024

Worked like a charm. Thanks

Some info to others:
You do need to short the filter detector, otherwise it refuse to boot at all and cant flash the ESP (the display part doesn't needs to be plugged)
The first boot seems to me a bit slow or something I mean the Wifi connection, so be patient. I had to plug everything together (including the Display) in order to connect for me to my WiFi AP.

I still don't know how to backup the original FW from ESPHome, it simply instantly installed the default code on to it. Then edited it with the code provided here, re-flashed, and happy.

@helgek
Copy link

helgek commented Mar 20, 2024

To back up:
esptool.py --baud 115200 --port /dev/cu.usbserial-110 read_flash 0x00000 0x400000 fwbackup_xyz.bin

To compile:
esptool.py compile airpurifier.yaml

To flash:
esptool.py --baud 115200 --port /dev/cu.usbserial-110 write_flash --flash_size detect 0x00000 firmware-factory.bin

With automatic port detection this might also work instead:
esphome run airpurifier.yaml

@smogger
Copy link
Author

smogger commented Apr 30, 2024

In some cases, one of my purifier lose Wifi connection.

I added the following line to the code, but it seem doesnt really reset the ESP upon disconnect.

"wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
reboot_timeout: 15min
"

Am I missing something??

@w-marco
Copy link

w-marco commented Jul 24, 2024

@helgek do you happen to have the backup firmware file for the purifier? I lost mine and want to archive it.

@helgek
Copy link

helgek commented Jul 26, 2024

fwbackup_air_purifier_4_lite.bin.zip

@w-marco
This is the backup file. You probably are aware that there are two versions of this device: zhimi.airp.rmb1 and zhimi.airp.rma2

The backup file is for the zhimi.airp.rmb1 version. I assume you have the same device variant since you probably wouldn't have been able to flash the device with a working config otherwise. I think for the zhimi.airp.rma2 there isn't a working ESPHome based configuration available yet. But it's been a while since I flashed this device so I don't remember the details anymore at the moment.

@w-marco
Copy link

w-marco commented Jul 26, 2024

Thanks, yes I have rmb1, so it's the one I need!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants