Hi everyone, need help troubleshoot an fix the issue where I am not able to make LD2420 v2.1 work with ESP32-C3-Supermini and ESPHOME. I connected the TX and RX pins correctly and ran a test program also using Arduino IDE to check if sensor is good. the sensor responds and sends RAW data when connected and flashed with Arduino IDE HardwareSerial.
However, when i upload the firmware from ESPHome, it says,
[20:03:53][VV][esp32.preferences:071]: nvs_get_blob: key: 233825507, len: 4
[20:03:53][C][safe_mode:079]: There have been 1 suspected unsuccessful boot attempts
[20:03:53][VV][esp32.preferences:040]: s_pending_save: key: 233825507, len: 4
[20:03:53][D][esp32.preferences:114]: Saving 1 preferences to flash...
[20:03:53][VV][esp32.preferences:123]: Checking if NVS data 233825507 has changed
[20:03:53][V][esp32.preferences:126]: sync: key: 233825507, len: 4
[20:03:53][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[20:03:53][I][app:029]: Running through setup()...
[20:03:53][V][app:030]: Sorting components by setup priority...
[20:03:53][VV][scheduler:063]: set_interval(name='', interval=60000, offset=14055)
[20:03:53][C][uart.arduino_esp32:077]: Setting up UART...
[20:03:53][C][ld2420:114]: Setting up LD2420...
[20:03:53][D][ld2420:564]: Sending set config enable command: FF
[20:03:56][E][ld2420:116]: LD2420 module has failed to respond, check baud rate and serial connections.
[20:03:56][E][component:119]: Component ld2420 was marked as failed.
[20:03:56][E][component:164]: Component ld2420 set Error flag: unspecified
[20:03:56][C][wifi:047]: Setting up WiFi...
[20:03:56][C][wifi:060]: Starting WiFi...
[20:03:56][C][wifi:061]: Local MAC: D8:3B:DA:34:B0:90
[20:03:56][V][esp32.preferences:059]: nvs_get_blob('3685851552'): ESP_ERR_NVS_NOT_FOUND - the key might not be set yet
[20:03:56][V][wifi_esp32:066]: Enabling STA.
[20:03:56][ 3193][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY
[20:03:56][V][wifi_esp32:485][arduino_events]: Event: WiFi ready
[20:03:56][ 3225][V][WiFiGeneric.cpp:338] _arduino_event_cb(): STA Started
[20:03:56][ 3226][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 2 - STA_START
[20:03:56][V][wifi_esp32:496][arduino_events]: Event: WiFi STA start
[20:03:56][W][wifi_esp32:500][arduino_events]: esp_netif_set_hostname failed: ESP_ERR_INVALID_ARG
[20:03:56][D][wifi:481]: Starting scan...
[20:03:56][VV][scheduler:226]: Running interval '' with interval=60000 last_execution=4294893425 (now=3238)
[20:03:56][W][component:157]: Component wifi set Warning flag: scanning for networks
And I tried other pins also UART1 and UART0 both but same error. here’s my ESPHome YAML code.
esphome:
name: bedroompresencedetection
friendly_name: BedroomPresenceDetection
esp32:
board: esp32-c3-devkitm-1
framework:
type: arduino
# Enable logging
logger:
level: VERY_VERBOSE
# Enable Home Assistant API
api:
encryption:
key: "Vrl8Pf0RMKFf+E="
ota:
- platform: esphome
password: "25e4a3c3a496aa1"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Bedroompresencedetection"
password: "nbdjkhgfhgd877hdfb7"
captive_portal:
uart:
id: ubus
tx_pin: GPIO21 # Change based on your wiring
rx_pin: GPIO20 # Change based on your wiring
baud_rate: 115200 # Use 256000 for firmware < v1.5.3
parity: NONE
stop_bits: 1
ld2420:
text_sensor:
- platform: ld2420
fw_version:
name: LD2420 Firmware
sensor:
- platform: ld2420
moving_distance:
name: "Moving Distance"
id: moving_distance
select:
- platform: ld2420
operating_mode:
name: "Operating Mode"
number:
- platform: ld2420
presence_timeout:
name: "Detection Presence Timeout"
min_gate_distance:
name: "Detection Gate Minimum"
max_gate_distance:
name: "Detection Gate Maximum"
gate_select:
name: "Select Gate to Set"
still_threshold:
name: "Set Still Threshold Value"
move_threshold:
name: "Set Move Threshold Value"
gate_move_sensitivity:
name: "Move Calibration Sensitivity Factor"
gate_still_sensitivity:
name: "Still Calibration Sensitivity Factor"
button:
- platform: ld2420
apply_config:
name: "Apply Config"
factory_reset:
name: "Factory Reset"
restart_module:
name: "Restart Module"
revert_config:
name: "Undo Edits"