LD2410 esphome tips

I think maybe esp32 isn’t for me. Fought with it all day using default configs. I’m gonna call it and bow out.

How have you connected the LD2410 board to your ESP32-WROOM-32D board?
You need to connect GND, 5V, TX and RX and making sure that you cross the TX and RX from the LD2410 to the ESP32 board (ie. TX from the LD2410 goes to the RX on the ESP32 board and so on).

If your YAML UART config is like the following:

uart:
  id: ld2410_uart
  tx_pin: GPIO17
  rx_pin: GPIO16
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  uart_id: ld2410_uart
  id: ld2410_comp

Then you need to connect the TX pin from the LD2410 to the GPIO16 pin on your ESP32 board and the RX pin from the LD2410 to the GPIO17 pin on your ESP32 board.

Also make sure you are using the 5V pin and not the 3.3V pin. The LD2410 needs a good 5V power supply to work.

EDIT: I have narrowed the problem to the following:

The problem I am having is when I flash the ESP32 it is getting stuck here:

[18:54:19][D][esp32.preferences:114]: Saving 1 preferences to flash...
[18:54:19][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

Its been there for 30 minutes and not showing any sign of completing. So looks like this is where my issue is. This board does not require me to press the boot button to flash it either. Looks like flashing the yaml without wifi breaks the wifi… cant win lol


Ive done that, im on pop-os and I have connection issues that seem to be intermittent getting the ESP32-WROOM-32D connected. When I flash it at first and connect it to wifi, it pulls an ip and works, if I do anything else, it loses wifi connection and I never see the LD2410 as something ESPHome can detect. It has a pinout like the following:

I noticed this is not a typical pinout for this board so I wonder if maybe I have an incompatible version. I got these from ali-express and the chipset isnt the same as what I see when looking at tutorials. Not sure if it matters or not.

This is the default config I am left with after flashing the ESP32 from web.esphome.io

substitutions:
  name: esphome-web-5e2fa4
  friendly_name: Den mmWave

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

I pulled this config directly from the esp32 defaults used as suggested by @fugley from esphome.io.

uart:
  id: ld2410_uart
  tx_pin: 17
  rx_pin: 16
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  uart_id: ld2410_uart

number:
  - platform: ld2410
    timeout:
      name: timeout
    light_threshold:
      name: light threshold
    max_move_distance_gate:
      name: max move distance gate
    max_still_distance_gate:
      name: max still distance gate
    g0:
      move_threshold:
        name: g0 move threshold
      still_threshold:
        name: g0 still threshold
    g1:
      move_threshold:
        name: g1 move threshold
      still_threshold:
        name: g1 still threshold
    g2:
      move_threshold:
        name: g2 move threshold
      still_threshold:
        name: g2 still threshold
    g3:
      move_threshold:
        name: g3 move threshold
      still_threshold:
        name: g3 still threshold
    g4:
      move_threshold:
        name: g4 move threshold
      still_threshold:
        name: g4 still threshold
    g5:
      move_threshold:
        name: g5 move threshold
      still_threshold:
        name: g5 still threshold
    g6:
      move_threshold:
        name: g6 move threshold
      still_threshold:
        name: g6 still threshold
    g7:
      move_threshold:
        name: g7 move threshold
      still_threshold:
        name: g7 still threshold
    g8:
      move_threshold:
        name: g8 move threshold
      still_threshold:
        name: g8 still threshold

select:
  - platform: ld2410
    distance_resolution:
      name: "distance resolution"
    baud_rate:
      name: "baud rate"
    light_function:
      name: light function
    out_pin_level:
      name: out pin level

sensor:
  - platform: ld2410
    light:
      name: light
    moving_distance:
      name : Moving Distance
    still_distance:
      name: Still Distance
    moving_energy:
      name: Move Energy
    still_energy:
      name: Still Energy
    detection_distance:
      name: Detection Distance
    g0:
      move_energy:
        name: g0 move energy
      still_energy:
        name: g0 still energy
    g1:
      move_energy:
        name: g1 move energy
      still_energy:
        name: g1 still energy
    g2:
      move_energy:
        name: g2 move energy
      still_energy:
        name: g2 still energy
    g3:
      move_energy:
        name: g3 move energy
      still_energy:
        name: g3 still energy
    g4:
      move_energy:
        name: g4 move energy
      still_energy:
        name: g4 still energy
    g5:
      move_energy:
        name: g5 move energy
      still_energy:
        name: g5 still energy
    g6:
      move_energy:
        name: g6 move energy
      still_energy:
        name: g6 still energy
    g7:
      move_energy:
        name: g7 move energy
      still_energy:
        name: g7 still energy
    g8:
      move_energy:
        name: g8 move energy
      still_energy:
        name: g8 still energy

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target
    out_pin_presence_status:
      name: out pin presence status

switch:
  - platform: ld2410
    engineering_mode:
      name: "engineering mode"
    bluetooth:
      name: "control bluetooth"

button:
  - platform: ld2410
    factory_reset:
      name: "factory reset"
    restart:
      name: "restart"
    query_params:
      name: query params

text_sensor:
  - platform: ld2410
    version:
      name: "firmware version"
    mac_address:
      name: "mac address"

This LD2410 is not the BLE model so if you see any issues with what I have, please let me know. I was just disgusted burning up an entire day on this and got nowhere lol

I was able to get one to work. by removing some lines that the LD2410 didnt need i suppose. The problem I am having is when I flash the ESP32 it is getting stuck here:

[18:54:19][D][esp32.preferences:114]: Saving 1 preferences to flash...
[18:54:19][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

Its been there for 30 minutes and not showing any sign of completing. So looks like this is where my issue is.

Are there particular materials that MM Wave is reflective to or can be used to block?

Having a challenge where it’s triggering on movement on the other side of the wall.

I’m not quite sure if it’s reflecting off of my monitors and reading it or if it’s just reading it directly backwards.

What was the solution?

Looking at the picture of your ESP32 board, it looks like it has a USB-C port and it looks very similar to ones in the following thread which has issues with wifi and requires some tweaks to get them to work reliably.

@athua

Thanks for the reply. I dont think that my issue is with wireless connectivity though.

[06:42:23][C][wifi:408]:   Local MAC: A0:DD:6C:04:12:C0
[06:42:23][C][wifi:413]:   SSID: [redacted]
[06:42:23][C][wifi:416]:   IP Address: 192.168.20.171
[06:42:23][C][wifi:420]:   BSSID: [redacted]
[06:42:23][C][wifi:421]:   Hostname: 'esphome-web-0412c0'
[06:42:23][C][wifi:423]:   Signal strength: -48 dB ▂▄▆█
[06:42:23][C][wifi:427]:   Channel: 6
[06:42:23][C][wifi:428]:   Subnet: 255.255.255.0
[06:42:23][C][wifi:429]:   Gateway: 192.168.20.1
[06:42:23][C][wifi:430]:   DNS1: 192.168.1.51
[06:42:23][C][wifi:431]:   DNS2: 192.168.1.52
[06:42:23][C][logger:185]: Logger:
[06:42:23][C][logger:186]:   Level: DEBUG

My issue is with it writing to the flash it looks like:

[06:42:25][C][improv_serial:032]: Improv Serial:
[06:47:11][I][ota:117]: Boot seems successful, resetting boot loop counter.
[06:47:11][D][esp32.preferences:114]: Saving 1 preferences to flash...
[06:47:11][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

it just sits at this point and never finishes

If it is the wall opposite you can just disable the detection for the furthest gates so it won’t reat to those. Look at the numbers in engineering mode while something moves behind the wall.

ESPHome release 5.0 essentially “bricked” several of my ESP d1mini devices including the ld2410 presence sensors. I have about 10 presence sensors and 7 are apparently unrecoverable (at least I don’t know how). A number of other users have the same problem and there seem to be a number of theories about the cause but I haven’t found any responses from the ESPhome team?
Is there a “fix” coming? Should I toss my bad presence sensors? Start over with ESP32’s? Advice from the experts would be appreciated.

Read this for some tips

Reverting to.previous version and unsoldering worked for me.

That also worked for me for a couple devices, but others semingly identical devices simply won’t connect. I have reverted back to previous version and disconnected tx/rx. They show up as on line but cannot install anything. Won’t connect by any method I know.

One of mine needed to be setup as new device first, then copy the api and ota password to the original yaml and it flashed fine then, no idea why it was only one device out of 4 though. It took many hours of messing about to get that one back.

Not updating esphome for a while yet that is all I can say. :slight_smile:

My D1Mini’s were purchased at various times and places so there could be differences internally. The devices show up in ESPHome as on-line but logs cannot be viewed
(WARNING Can’t connect to ESPHome API for ld2410-12 @ 192.168.86.114: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address=‘192.168.86.114’, port=6053))]: [Errno 111] Connect call failed (‘192.168.86.114’, 6053) (SocketAPIError).
When attempting to reinstall of treat as new devices, these devices will not connect. Removing the TX/RX connections allowed a couple to connect but had no effect on most. Wish those supporting ESPHome would comment on the issue (if the have, I missed it). Just want the right approach to move on…

Yep it would be nice if someone with knowledge of the coding involved in Esphome to comment on the issue. Maybe they have not even seen the issue. Is there a way to make them aware of this, as the issue raised on github seems to have been overlooked.

i’ve been playing with that, but it’d also be useful to be able to enforce the directionality (id buy more and put them in some other locations)

They are probably working on it, there is a lot if issues reported.

https://github.com/esphome/esphome/pulls?q=is%3Apr+is%3Aopen+ble

for my case using d1 mini,

just disable the wifi serial improve line on uart logger

Were you able to solve the problem and run ESP32-c6 in 802.15.4 with LD2410?

I am not convinced about the stability of Wifi, even though I have great routers and a mesh network, I think that sharing the network with media devices is not a good idea.

It would be great if HLK-LD2410 worked fully on ZigBee.

Is it fixed with Esphome 2024.5.4 ?

I will wait and not update yet unless someone confirms it :wink: .

It seams issue has been fixed. 2024.5.4

1 Like