Hi,
I’we build some ESP32-C3 based presence sensors based on the suggestions I found in the net.
Hardware is a ESP32-C3 SuperMini board and an LD2420. The LD2420 is connected to GPIO20 and 21 - but the other way the ESP32-C3 board layout suggests. This was the only way it worked as I tested the arrangement on the breadboard.
The firmware was created with Esphome (on HomeAssistant) 2025.6.1 and 2025.6.3.
Now I soldered together another one and programmed it with the current version 2025.7.3 - now the LD2420 component doesn’t work anymore. To be sure I don’t have faulty hardware I reprogrammed one of the modules that worked - after reprogramming ist stopped working.
Here ist the YAML:
substitutions:
devicename: ba-ba-pres
location: Backes Ersatzbad
friendly_name: "BA Toi Presence"
ip_address: 172.16.20.130
ip_gateway: 172.16.20.1
ip_subnet: 255.255.255.0
ip_dns1: 172.16.20.1
project_name: "rb.presence"
project_version: "1.0"
<<: !include include/ESP32-C3-SuperMini.yaml
# ld2420 Radar Presense
uart:
id: ld2420_uart
tx_pin: GPIO20
rx_pin: GPIO21
baud_rate: 115200
parity: NONE
stop_bits: 1
# Example configuration entry
ld2420:
select:
- platform: ld2420
operating_mode:
name: Operating Mode
button:
- platform: ld2420
apply_config:
name: "${friendly_name} Apply Config"
factory_reset:
name: "${friendly_name} Factory Reset"
restart_module:
name: "${friendly_name} Restart Module"
revert_config:
name: "${friendly_name} Undo Edits"
binary_sensor:
- platform: ld2420
has_target:
name: "${friendly_name} Presence"
sensor:
- platform: ld2420
moving_distance:
name : "${friendly_name} Moving Distance"
# - platform: adc
# pin:
# number: GPIO00
# mode: INPUT
# name: "${friendly_name} Helligkeit"
# id: Helligkeit
# update_interval: 10s
# attenuation: auto
# Example configuration entry with 2 sensors and filter
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "WiFi Signal Percent"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: "diagnostic"
device_class: ""
# **************************************
text_sensor:
- platform: ld2420
fw_version:
name: "${friendly_name} LD2420 Firmware"
- platform: wifi_info
ip_address:
name: ESP IP Address
ssid:
name: ESP Connected SSID
bssid:
name: ESP Connected BSSID
mac_address:
name: ESP Mac Wifi Address
number:
- platform: ld2420
presence_timeout:
name: "${friendly_name} Detection Presence Timeout"
min_gate_distance:
name: "${friendly_name} Detection Gate Minimum"
max_gate_distance:
name: "${friendly_name} Detection Gate Maximum"
# See "Number" section below for detail
gate_select:
name: "${friendly_name} Select Gate to Set"
still_threshold:
name: "${friendly_name} Set Still Threshold Value"
move_threshold:
name: "${friendly_name} Set Move Threshold Value"
#logger:
# level: VERBOSE
and the include for the C3:
esp32:
board: esp32-c3-devkitm-1
variant: ESP32C3
framework:
# type: esp-idf
type: arduino
esphome:
name: $devicename
friendly_name: $friendly_name
project:
name: ${project_name}
version: ${project_version}
on_boot:
priority: -10
then:
- wait_until:
api.connected:
- logger.log: API is connected!
wifi:
networks:
ssid: !secret wifi_ssid
password: !secret wifi_password
# power_save_mode: none
output_power: 8.5
manual_ip:
static_ip: ${ip_address}
gateway: ${ip_gateway}
subnet: ${ip_subnet}
dns1: ${ip_dns1}
ap:
ssid: ${devicename}
password: $devicename
# Enable the captive portal for inital WiFi setup
captive_portal:
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
# password: !secret api_password
ota:
- platform: esphome
password: !secret ota_password
# name_add_mac_suffix: true
# Enable Web server (optional).
web_server:
port: 80
I already tried disabling the logger on UART, increasing the receive buffer etc. Here ist the log of a working module:
INFO ESPHome 2025.7.3
INFO Reading configuration /config/esphome/KE-Wasch-Pres.yaml...
INFO Starting log output from 172.16.20.134 using esphome API
INFO Successfully resolved ke-wa-pres @ 172.16.20.134 in 0.000s
INFO Successfully connected to ke-wa-pres @ 172.16.20.134 in 0.086s
INFO Successful handshake with ke-wa-pres @ 172.16.20.134 in 0.033s
[17:32:35][I][app:137]: ESPHome version 2025.6.3 compiled on Jul 6 2025, 16:05:36
[17:32:35][I][app:139]: Project rb.presence version 1.0
[17:32:35][C][wifi:613]: WiFi:
[17:32:35][C][wifi:434]: Local MAC: 58:8C:81:A2:E4:A8
[17:32:35][C][wifi:439]: SSID: 'BO-IOT'[redacted]
[17:32:35][C][wifi:442]: IP Address: 172.16.20.134
[17:32:35][C][wifi:451]: BSSID: 6E:D7:9A:CA:CC:95[redacted]
[17:32:35][C][wifi:451]: Hostname: 'ke-wa-pres'
[17:32:35][C][wifi:451]: Signal strength: -65 dB ▂▄▆█
[17:32:35][C][wifi:462]: Channel: 1
[17:32:35][C][wifi:462]: Subnet: 255.255.255.0
[17:32:35][C][wifi:462]: Gateway: 172.16.20.1
[17:32:35][C][wifi:462]: DNS1: 172.16.20.1
[17:32:35][C][wifi:462]: DNS2: 0.0.0.0
[17:32:35][C][logger:215]: Logger:
[17:32:35][C][logger:215]: Max Level: DEBUG
[17:32:35][C][logger:215]: Initial Level: DEBUG
[17:32:35][C][logger:220]: Log Baud Rate: 115200
[17:32:35][C][logger:220]: Hardware UART: USB_CDC
[17:32:35][C][logger:224]: Task Log Buffer Size: 768
[17:32:35][C][uart.arduino_esp32:151]: UART Bus 0:
[17:32:35][C][uart.arduino_esp32:152]: TX Pin: GPIO20
[17:32:35][C][uart.arduino_esp32:153]: RX Pin: GPIO21
[17:32:35][C][uart.arduino_esp32:155]: RX Buffer Size: 256
[17:32:35][C][uart.arduino_esp32:162]: Baud Rate: 115200 baud
[17:32:35][C][uart.arduino_esp32:162]: Data Bits: 8
[17:32:35][C][uart.arduino_esp32:162]: Parity: NONE
[17:32:35][C][uart.arduino_esp32:162]: Stop bits: 1
[17:32:35][C][ld2420:072]: LD2420:
[17:32:35][C][ld2420:072]: Firmware Version : v1.6.1
[17:32:35]LD2420 Number:
[17:32:35][C][ld2420:074]: ld2420 Gate Timeout: 'Keller Wasch Presence Detection Presence Timeout'
[17:32:35][C][ld2420:074]: ld2420 Icon: 'mdi:timelapse'
[17:32:35][C][captive_portal:089]: Captive Portal:
[17:32:35][C][web_server:288]: Web Server:
[17:32:35][C][web_server:288]: Address: 172.16.20.134:80
[17:32:35][C][safe_mode:018]: Safe Mode:
[17:32:35][C][safe_mode:025]: Boot considered successful after 60 seconds
[17:32:35][C][safe_mode:025]: Invoke after 10 boot attempts
[17:32:35][C][safe_mode:025]: Remain for 300 seconds
[17:32:35][C][wifi_signal.sensor:010]: WiFi Signal 'WiFi Signal dB'
[17:32:35][C][wifi_signal.sensor:010]: State Class: 'measurement'
[17:32:35][C][wifi_signal.sensor:010]: Unit of Measurement: 'dBm'
[17:32:35][C][wifi_signal.sensor:010]: Accuracy Decimals: 0
[17:32:35][C][wifi_signal.sensor:010]: Device Class: 'signal_strength'
[17:32:35][C][wifi_info:013]: WifiInfo BSSID 'ESP Connected BSSID'
[17:32:35][C][wifi_info:010]: WifiInfo IPAddress 'ESP IP Address'
[17:32:35][C][mdns:125]: mDNS:
[17:32:35][C][mdns:125]: Hostname: ke-wa-pres
[17:33:28][D][sensor:099]: 'WiFi Signal dB': Sending state -65.00000 dBm with 0 decimals of accuracy
[17:33:28][D][sensor:099]: 'WiFi Signal Percent': Sending state 70.00000 Signal % with 0 decimals of accuracy
once you see the correct firmware version, eveything is good.
Here is the log of an identical module not working:
INFO ESPHome 2025.7.3
INFO Reading configuration /config/esphome/BA-Bad_pres.yaml...
INFO Starting log output from 172.16.20.130 using esphome API
INFO Successfully resolved ba-ba-pres @ 172.16.20.130 in 0.000s
INFO Successfully connected to ba-ba-pres @ 172.16.20.130 in 0.087s
INFO Successful handshake with ba-ba-pres @ 172.16.20.130 in 0.033s
[17:31:38][I][app:149]: ESPHome version 2025.7.3 compiled on Jul 28 2025, 15:58:46
[17:31:38][I][app:151]: Project rb.presence version 1.0
[17:31:38][C][wifi:613]: WiFi:
[17:31:38][C][wifi:434]: Local MAC: 58:8C:81:9F:73:38
[17:31:38][C][wifi:439]: SSID: 'BO-IOT'[redacted]
[17:31:38][C][wifi:442]: IP Address: 172.16.20.130
[17:31:38][C][wifi:446]: BSSID: 6E:D7:9A:CA:D0:31[redacted]
[17:31:38][C][wifi:446]: Hostname: 'ba-ba-pres'
[17:31:38][C][wifi:446]: Signal strength: -57 dB ▂▄▆█
[17:31:38][C][wifi:455]: Channel: 6
[17:31:38][C][wifi:455]: Subnet: 255.255.255.0
[17:31:38][C][wifi:455]: Gateway: 172.16.20.1
[17:31:38][C][wifi:455]: DNS1: 172.16.20.1
[17:31:38][C][wifi:455]: DNS2: 0.0.0.0
[17:31:38][C][logger:246]: Logger:
[17:31:38][C][logger:246]: Max Level: DEBUG
[17:31:38][C][logger:246]: Initial Level: DEBUG
[17:31:38][C][logger:252]: Log Baud Rate: 0
[17:31:38][C][logger:252]: Hardware UART: USB_CDC
[17:31:38][C][logger:259]: Task Log Buffer Size: 768
[17:31:38][C][uart.arduino_esp32:151]: UART Bus 0:
[17:31:38][C][uart.arduino_esp32:152]: TX Pin: GPIO20
[17:31:38][C][uart.arduino_esp32:153]: RX Pin: GPIO21
[17:31:38][C][uart.arduino_esp32:155]: RX Buffer Size: 256
[17:31:38][C][uart.arduino_esp32:157]: Baud Rate: 115200 baud
[17:31:38][C][uart.arduino_esp32:157]: Data Bits: 8
[17:31:38][C][uart.arduino_esp32:157]: Parity: NONE
[17:31:38][C][uart.arduino_esp32:157]: Stop bits: 1
[17:31:38][C][ld2420:187]: LD2420:
[17:31:38][C][ld2420:187]: Firmware version: v0.0.0
[17:31:38][C][ld2420:192]: Number:
[17:31:38][C][ld2420:193]: Gate Timeout: 'BA Toi Presence Detection Presence Timeout'
[17:31:38][C][ld2420:193]: Icon: 'mdi:timelapse'
[17:31:39][C][ld2420:196]: Icon: 'mdi:motion-sensor'
[17:31:39][C][ld2420:196]: Device Class: 'distance'
[17:31:39][C][ld2420:203]: Icon: 'mdi:restart-alert'
[17:31:39][C][ld2420:204]: Revert Edits: 'BA Toi Presence Undo Edits'
[17:31:39][C][ld2420:205]: Icon: 'mdi:database'
[17:31:39][C][ld2420:206]: Restart Module: 'BA Toi Presence Restart Module'
[17:31:39][C][ld2420:206]: Icon: 'mdi:database'
[17:31:39][C][ld2420:208]: Select:
[17:31:39][C][ld2420:209]: Operating Mode 'Operating Mode'
[17:31:39][W][ld2420:211]: Firmware version v0.0.0 and older supports Simple Mode only
[17:31:39][E][component:141]: ld2420 is marked FAILED: unspecified
[17:31:39][C][ld2420.binary_sensor:011]: Binary Sensor:
[17:31:39][C][ld2420.binary_sensor:012]: Presence 'BA Toi Presence Presence'
[17:31:39][C][ld2420.binary_sensor:012]: Device Class: 'occupancy'
[17:31:39][C][ld2420.sensor:011]: Sensor:
[17:31:39][C][ld2420.sensor:012]: Distance 'BA Toi Presence Moving Distance'
[17:31:39][C][ld2420.sensor:012]: State Class: ''
[17:31:39][C][ld2420.sensor:012]: Unit of Measurement: 'cm'
[17:31:39][C][ld2420.sensor:012]: Accuracy Decimals: 0
[17:31:39][C][ld2420.sensor:012]: Device Class: 'distance'
[17:31:39][C][copy.sensor:015]: Copy Sensor 'WiFi Signal Percent'
[17:31:39][C][copy.sensor:015]: State Class: 'measurement'
[17:31:39][C][copy.sensor:015]: Unit of Measurement: 'Signal %'
[17:31:39][C][copy.sensor:015]: Accuracy Decimals: 0
[17:31:39][C][ld2420.text_sensor:012]: Firmware 'BA Toi Presence LD2420 Firmware'
[17:31:39][C][ld2420.text_sensor:012]: Icon: 'mdi:chip'
[17:31:39][C][wifi_info:014]: MAC Address 'ESP Mac Wifi Address'
[17:31:39][C][captive_portal:099]: Captive Portal:
[17:31:39][C][web_server:310]: Web Server:
[17:31:39][C][web_server:310]: Address: 172.16.20.130:80
[17:31:39][C][esphome.ota:073]: Over-The-Air updates:
[17:31:39][C][esphome.ota:073]: Address: 172.16.20.130:3232
[17:31:39][C][esphome.ota:073]: Version: 2
[17:31:39][C][esphome.ota:080]: Password configured
[17:31:39][C][safe_mode:018]: Safe Mode:
[17:31:39][C][safe_mode:019]: Boot considered successful after 60 seconds
[17:31:39][C][safe_mode:019]: Invoke after 10 boot attempts
[17:31:39][C][safe_mode:019]: Remain for 300 seconds
[17:31:39][C][api:207]: API Server:
[17:31:39][C][api:207]: Address: 172.16.20.130:6053
[17:31:39][C][wifi_info:013]: BSSID 'ESP Connected BSSID'
[17:31:39][C][wifi_info:010]: IP Address 'ESP IP Address'
[17:31:39][C][mdns:122]: mDNS:
[17:31:39][C][mdns:122]: Hostname: ba-ba-pres
[17:31:41][I][safe_mode:042]: Boot seems successful; resetting boot loop counter
[17:31:41][D][esp32.preferences:142]: Writing 1 items: 0 cached, 1 written, 0 failed
In fact, this module was working before, had firmware created with 2025.6.3 like the one above.
The LD2420 is working correctly, when you spy with the RX pin of an FTDI adapter, you see the regular Range XX messages. It seems that there is a bug somewhere either in the C3 UART Code and/or the LD2420 component.
Any ideas?
Thanks
Rainer