LD2410 esphome tips

Can you test it with a serial to usb adapter and a computer?
Have you crossed the TX and RX connections?
Does the digital output work as expected?
Are you powering it up with 5V?
I think you have to disable serial logging in the yaml configuration.

That should be a good starting point.

Good luck.

Marco

I have exactly same setup (D1 Mini 32) and was able to make it work using below uart config:

uart:
  id: uart1
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 256000
  data_bits: 8
  stop_bits: 1
  parity: NONE

Important: In order to make it work I had to make following connection:

D1 Mini RX <---> LD2410 RX
D1 Mini TX <---> LD2410 TX

Very strange I know, but it works!

Ciao Marco!

Can you test it with a serial to usb adapter and a computer?

  • Yes I tested it with a USB to serial adapter and the Windows application was able to configure it, etc,

Have you crossed the TX and RX connections?

  • Yes

Does the digital output work as expected?

  • Yes

Are you powering it up with 5V?

  • Yes

I think you have to disable serial logging in the yaml configuration.

  • This is what I have for that:
logger:
  baud_rate: 0

@lukcz Unfortunately I cannot use 1 and 3 as it is already in use by a Particulate Matter sensor… I can only use the pins on the outer rows as show in the pinout picture above.

Is it a typo or you had to connect RX to RX and TX to TX? That should not work as the have to be inverted… Either way, I always test both ways in case the documentation is bad or whatever else :wink:

Can you, just for testing purposes, use pins 1 and 3?

Marco

I tried using a different Wemos D1 Mini 32 and LC2410C with reduced code configured to use the hardware UART on the D1 Mini 32, which should handle the 256000 baud unlike the other pins (from what I’ve read)… but it appears to crash immediately as I get no logs and HA doesn’t even discover it. As soon as I remove all the LD2410 code, it is discovered just fine. While, on the other setup with the same type of board, it doesn’t crash it but simply won’t work.

On a side note, I had the sensor working using an ESP32 S2 Mini and the native HA integration but unfortunately I cannot use that board in this device due to pinout (it was designed for an 8266). I therefore wanted to try the custom component by rain931215 because it allows to use slower baud rates which I assumed would help with making this work on pins other than the hardware UART. The native integration seems to require 256000 (I get an error saying it has to be 256000 if I try anything else).

Likely, but at that point I might as well purchase the dev board and configure every one of the chips I bought via uart. :joy:

I’ll stick to Wemos D1 Mini 8266s that I have lying around + UART for now.

Hello guys,

I have ld2410b sensors that I update to version 2.04.23022511 through the HLKRadar-Tool application, but I also have some ld2410 without bluetooth that are at version 1.07.22082218 and I don’t know how I can take them to version 2.04…

I use this yaml version Add configuration flow abilites to the ld2140 component by regevbr · Pull Request #4434 · esphome/esphome · GitHub

Thanks

1 Like

There are some interesting cases regarding ld2410 without suffixes:

  • It and the ld2410b seem to have just a number of components missing in hardware, but the chips are almost identical.
  • Its OP seems to have updated firmware capability at the moment.

And the ld2410b(c)'s firmware update capability no doubt comes from the Bluetooth serial port as well. So the ld2410 should have the ability to update firmware, but it’s quite a hassle and hilink doesn’t seem to be open to ways of doing so.

We sent an issue to hilink on this issue to see how they answer the question.

2 Likes

Can some one please point me to what size header pins/connectors are used for the LD2410B.
Thank you

@carltonb 1.27mm pin spacing, but from what I have read, it looks like connectors with 1.25mm spacing seem to work too. I have seen reports of several different connector variants used by people.

1 Like

I don’t know what I have done incorrectly. I just copy the LD2410 official code and change my credential settings, but it doesn’t work. It would show a few state changes, then it stopped. No more response. It seems the LD2410 just burn out. I’ve tried 2 new LD2410.

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 came across this code in this thread some time ago. I have tried to use it but it comes up with all kind of issues.

So what i am asking is, is it possible to use this code in esphome or do I need to install one of the beta or dev branches of esphome to use it? Or is there something else I am missing?

What issues? Logs.

well I just quickly threw in the code and this comes out in the logs.

INFO Reading configuration /config/esphome/testradar.yaml...
Failed config

ld2410: [source /config/esphome/testradar.yaml:40]
  - uart_id: ld2410_uart
    
    [throttle] is an invalid option for [0]. Please check the indentation.
    throttle: 1500ms
binary_sensor.ld2410: [source /config/esphome/testradar.yaml:45]
  platform: ld2410
  has_target: 
    name: Presence
  has_moving_target: 
    name: Moving Target
  has_still_target: 
    name: Still Target
  
  [out_pin_presence_status] is an invalid option for [binary_sensor.ld2410]. Please check the indentation.
  out_pin_presence_status: 
    name: out pin presence status
sensor.ld2410: [source /config/esphome/testradar.yaml:56]
  platform: ld2410
  
  [light] is an invalid option for [sensor.ld2410]. Please check the indentation.
  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] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g0_move_energy: 
    name: g0 move energy
  
  [g0_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g0_still_energy: 
    name: g0 still energy
  
  [g1_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g1_move_energy: 
    name: g1 move energy
  
  [g1_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g1_still_energy: 
    name: g1 still energy
  
  [g2_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g2_move_energy: 
    name: g2 move energy
  
  [g2_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g2_still_energy: 
    name: g2 still energy
  
  [g3_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g3_move_energy: 
    name: g3 move energy
  
  [g3_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g3_still_energy: 
    name: g3 still energy
  
  [g4_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g4_move_energy: 
    name: g4 move energy
  
  [g4_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g4_still_energy: 
    name: g4 still energy
  
  [g5_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g5_move_energy: 
    name: g5 move energy
  
  [g5_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g5_still_energy: 
    name: g5 still energy
  
  [g6_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g6_move_energy: 
    name: g6 move energy
  
  [g6_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g6_still_energy: 
    name: g6 still energy
  
  [g7_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g7_move_energy: 
    name: g7 move energy
  
  [g7_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g7_still_energy: 
    name: g7 still energy
  
  [g8_move_energy] is an invalid option for [sensor.ld2410]. Did you mean [moving_energy]?
  g8_move_energy: 
    name: g8 move energy
  
  [g8_still_energy] is an invalid option for [sensor.ld2410]. Did you mean [still_energy]?
  g8_still_energy: 
    name: g8 still energy
switch.ld2410: [source /config/esphome/testradar.yaml:107]
  
  Platform not found: 'switch.ld2410'.
  platform: ld2410
  engineering_mode: 
    name: engineering mode
  bluetooth: 
    name: control bluetooth
    number: 
switch.ld2410: [source /config/esphome/testradar.yaml:114]
  
  Platform not found: 'switch.ld2410'.
  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
  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
button.ld2410: [source /config/esphome/testradar.yaml:161]
  
  Platform not found: 'button.ld2410'.
  platform: ld2410
  factory_reset: 
    name: factory reset
  restart: 
    name: restart
  query_params: 
    name: query params
text_sensor.ld2410: [source /config/esphome/testradar.yaml:170]
  
  Platform not found: 'text_sensor.ld2410'.
  platform: ld2410
  version: 
    name: firmware version
  mac_address: 
    name: mac address
select.ld2410: [source /config/esphome/testradar.yaml:177]
  
  Platform not found: 'select.ld2410'.
  platform: ld2410
  distance_resolution: 
    name: distance resolution
  baud_rate: 
    name: baud rate
  light_function: 
    name: light function
  out_pin_level: 
    name: out pin level

Which led me to think I needed something else?

The sensor is working fine on this code.

the yaml code is

esphome:
  name: testradar
  friendly_name: Testradar

esp8266:
  board: nodemcuv2

# Enable logging
logger:

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

ota:
  password: "stuff"

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

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

captive_portal:

uart:
  id: ld2410_uart
  tx_pin:
    number: GPIO1
  rx_pin: 
    number: GPIO3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  uart_id: ld2410_uart
  throttle: 1500ms

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

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

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

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

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"    

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  

web_server:
  port: 80
  version: 2
  include_internal: true
  ota: true

What version of esphome are you using?

2023.3.2

I also tried the beta version with the same results.

Just a thought I am trying this with ld2410c if that makes a difference.

The only reply I received was that I couldn’t ota update, which is really strange.
image

The official component is not able to use light, we modified a library to support this by turning on project mode, but you obviously have to remove this if you are using the official library.
According to the documentation on the official page, you should reduce a lot of the options in there.

[light] is an invalid option for [sensor.ld2410]. Please check the indentation.

The code for this section should be in a separate ld2410, not in the sensor.
In fact, if you use ld2410b or ld2410c and use Bluetooth to adjust the parameters, then all this code for fixed parameters can be removed. Otherwise restarting the esp32 after the Bluetooth adjustment will cause the parameters to be reset again.

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