The Problem
So this is my first time attempting to flash an ESP32 and I’m struggling to get it to flash with a connected MH-Z19B.
I’m at the part where I’ve saved my YAML file, and I’m clicking “Install”, but I run into errors that I cannot seem to get past no matter what I try.
When I try to flash it with the sensor connected to the ESP32, I get the following error:
...
INFO Successfully compiled program.
esptool.py v4.6.2
Serial port /dev/ttyUSB1
Connecting......................................
ERROR Running command failed: Failed to connect to ESP32: Download mode successfully detected, but getting no sync reply: The serial TX path seems to be down.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
ERROR Please try running esptool.py --before default_reset --after hard_reset --baud 460800 --port /dev/ttyUSB1 --chip esp32 write_flash -z --flash_size detect 0x10000 /data/build/co2-sensor/.pioenvs/co2-sensor/firmware.bin 0x1000 /data/build/co2-sensor/.pioenvs/co2-sensor/bootloader.bin 0x8000 /data/build/co2-sensor/.pioenvs/co2-sensor/partitions.bin 0xe000 /data/cache/platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin locally.
INFO Upload with baud rate 460800 failed. Trying again with baud rate 115200.
esptool.py v4.6.2
Serial port /dev/ttyUSB1
Connecting......................................
ERROR Running command failed: Failed to connect to ESP32: Download mode successfully detected, but getting no sync reply: The serial TX path seems to be down.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
ERROR Please try running esptool.py --before default_reset --after hard_reset --baud 115200 --port /dev/ttyUSB1 --chip esp32 write_flash -z --flash_size detect 0x10000 /data/build/co2-sensor/.pioenvs/co2-sensor/firmware.bin 0x1000 /data/build/co2-sensor/.pioenvs/co2-sensor/bootloader.bin 0x8000 /data/build/co2-sensor/.pioenvs/co2-sensor/partitions.bin 0xe000 /data/cache/platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin locally.
The troubleshooting page mentions:
This implies a problem with the TX line running from the host to the ESP device. Double-check your board or breadboard circuit for any problems.
Which I have tried to look into, and I cannot see anything wrong. I have the correct pins connected, and I’ve tried numerous (4 pinned) micro-USB cables to rule out a cable issue.
Additional Information
My YAML config is:
esphome:
name: co2-sensor
friendly_name: CO2 Sensor
esp32:
board: esp32dev
framework:
type: arduino
uart:
rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 9600
sensor:
- platform: mhz19
co2:
name: "MH-Z19 CO2 Value"
temperature:
name: "MH-Z19 Temperature"
update_interval: 60s
automatic_baseline_calibration: false
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "***"
ota:
password: "***"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
Pin Connections
MH-Z19B GND ↔ ESP32 GND
MH-Z19B Vin ↔ ESP32 V5
MH-Z19B TX ↔ ESP32 RX0
MH-Z19B RX ↔ ESP32 TX0
(I have also tried swapping TX/RX as I read in the ESPHome docs that these are flipped regularly)
Parts
This is the exact ESP32 I ordered: https://www.aliexpress.com/item/1005005970816555.html?spm=a2g0o.order_list.order_list_main.16.b3ea1802AiEKEo
This is the exact MH-Z19B I ordered: https://www.aliexpress.com/item/4000212024923.html?spm=a2g0o.order_list.order_list_main.22.b3ea1802AiEKEo
These are the exact jumper wires I’m using: https://www.aliexpress.com/item/4000203371860.html?spm=a2g0o.order_list.order_list_main.28.b3ea1802AiEKEo
Thank you in advance for any help