LD2410 esphome tips

Jst-gh cables should work fine

For those who got the version with the pre-soldered tiny pins, there is also a pre-made cable:

https://www.aliexpress.us/item/3256804768479753.html

On another note, I have been following a thread on github and it appears there is a major update to the default integration of the ld2410… I think it is in the final stages to being released. A superstar dev has put tons of work into it… the wait is killing me as I have several ld2410 projects in flight and can’t wait to use the new feature rich integration.

1 Like

Can you share the thread please?

This is the thread… not sure what is holding up the merge as I believe the author has complied with all requests from esphome devs…

1 Like

Hello, yo use light sensor, you have to use dev version of esp home & external component like this

external_components:
  source: github://regevbr/esphome@ld2410
  components: [ld2410]

For the moment this support is not yet merged into esp home thus not available as is.
See here.
@aruffell , definitely regvbr did a great job and I’m looking forward to see it’s job included in official release, but seems that esp home team very busy with all PR’s.
Hope it helps.
FYI : I’m the author of the original implementation for ld2410 support in esp home.:wink:

5 Likes

@sebcaps - thank you for contributing the original integration! I have 3 systems going and working well but welcome the added features and configurability as it will make it easier to work with this little sensor.

1 Like

I look forward to your additions to this component, I currently have 10 of them in use but I am curious what exactly does the light function do? I am assuming it’s not a lux reader, what would one be able to do with the function of this?

Well, it was added upon request to expose all data from that sensor (for exhaustivity), . But is ‘just’ a raw value between 0 and 255, in engineering mode only, which can be used as an indicator but definitely not lux value.
Personally I combine ld2410 with bh1750 lux sensor to switch on light when I’m present and ambiant light is below a threshold.

Thanks. I saw the light function within the app but couldn’t really determine what if anything I could do with it. I have added not only BH1750’s but also have some with BME680’s and the others with BME280’s.

Hello. Please tell me, I recently created a sensor on ld2410. To do this, I applied the example and code of the respected regvbr. From this https://github.com/esphome/esphome/pull/4434
Changed only the first api and wifi blocks
And the sensor worked great! I was able to mount it to the ceiling and then adjust the sensitivity levels to exactly where it is located. Since this ld2410 is without bluetooth, I was very pleased with the ability to set all parameters through the HA interface.
But after a couple of days, he reset the parameters and stopped switching to the engineering mode, now the sensitivity levels are also not adjustable, but the still movement distance level is still displayed …
I understand that I used the not yet tested code copied from the esphome dev branch. But this ability to configure the sensor from the interface is very important to me. After all, it must be individually configured exactly in the place where it will work. And without bluetooth support, this is extremely difficult to do.

I am second to this comment. I first tried the BLE and although it works, the connection is really unstable and only works very near HA BT receiver. The LD2410 is not strong or very sensitive I guess. Moved it to a ESP32 (I had one lying around) and it is working really well so far. The configuration I do altering the ESPHome yml, I don’t have the BT app on my phone (I refuse to install any app that is not available through the official play store, just me with my thin foil hat…)

Thank you for the original plugin, it’s really great. It’s great to see the light plugin integrated into the new plugin.

I will not be using the native code but the custom component route. I will test the 2 ‘burnt’ LD2410 on the custom component when I get the chance later on down.

I have purchased 2 more of the LD2410 sensors and tested my previous ones. Both are not working. The 2 newer ones do work.

This is exactly what I am looking for, Can you share more details on how to combine them?

How to add sliders for thresholds?
I’m successfully using the latest ESPhome LD2410 implementation. I’d like to implement sliders to adjust the various thresholds on the fly. Has anyone done this?
I’ve tried creating a number template and using lambdas to adjust thresholds but I get various compile errors such as “template not allowed”.
Sample code would be helpful
thanks!

try this

thanks,
I’ll take a look but it seems like a branch away from the official esphome ld2410 support

Yes. The functionality you’re searching for is implemented there - and still didn’t make it to main ESPHome, despite being highly requested…

Has anyone got multiple ld2410 to work on a single esp32? I have this working perfectly on an esp8266 and esp32 with only 1 ld2410 on each, but would like to run 3 off of 1 esp32. The esp32 has 3 hardware UARTs, so I believe it should work. However, I either have the code wrong of maybe the ESPHome-LD2410 code doesn’t support this function yet? Could anyone review my sample code below and let me know if I’m defining my multiple sensors and binary sensors incorrectly? Thanks!

The error is [uart_id] is an invalid option for [sensor.ld2410]. Please check the indentation. If I try just id: instead of uart_id:, I get the same message telling my it’s an invalid option.

esphome:
  name: test-esp32
  friendly_name: test-esp32

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: INFO
  baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "removed"

ota:
  password: "removed"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Test-Esp32 Fallback Hotspot"
    password: "removed"

captive_portal:

uart:
  - id: UART0
    tx_pin: 1
    rx_pin: 3
    baud_rate: 256000
    parity: NONE
    stop_bits: 1

  - id: UART1
    tx_pin: 9
    rx_pin: 10
    baud_rate: 256000
    parity: NONE
    stop_bits: 1

ld2410:
  - uart_id: UART0
    timeout: 150s
    max_move_distance: 6m
    max_still_distance: 6m
    g0_move_threshold: 50
    g1_move_threshold: 50  
    g2_move_threshold: 40  
    g3_move_threshold: 30  
    g4_move_threshold: 30  
    g5_move_threshold: 20
    g6_move_threshold: 20
    g7_move_threshold: 40
    g8_move_threshold: 40
    g0_still_threshold: 20
    g1_still_threshold: 20
    g2_still_threshold: 20
    g3_still_threshold: 20
    g4_still_threshold: 20
    g5_still_threshold: 20
    g6_still_threshold: 20
    g7_still_threshold: 30
    g8_still_threshold: 30

  - uart_id: UART1
    timeout: 150s
    max_move_distance: 6m
    max_still_distance: 6m
    g0_move_threshold: 50
    g1_move_threshold: 50  
    g2_move_threshold: 40  
    g3_move_threshold: 30  
    g4_move_threshold: 30  
    g5_move_threshold: 20
    g6_move_threshold: 20
    g7_move_threshold: 40
    g8_move_threshold: 40
    g0_still_threshold: 20
    g1_still_threshold: 20
    g2_still_threshold: 20
    g3_still_threshold: 20
    g4_still_threshold: 20
    g5_still_threshold: 20
    g6_still_threshold: 20
    g7_still_threshold: 30
    g8_still_threshold: 30

sensor:
  - platform: ld2410
    uart_id: UART0
    moving_distance:
      name : Moving Distance s1
    still_distance:
      name: Still Distance s1
    moving_energy:
      name: Move Energy s1
    still_energy:
      name: Still Energy s1
    detection_distance:
      name: Detection Distance s1

  - platform: ld2410
    uart_id: UART1
    moving_distance:
      name : Moving Distance s2
    still_distance:
      name: Still Distance s2
    moving_energy:
      name: Move Energy s2
    still_energy:
      name: Still Energy s2
    detection_distance:
      name: Detection Distance s2

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

  - platform: ld2410
    uart_id: UART1
    has_target:
      name: Presence s2
    has_moving_target:
      name: Moving Target s2
    has_still_target:
      name: Still Target s2

Source - esp32 3 hardware UARTs: Logger Component — ESPHome

Perhaps I need to post on the project’s github page, but thought I’d start here. Thank you in advance. GitHub - rain931215/ESPHome-LD2410: ESPHome LD2410 mmWave Radar Sensor Custom Component

Update: I realized I can program the LD2410C with my FTDI adapter and a program via computer, or use the Android app to program via Bluetooth. This allowed me to do an OTA firmware update via the Android app, set the sensitivity, then just use the 1 “out” pin on the sensor to monitor for human presence. Source: Using the 4G Network to Save my Friends Treasures! - YouTube

After completing testing and finding I got the same presence detection results, I switched to using the following for a 1 wire sensor setup (plus power and ground).

binary_sensor:
  - platform: gpio
    name: "Motion Presence test"
    pin:
      number: D5
      mode: INPUT_PULLUP
    device_class: motion

I can do more of a write up on how to use the app for Android if anyone is interest. I bought 12 of these ld2410c to replace the PIR sensors around my house, so I’m trying to get away from needing 12 d1 mini’s to run all these using uart! This will allow me to run 5 of these from one d1 mini.

Use these links at your own risk, but these are the most official links I could find.

HLK’s Android app to configure these sensors over BT (There is an English version link in the bottom right corner of page) - HLKRadarTool The app supports firmware updates; beta 2.04.x enables the photosensor and allows it to be configured. The photosensor allows you to require the light brightness to be above or below a set threshold before motion will make the out pin go high. Example, this could be used if you wanted the pin to turn on a relay that powers a light and you only want motion to turn on the light if it’s dark in the room. BTW, some of my sensors came with current firmware and some came with new beta firmware. I tested the OTA firmware update and it worked great; just requires a power cycle of the sensor after.

HLK’s Windows tool to configure these sensors over serial via FTDI adapter (HLK-LD2410B works for C also) - Radar Module_ Docs Download _ Shenzhen Hi-Link Electronic Co., Ltd. (direct link do download page HLK-LD2410B - Google Drive)

Final tip to share; after factory resetting the sensor in the app, these are the gate thresholds it reset to and I think they are the best I’ve tested yet if you want to get max distance and accuracy from the sensor! It can detect me breathing from 6 meters away and keep the presence sensor active!

    timeout: 150s
    max_move_distance: 6m
    max_still_distance: 6m
    g0_move_threshold: 50
    g1_move_threshold: 50  
    g2_move_threshold: 40  
    g3_move_threshold: 30  
    g4_move_threshold: 20  
    g5_move_threshold: 15
    g6_move_threshold: 15
    g7_move_threshold: 15
    g8_move_threshold: 15
    g0_still_threshold: 60
    g1_still_threshold: 60
    g2_still_threshold: 40
    g3_still_threshold: 40
    g4_still_threshold: 30
    g5_still_threshold: 30
    g6_still_threshold: 20
    g7_still_threshold: 20
    g8_still_threshold: 20
3 Likes

How did you adjust the sensitivity range? I don’t see anywhere for this option, I also have no idea where you were able to get this pic/screenshot from. Some help would be very much appreciated as I’m looking to do exactly the same thing.