LD2410 esphome tips

it could be workaround for this case also, thanks for idea

by the way, why are you using “has_still_target” instead of “has_target” (presence) entity in your automations?
As I noticed - still target can switch with the moving target trigger, while “Presence” is always triggered when move/still are active

Because my move sensor is pretty well calibrated and used for quick response automations.

The still presence is in charge of turning things off, so that doesn’t have to be quick, only needs to be accurate.

Can’t figure out one thing about ld2410 esphome component.
Does it can trigger “Still / Presence” state to “on” if no “move” state was triggered? Or it only holds “Presence” after “move” was triggered at first?

Ok, made some “in field” investigation.
Seems that “Out Pin” and “Presence” and “Still” never get “ON” untill “Movement” is triggered.
After movement triggered - “Out Pin” and “Presence” are holding “ON” untill Still or Movement is active. After reset - you must trigger “move” again to get them “ON”. Another way still energy on configured gate could be even 100% with no “Presence” triggered.
The “Out Pin” is fastest way to get “Presence” state (visually notocable reaction diff in HA via API)

Out pin is the sum of both still and move iirc reading the original mandarin docs somewhere.

The still and move sensors are usually correlated (due to movement) but are independent otherwise.

My Lolin D1 mini v4 dont work with ld2410, no matter what I do, it doesn’t work. Unknown values.

But I found a strange behauvior, when I disconnect the usbc cable, it shows a few measures… So i tried to unplug A LITTLE the usbc cable… or vice versa, plug the cable slowly until it flashes the blue light and stop there… et voila!! LD2410 working with d1 mini v4. Sooo weird…

Logger:
baud_rate: 0

Is present in your config?

This is all I have regarding the configuration.

logger:
  baud_rate: 0

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

ld2410:
  id: "mmwave"

Which pins physically you use on d1 mini?
The only one you have to use is TX and RX marked on the board. And you can name them accordingly in config:
RX
TX

And one more thing, counting high uart load of esp8266 with single uart - it would be better to disconnect usb data cable after flashing and just plug power cable usb (not to pc or smith) to free the uart bus.

P.S. Oh, was looking your answer from phone and missed config at full.
If this is ALL you have in jaml for you ld2410 - it’s totally empty…

Pins are Tx and Rx

Always flashed wireless

On all my 8266 I need to put the pin in GPIO format, naming TX, RX, D2, etc, dont work, I don’t know why…

This is my full code:

esphome:
  name: 2410-8266
  friendly_name: 2410 8266

esp8266:
  board: esp01_1m


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

ota:
  password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "2410-8266 Fallback Hotspot"
    password: "xxxxxxxxxxxxxx"

captive_portal:

logger:
  baud_rate: 0

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

ld2410:
  id: "mmwave"

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 

  # - platform: gpio
  #   pin: D6
  #   name: gpio out pin presence
  #   device_class: presence         

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

  - platform: wifi_signal 
    name: Wifi Signal
    id: wifi_signal_db
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    update_interval: 60s
    unit_of_measurement: "%"
    entity_category: "diagnostic"


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

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

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


button:
  - platform: restart
    icon: mdi:power-cycle
    name: "ESP Reboot"   
  - platform: ld2410
    restart:
      name: "restart"
    query_params:
      name: query params

maybe because you don’t use

esp8266:
board: d1_mini

1 Like

Damn, I’m dumb, thanks!!

and, it’s not about the OTA - you shouldn’t power up d1_mini from you PC for tests, it establishes serial connection and ld2410 data faults (had this problem by meself while testing).
Only ordinary USB charger from outlet

Didn’t say I power my d1’s from pc, after flashed esphome I always update them connected to a 5v wall charger.

My problem was that if I plugged the USB all the way in, the values came out as “unknown”, but if I connect it slightly, everything works correctly. Tried different cables and chargers, same result.

The strange thing is that this is the only sensor / device that has this weird behavior.

Hello,
I noted that after a blackout I need to manualy reboot the LD2410 to restore the correct configuration like Timeout.

image

It is possible to it automatically or to put in tha config file the value of the parameter (e.g Timeout = 10 s)?

The esp8266 is most certainly and 100% 5v tolerant on the GPIO’s. Might work for a while and suddenly say Bye Bye? wrong, wrong, wrong and everyone who’s spent more than 5 minutes learning to use one or even reading about one, even they know this basic fact. That’s a pretty big one to get wrong…

Help,
I have permanently detected presence on my ld2410, as G2 Still is always at 100%. But I can’t explain why, as I have 2 other ld2410s in use that work perfectly



EDIT:
Don’t ask me how, but now everything is working as it should without me having to change anything. Had to restart HA several times due to a ZHA problem. That probably helped. Thanks anyway!

Almost all the LD2410 configs for ESPhome seem to instrument all of the sensors. I don’t want to deal with this complexity in Haas, and I also wanted to simplify my wiring. I have have not seen anyone share working examples of using the “out” pin of the LD2410C so hopefully this working config will help someone:

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

ld2410:
  uart_id: ld2410_uart
  id: mmwave

binary_sensor:
  - platform: gpio
    pin: GPIO3
    name: mmWave presence
    device_class: presence

The LD2410C is wired up on the ESP32 C3 Supermini to:

  • Vcc to 5V
  • GND to GND
  • Out to GPIO3

Since the LD2410C supports Bluetooth I use the HLKRadarTool app on Android or IOS to view the more granular metrics and to do fine tuning of the sensitivity.

All in this is a great setup in a very small form factor.

2 Likes