LD2410 esphome tips

It depends on which HA integration you are using.
If you are using the LD2410 BLE integration, then its always going to be using Bluetooth and for the LD2410, the Bluetooth range is very poor.
If you are using the ESPHome integration with your yaml configured for the ESPHome LD2410 sensor, then it will be using Wifi all the time via the ESP32 board giving you a much improved range.
Since you have it connected to an ESP32, then you should be using the ESPHome LD2410 integration:

Thx for the reply. Yes, I use HA ESPHome and LD2410 Yaml.

t
Just wondering, that I do net get wifi connection in between this 5 to 6 meters. My Phone for example can reach my wifi everywhere in my house, the ESP with the LD2410 drops out…
Thats why I also tried to bring a ESP Wifi Repeater in between. But it looks like this does not work too.

Post your YAML.

You can try adding the following to your YAML to create some sensors so you can see the wifi signal levels and details that the ESP32 board is getting to help diagnose the issue:

sensor:
  - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
    name: "WiFi Signal dB"
    id: wifi_signal_db
    entity_category: "diagnostic"

text_sensor:
  - 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"
    scan_results:
      name: "ESP Latest Scan Results"

Here is my Yaml:

esphome:
  name: ld2410
  friendly_name: LD2410

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "hlCqUvwc4XULavgu1+H1KLiTPElALNOq4c0fteNQT7A="

ota:
  password: "d877896ad6d9a58f3f0e10cfaa430a2d"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ld2410 Fallback Hotspot"
    password: "E4ePyHvd8Ptw"

captive_portal:
 
light:
  - platform: binary
    name: "Blue Status Light"
    output: light_output
    id: led_light
    restore_mode: ALWAYS_OFF
 
output:
  - platform: gpio
    pin: GPIO2
    id: light_output
 
i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a
 
uart:
  id: ld2410_uart
  tx_pin: 17
  rx_pin: 16
  baud_rate: 256000
  parity: NONE
  stop_bits: 1
 
ld2410:
  uart_id: ld2410_uart
  throttle: 1500ms
  id: ld2410_comp
 
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
 
button:
  - platform: ld2410
    factory_reset:
      name: "factory reset"
    restart:
      name: "restart"
    query_params:
      name: query params
 
number:
  - platform: ld2410
    timeout:
      name: timeout
    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
    light_threshold:
      name: light threshold
 
text_sensor:
  - platform: ld2410
    version:
      name: "presenece sensor version"
    mac_address:
      name: "presenece sensor mac address"
 
switch:
  - platform: ld2410
    engineering_mode:
      name: "engineering mode"
    bluetooth:
      name: control Bluetooth
 
sensor:
  - platform: ld2410
    moving_distance:
      name: "Moving distance (cm)"
    still_distance:
      name: "Still Distance (cm)"
    moving_energy:
      name: "Move Energy (%)"
    still_energy:
      name: "Still Energy (%)"
    detection_distance:
      name: "Distance Detection (cm)"
    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
    light:
      name: light
 

binary_sensor:
 
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
    has_still_target:
      name: Still Target

As said, I do not get Wifi Connection in my floor at the position, I want to mount the Presence Sensor. Is there a way I can force the ESP to connect to a wifi ESP Repeater? I t looks like the ESP does not pick up the wifi signal I repeat with this repeater here: GitHub - dchristl/esp32_nat_router_extended: a simple ESP32 NAT Router with some additional features

Adding the wifi sensors to the YAML for the ESP32 board I have suggested can help you diagnose the wifi signal level received by the board when it is in the same room as your wifi router and when moved around the house. If the levels are poor, then it can give you an idea if there is an issue if the wifi on your ESP32 board.

The YAML looks fine. By any chance does your ESP32 WROOM32 board have a USB-C port?

If so, you may want to read this thread:

1 Like

Yes, I have the USB-C Version in use. Thank y for the hint. I am able to see the signal strength via logfile, so I know it is a signal stength issue…
I have a wroom 32 with micro USB and giv that a try and will report back!

Thanks for the hint with the USB-C model. I de-soldered one pin and Wifi signal is just fine now and connection seems good. Hope it holds a stable one over time too, but now at least I get it connected…

2 Likes

oh I found this thread too late, I have an ESP32 WROOM32 witch usb-c as bluetooth proxy and a HLK-LD2410 ABE4 connected as motion sensor. the delay is quite high, about 5s. are there any common tips on how do increase reaction speed, because the little light on the board turns on very quickly

I just got some LD2410C modules and have never used anything like them before. So far the Bluetooth connection to HA has been intermittent at best, even with many proxies on the network nearby. I’m going to try to add with an esp 32 in HA and was wondering if anyone has an opinion on the best way to connect them, BLE, ESPHome via esp 32, or esp firmware directly on the LD2410c model itself. I read this can be done but haven’t researched it much. If you have a perfected method please let me know, but so far I’ve read the esp 32 method is best. Additionally, if anyone has some info on tuning the gates or a link to a good tutorial I’d be very interested.

Thanks

The bluetooth on the LD2410C is pretty weak as there is no external antenna.
The best and most reliable way is to connect it to an ESP32 board and using the LD2410 Esphome integration which then allows you to tune the setting from within HA.

Read through the thread as there is lots of information already shared by users on the LD2410 sensors.

Here is a link to one of the posts above that has a good explanation of the settings:

For the quickest response time, it would be best to connect the LD2410 board using the TX/RX pins to the ESP32 and use the ESPHome LD2410 integration.

1 Like

To get you started:

I did this but I integrated the Bluetooth first and am trying to figure out how to bring it in with the esp 32 board instead. I think I might have it set up both ways right now but haven’t found the sensors for the esp 32 portion yet.

To use the ESP32 board, you have to connect the TX/RX pins on the LD2410 to the ESP32 and included the YAML config for the LD2410 from the ESPHome documentation:

to make sure that I understand you correctly:
I should use a ESP32 with LD2410 and not use the LD2410 BLE integration by Home Assistant but instead connect the the ESP32 via ESP32 integration/add-on and configure it via YAML files. Is that correct?

to make things clearer to me, is the following correct?:
If I use an ESP32+LD2410 I can connect it via the beforementioned integration and need a bluetooth proxy for that. Then my motion sensor would use BLE via proxy and wifi from proxy to Home Assistant.

On the other hand I could use ESP integration + yaml file which would hook up my ESP32+LD2410 directly via wifi and therefore could be quicker to respond.

Yes that is correct. I would connect the power pins and the TX/RX pins from the LD2410 to the ESP32 board and have ESPHome installed on the ESP32 board.
Then update the YAML with the config from the ESPHome LD2410 component documentation.
Remove the LD2410 BLE integration as that will try to connect to the LD2410 via Bluetooth (using the Bluetooth proxy) which adds delays to the process.

By directly connecting the LD2410 sensor board to the ESP32 via the TX/RX pins, you will then be accessing the sensor via the ESP32 wifi.

The below is my LD2410C sensor connected to an ESP32-C3-Mini.
As my soldering skills are pretty poor, I managed to find a board with the pins already soldered on and I just had to wire them together and then fitted it into a case purchased from Aliexpress.


1 Like

Hey which code did you guys use in your ESPHome yaml for your esp 32 board? I have multiple types of boards so aren’t concerned so much with the board type as I am the code for the ld2410c. I’m going to look around for the code but if anyone sees this meanwhile please let me know.

Here’s my config

https://raw.githubusercontent.com/FriedCheese2006/HomeAssistant/main/ESPHome/ESP32_Micro_Radar/ESP32_S2/ESP32_S2_LD2410C.yaml

Thanks, I probably won’t be able to look at this until tomorrow night at the earliest. It seems there are a few versions of this code for the esp home device yaml around, some of them being steps in the evolution of the project. I just got an Everything Presence One in the mail literally today and am still writing automations for the Aqara Pf2 I got last month and am multitasking. I’ll post an update asap. Thanks again.