LD2410 esphome tips

Thanks again, got it now.

Hey everyone,

Just wanted to say a big thank you for this incredible thread! It helped me a lot setting up my LD2410 sensors!

For those who prefer video tutorials, I’ve created a detailed installation guide on integrating the LD2410 with ESPHome, inspired by the valuable insights shared here.

I hope it helps others as much as this thread helped me!

4 Likes

Hello everyone,
can I connect more then one LD2410 sensors to an ESP32 board?

1 Like

Nice tutorial!
One question: what’s the use of the threshold and how to define the values?
gx_move_threshold: ##
gx_still_threshold: ##

If’ve left it in my code and it seems to work normally.

Thanks, I’m glad you found it helpful!

The threshold is divided into 9 gates, from 0 to 8. Each gate controls a different distance from the sensor. For example, gate 3 (g3) controls a range of 1.5m to 2.25m.

The threshold works such that 0 is the most sensitive, and 100 is the least sensitive. It corresponds to the values you see under “Move Energy” and “Still Energy” for each gate, you can get more accurate data using the HLKRadarTool app if you need to.

If it works with the default values, there is no need to change anything. I would only tweak it if you experience false positives.

1 Like

The thresholds are the sensitivity values for each distance gate. The higher the value, the more movement will be required to trigger it. See my explanation of the settings in the app which corresponds to the yaml settings:

Is anyone having trouble updating the firmware on the 2410? I’ve a couple of 2410Bs and Cs that I’ve just built into a couple of sensors, but I can’t update the firmware from V 1.07.22091516 on any of them.

I can see all the devices in the app but when I select more versions I do not get a list of firmware upgrades only the UPGRADE button. If I hit upgrade I get a message sayong “Please select the version!” and eventually I get an error message popup saying “Failed to obtain the firmware:-1”. Appart from not being able update the firmware everything appears to be working OK.

I’ve upgraded the app (on Android) to V1.1.18 and I get the same behaviour.

UPDATE: I was blocking ALL Chinese websites, DOH!

For those who may have trouble with getting the LD2410 working with ESP8266 - D1-Mini, particularly the ones with a CH340G serial to usb chip, try switching to the alternative uart pins:

uart:
tx_pin: GPIO15
rx_pin: GPIO13
baud_rate: 256000
parity: NONE
stop_bits: 1

After much debugging and suspecting bad electronics I finally determined that something about the CH340G chips prevents the serial communication with the LD2410. ESP8266 boards with the CP2104 serial usb chips work.

Docs: UART Bus — ESPHome
The ESP8266 has two UARTs; the second of which is TX-only. Only a limited set of pins can be used. UART0 may use either tx_pin: GPIO1 and rx_pin: GPIO3 , or tx_pin: GPIO15 and rx_pin: GPIO13 . UART1 must use tx_pin: GPIO2 . Any other combination of pins will result in use of a software UART.

Any news about the tests? :grinning:

a few things i do not understand.
bear with me as i trie to explain myself.

for testing i bought a few LD2410Bsensors and D1 Mini Esp8266 boards, to test this out.

so far i have made 2 working sensors with the following “captive portal” in esphome for the boards

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

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

binary_sensor:
  - platform: ld2410
    has_target:
      name: "presence"
    has_moving_target:
      name: "movement"
    has_still_target:
      name: "still"

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)"

all is fine and working.

now when i try to put in the following at the sensor code

    g0_move_energy:
      name: g0 move energy
    g0_still_energy:
      name: g0 still energy
    g1_move_energy:
      name: g1 move energy
    g1_still_energy:
      name: g1 still energy
    g2_move_energy:
      name: g2 move energy
    g2_still_energy:
      name: g2 still energy
    g3_move_energy:
      name: g3 move energy
    g3_still_energy:
      name: g3 still energy
    g4_move_energy:
      name: g4 move energy
    g4_still_energy:
      name: g4 still energy
    g5_move_energy:
      name: g5 move energy
    g5_still_energy:
      name: g5 still energy
    g6_move_energy:
      name: g6 move energy
    g6_still_energy:
      name: g6 still energy
    g7_move_energy:
      name: g7 move energy
    g7_still_energy:
      name: g7 still energy
    g8_move_energy:
      name: g8 move energy
    g8_still_energy:
      name: g8 still energy

esphome tells me

[g0_move_energy:] is an invalid option for [sensor.ld2410] did you mean [moving energy]?

same goes for

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

esphome tells me

platform not found: “switch ld2410”

and

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

esphome is telling me

platform not found: “button ld2410”

and everything posted here on github is not working for me either.

is it because i have the wrong LD2410 sensor, because it is the LD2410B or…
is it because i have the D1 Mini esp2866 instead of ESP32 board ?

It doesn’t look like the code needed for that YAML on GitHub has been merged into ESPHome yet. If/when that gets merged, the new configuration parameters and button/switch functionality will be available.

2 Likes

You need the complete code, including the part:

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

And you will also need to install Esphome Dev.
No need to uninstall the default version

We haven’t continued testing it lately as we’ve been working on more radars before, and things are looking good in the prototype.
I hope to integrate them when I have time next and see how things go.
:slight_smile:

1 Like

Good, my friend. Let me know about it. You inspired me in this project. I bought somes pieces to test too.

1 Like

We may not always be able to keep up with the forums, feel free to join one of our fb groups and if we have new developments we will share them on there.

1 Like

Ok, so onto my next LD2410 problem. Sometimes after a restart I don’t get any reported communication on the UART until I connect to the LD2410 via bluetooth! This happens with a LD2410B and LD2410C and with a ESP2866 and ESP32 (Lolin C3 mini). Just to be clear, this is after a HA restart OR after a LD2410/ESP restart, but as soon as I connect via bluetooth the UART bursts into life!

Oh and the problem I had with the Android App no getting the firmware updates, was due to all Chinese websites being blocked by me, DOH!

As has been said before both the LD2410B and LD2410C generate a lot of heat, so my little enclosure with lots of ventilation and with a temperature sensor is giving me a reading of 40C! I’ve drilled more holes for ventilation but it’s not making any appreciable difference. I was hoping to reduce the device count by combining functionality but i think I’m going to separate battery Zigbee environment sensors.

1 Like

Since we’ve recently built over a thousand DIY sensors for the ld2410c, I thought we’d share some of our suggestions: there are some minor improvements in the new firmware for serial port loss, but it may often happen after a long time of using Bluetooth to adjust parameters. It is a good ism to turn off the Bluetooth function after finishing the Bluetooth adjustment. Try adding the switch ld2410 in your firmware.

Using temperature and humidity sensors in esp32 and ld2410 would be bad, and it was in our experiments, that kind of interference is so huge that the possibility of simplicity is completely lost. Using a wire that isolates them by at least 20cm long is the only way to possibly reduce that effect.

In fact, even if it was just the esp32 and sht30, it would be very difficult to combine them well. And using some zigbee chips like cc2530 would be perfect, they hardly heat up.

Since the sensors we’ve shared lately we’ve often been asked about the app’s English and Chinese, as well as the system language. We feedback to the developers of ld2410 many times, yesterday, we got some new news about the app from the developers of HELENCO probably will be a good news for our friends all over the world, and I think this information may have some meaning for the community of enthusiasts as well:

Some progress from the LD2410 development team on the multi-language issue with the HLKRadarTool APP, we continued our feedback on the multi-language issue today, suggesting that they provide better support for English, and they seem to be taking it seriously, as we learned:

  • Some of the new features have not yet had time to be adapted to English and Chinese, the next version update, the system default language can be changed to English.
  • New features will be released this week that will fix these issues.
1 Like

Would you mind sharing esphome code for this?

I use this code in mine, it has a switch for bluetooth.

external_components:
  source: github://regevbr/esphome@ld2410
  components: [ld2410]
 
uart:
  id: ld2410_uart
  tx_pin: GPIO1
  rx_pin: GPIO3
  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
    g0_still_threshold:
      name: g0 still threshold
    g1_move_threshold:
      name: g1 move threshold
    g1_still_threshold:
      name: g1 still threshold
    g2_move_threshold:
      name: g2 move threshold
    g2_still_threshold:
      name: g2 still threshold
    g3_move_threshold:
      name: g3 move threshold
    g3_still_threshold:
      name: g3 still threshold
    g4_move_threshold:
      name: g4 move threshold
    g4_still_threshold:
      name: g4 still threshold
    g5_move_threshold:
      name: g5 move threshold
    g5_still_threshold:
      name: g5 still threshold
    g6_move_threshold:
      name: g6 move threshold
    g6_still_threshold:
      name: g6 still threshold
    g7_move_threshold:
      name: g7 move threshold
    g7_still_threshold:
      name: g7 still threshold
    g8_move_threshold:
      name: g8 move threshold
    g8_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

binary_sensor:
  - platform: ld2410
    has_target:
      name: "presence"
    has_moving_target:
      name: "movement"
    has_still_target:
      name: "still"
    out_pin_presence_status:
      name: out pin presence status
  - platform: gpio
    pin: 
      number: GPIO4
      inverted: true

    name: gpio out pin presence
    device_class: presence

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
    g0_still_energy:
      name: g0 still energy
    g1_move_energy:
      name: g1 move energy
    g1_still_energy:
      name: g1 still energy
    g2_move_energy:
      name: g2 move energy
    g2_still_energy:
      name: g2 still energy
    g3_move_energy:
      name: g3 move energy
    g3_still_energy:
      name: g3 still energy
    g4_move_energy:
      name: g4 move energy
    g4_still_energy:
      name: g4 still energy
    g5_move_energy:
      name: g5 move energy
    g5_still_energy:
      name: g5 still energy
    g6_move_energy:
      name: g6 move energy
    g6_still_energy:
      name: g6 still energy
    g7_move_energy:
      name: g7 move energy
    g7_still_energy:
      name: g7 still energy
    g8_move_energy:
      name: g8 move energy
    g8_still_energy:
      name: g8 still energy
    light:
      name: light

It been faultless for months. Here is where it came from

I think that main mistake of this app is that when native language of device is not english it switches to chinese. It should in fact switch to english, not chinese. I must change language of my phone each time i want to connect to LD, otherwise it’s in chinese.
Also…i still don’t have FW v2.5… shown in my app… ok, some guys say it breaks BT… what’s true in this story?