01-13-2024, 10:57 PM
ESP32 IoT Board Issue with ESPHome Firmware Installation
Overview
I am experiencing issues with my new kc868-e16s board after installing custom esphome firmware. The board was expected to connect to a LAN via DHCP and control several relays, but it is currently not functioning as expected.
Environment
Issue Description
After successfully uploading the firmware:
Prior Status
The board previously had the default firmware and was able to obtain a DHCP lease. However, the relays did not function through the web UI.
Steps Taken
Supporting Information
ESPHome YAML Configuration File
dmesg Output Showing Successful USB Connection and Device Port
dmesg Output Showing Successful USB Removal After Firmware Upload
ESPHome YAML Validation Success
Successful Upload of Firmware to Board
Overview
I am experiencing issues with my new kc868-e16s board after installing custom esphome firmware. The board was expected to connect to a LAN via DHCP and control several relays, but it is currently not functioning as expected.
Environment
- Board: kc868-e16s
- Firmware: ESPHome
- Operating System: Fedora (Linux)
- Connection: USB to laptop
Issue Description
After successfully uploading the firmware:
- The Ethernet port does not establish a link and fails to obtain a DHCP lease.
- The physical buttons do not trigger the corresponding relays.
Prior Status
The board previously had the default firmware and was able to obtain a DHCP lease. However, the relays did not function through the web UI.
Steps Taken
- Created and validated ESPHome YAML configuration.
- Uploaded the firmware to the board.
- Observed no Ethernet link and non-functioning relays.
Supporting Information
- YAML Configuration: Provided below.
- dmesg Output: Shows successful USB connection and removal post-firmware upload.
- ESPHome Validation: Confirms successful configuration validation.
- ESPHome Upload: Indicates successful firmware upload.
- Board Power Supply: 24v DC.
ESPHome YAML Configuration File
Code:
esphome:
name: kc868-e16s
platform: ESP32
board: esp32dev
i2c:
sda: 16
scl: 15
scan: true
id: bus_a
pcf8574:
- id: 'pcf8574_hub_out_1' # for output channel 1-8
address: 0x21
- id: 'pcf8574_hub_out_2' # for output channel 9-16
address: 0x25
- id: 'pcf8574_hub_in_1' # for input channel 1-8
address: 0x22
- id: 'pcf8574_hub_in_2' # for input channel 9-16
address: 0x24
# Ethernet configuration with DHCP
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
# Individual outputs
switch:
- platform: gpio
name: "Sol-Ark Grid Input Mercury Contactors"
id: sol_ark_grid_input_mercury_contactor
pin:
pcf8574: pcf8574_hub_out_1
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "Electric Water Heater 1 - Top Element"
id: electric_water_heater_1_top_element
pin:
pcf8574: pcf8574_hub_out_1
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "Electric Water Heater 2 - Top Element"
id: electric_water_heater_2_top_element
pin:
pcf8574: pcf8574_hub_out_1
number: 2
mode: OUTPUT
inverted: true
- platform: gpio
name: "Electric Water Heater 1 - Bottom Element"
id: electric_water_heater_1_bottom_element
pin:
pcf8574: pcf8574_hub_out_1
number: 3
mode: OUTPUT
inverted: true
- platform: gpio
name: "Electric Water Heater 2 - Bottom Element"
id: electric_water_heater_2_bottom_element
pin:
pcf8574: pcf8574_hub_out_1
number: 4
mode: OUTPUT
inverted: true
- platform: gpio
name: "Hot Water Recirculation Pump"
id: hot_water_recirculation_pump
pin:
pcf8574: pcf8574_hub_out_1
number: 5
mode: OUTPUT
inverted: true
- platform: gpio
name: "Geothermal Desuperheater Pump 3 Way Electronic Valve"
id: geothermal_desuperheater_pump_3_way_electronic_valve
pin:
pcf8574: pcf8574_hub_out_1
number: 6
mode: OUTPUT
inverted: true
- platform: gpio
name: "Geothermal Desuperheater ByPass Electronic Valve"
id: geothermal_desuperheater_bypass_electronic_valve
pin:
pcf8574: pcf8574_hub_out_1
number: 7
mode: OUTPUT
inverted: true
- platform: gpio
name: "Electric Water Heater 1 - Output Cut Off Electronic Valve"
id: electric_water_heater_1_output_cut_off_electronic_valve
pin:
pcf8574: pcf8574_hub_out_2
number: 0
mode: OUTPUT
inverted: true
- platform: gpio
name: "Electric Water Heater 1 - Input Cut Off Electronic Valve"
id: electric_water_heater_1_input_cut_off_electronic_valve
pin:
pcf8574: pcf8574_hub_out_2
number: 1
mode: OUTPUT
inverted: true
- platform: gpio
name: "Electric Water Heater 1 - Recirculation Cut Off Electronic Valve"
id: electric_water_heater_1_recirculation_cut_off_electronic_valve
pin:
pcf8574: pcf8574_hub_out_2
number: 2
mode: OUTPUT
inverted: true
# Individual outputs
binary_sensor:
- platform: gpio
name: "Sol-Ark Grid Input Mercury Contactors - Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 0
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: sol_ark_grid_input_mercury_contactor
- platform: gpio
name: "Electric Water Heater 1 - Top Element Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 1
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: electric_water_heater_1_top_element
- platform: gpio
name: "Electric Water Heater 2 - Top Element Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 2
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: electric_water_heater_2_top_element
- platform: gpio
name: "Electric Water Heater 1 - Bottom Element Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 3
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: electric_water_heater_1_bottom_element
- platform: gpio
name: "Electric Water Heater 2 - Bottom Element Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 4
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: electric_water_heater_2_bottom_element
- platform: gpio
name: "Hot Water Recirculation Pump - Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 5
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: hot_water_recirculation_pump
- platform: gpio
name: "Geothermal Desuperheater Pump 3 Way Electronic Valve - Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 6
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: geothermal_desuperheater_pump_3_way_electronic_valve
- platform: gpio
name: "Electric Water Heater 1 - Output Cut Off Electronic Valve - Switch"
pin:
pcf8574: pcf8574_hub_in_1
number: 7
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: electric_water_heater_1_output_cut_off_electronic_valve
- platform: gpio
name: "Electric Water Heater 1 - Input Cut Off Electronic Valve - Switch"
pin:
pcf8574: pcf8574_hub_in_2
number: 0
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: electric_water_heater_1_input_cut_off_electronic_valve
- platform: gpio
name: "Electric Water Heater 1 - Recirculation Cut Off Electronic Valve - Switch"
pin:
pcf8574: pcf8574_hub_in_2
number: 1
mode: INPUT
inverted: true
on_press:
then:
- switch.toggle: electric_water_heater_1_recirculation_cut_off_electronic_valve
# Enable logging
logger:
level: debug
# Enable Home Assistant API
api:
password: <password> # Add your password here for API access
dmesg Output Showing Successful USB Connection and Device Port
Code:
[15024.377787] usb 1-1: new full-speed USB device number 45 using xhci_hcd
...
[15024.508783] usb 1-1: ch341-uart converter now attached to ttyUSB0
[15347.157356] input: MX Keys Keyboard as /devices/virtual/misc/uhid/0005:046D:B35B.0021/input/input77
dmesg Output Showing Successful USB Removal After Firmware Upload
Code:
[15360.959985] usb 1-1: USB disconnect, device number 45
[15360.960088] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[15360.960119] ch341 1-1:1.0: device disconnected
ESPHome YAML Validation Success
Code:
Truncated to fit post constraints
INFO Configuration is valid!
Successful Upload of Firmware to Board
Code:
(.venv) ➜ kc868-e16s git:(main) ✗ esphome upload --device /dev/ttyUSB0 --file ./.esphome/build/kc868-e16s/.pioenvs/kc868-e16s/firmware.bin kc868-e16s.yaml
INFO ESPHome 2023.12.5
...
Wrote 591904 bytes (362780 compressed) at 0x00000000 in 8.6 seconds (effective 549.5 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
Matthew Dresden
Global DevSecOps Leader at Launch by NTT Data, INC
IOT and Alternative Power Enthusiasts
Global DevSecOps Leader at Launch by NTT Data, INC
IOT and Alternative Power Enthusiasts