Hello there. I’ve been really motivated that I’ve flashed my first device (SONOFF mini r4) with ESPHome, so I was really wondering how to flash my air purifier. Currently there are third party integrations with HA, but they all work through 3rd party servers, so I’ve been thinking on the way to avoid this (btw, same reason I’ve flushed SONOFF switch). I’ve opened up the air purifier and figured out that it has esp32 onboard. I’ve solder rx/tx pins and was able to make a flash dump (which appeared to be handy in the future).
esptool.py -p /dev/tty.usbserial-A501AW9D -b 76800 read_flash -fs detect 0 ALL blueair_purifier.bin
esptool.py v4.8.1
Serial port /dev/tty.usbserial-A501AW9D
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: e0:5a:1b:15:2c:f8
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 8MB
Detected flash size: 8MB
8388608 (100 %)
8388608 (100 %)
Read 8388608 bytes at 0x00000000 in 1152.4 seconds (58.2 kbit/s)...
Hard resetting via RTS pin...
Datasheet I found here: https://www.espressif.com/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf
By spending couple hours with multimeter I’ve figured out almost everything:
Having minimal information, I’ve decided to give it a shot, by flashing through https://web.esphome.io and clicking prepare for the first use (same way I did with sonoff mini r4). Firmware flash was successful, but then it shows “an error occurred. improv wi-fi serial not detected”. Same error when I try to update wifi config. Logs are empty.
Going back and forth, I’ve decided to recover everything to the factory defaults:
esptool.py -p /dev/tty.usbserial-A501AW9D -b 76800 write_flash 0x0 ./blueair_purifier.bin ✔ esp32 11:07:19 PM
esptool.py v4.8.1
Serial port /dev/tty.usbserial-A501AW9D
Connecting.....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: e0:5a:1b:15:2c:f8
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
A fatal error occurred: WARNING: Detected flash encryption enabled and download manual encrypt disabled.
Flashing plaintext binary may brick your device! Use --force to override the warning.
And here is first clue for the problem: there is some kind of encryption on chip. Thankfully force writing fixed the device and it is working again!
esptool.py -p /dev/tty.usbserial-A501AW9D -b 76800 write_flash --force 0x0 ./blueair_purifier.bin
esptool.py v4.8.1
Serial port /dev/tty.usbserial-A501AW9D
Connecting...
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting...
Detecting chip type... ESP32
Chip is ESP32-D0WD-V3 (revision v3.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: e0:5a:1b:15:2c:f8
Stub is already running. No upload is necessary.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x007fffff...
Compressed 8388608 bytes to 5347158...
Wrote 8388608 bytes (5347158 compressed) at 0x00000000 in 711.2 seconds (effective 94.4 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
So my questions are:
- What is the encryption and why I can’t install basic ESPHome firmware?
- What are -G signals on connection between power board and esp32 board? They are going to SENSOR_VP and SENSOR_VN and can only behave as an input.
- What are the EN signals? How do I know if I should read them or send them?
- How do I connect fan using FAN and FG signals? Is the second one kind of feedback?