LD2410 esphome tips

@soubhik - I am using the PR version and did not have to merge anything. All I did was add the dev version of ESPHome to my install (it can coexist with the regular one) and then used the example YAML which pulls the needed code to program the ESP32.

The code that tells it where to get the integration that hasn’t been merged yet is:

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

Once it is merged into the released channel, I believe all that you need to do is remove the code above and re-upload the firmware.

2 Likes

Doesn anyone knows why this is not included in esphome yet? Today esphome 2023.5.0 is up, but this is still not included…?

Because the PR has not been merged.

That’s what i was asking… (why it was not included → why it was not merged yet, if it works…?)

I understand that only one can be controlled and set its parameters which is connected to rx tx to ld2410 respectively rx tx from esp 8266 and the rest just read clered or detected which are connected to the out pin from ld2410 and one gpio pin from esp8266?

I managed to get a LD2410C working with a Wemos D1 Mini Compatible ESP32 board and also got it to light up the internal blue LED when motion is detected. The LD2410C is connected using the UART pins (the pins marked TX and RX on the D1 Mini ESP32 board didn’t work and I had to use GPIO16 and GPIO17). Also the Bluetooth Proxy has been enabled for Home Assistant.

If it will help anyone, here is my config which got the LED working:

substitutions:
  name: "esp32-motion-sensor"

esphome:
  name: ${name}
  name_add_mac_suffix: false

api:
ota:

logger:
  level: INFO
  baud_rate: 0

esp32:
  board: esp32dev
  framework:
    type: esp-idf

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
  active: true
  cache_services: false

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

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

ld2410:
  uart_id: ld2410_uart

binary_sensor:
  - platform: ld2410
    has_target:
      name: Presence
    has_moving_target:
      name: Moving Target
      on_press:
        then:
          - light.turn_on: led
      on_release:
        then:
          - light.turn_off: led
    has_still_target:
      name: Still Target

output:
  - platform: ledc
    id: onboard_led
    pin:
      number: GPIO2
      inverted: false

light:
 - platform: monochromatic
   name: "Onboard LED"
   output: onboard_led
   id: led

4 Likes

On ESP32, you may use almost any pins for UART. However, hardware UART pins are recommended for faster speed.

Also, you don’t need to switch serial logging off - ESP32 has 3 UARTs, so you’re good having both sensor and logger. Nevertheless, i had problems with using all 3 UARTs on some ESP32 Mini boards, but on other they work fine, all 3.

P.S. I don’t see that you use UART at all - just binary sensor, which is working without UART anyways.

Thanks for the feedback. I used GPIO16 and GPIO17 as the pinouts for my board seems to match the following diagram and it corresponds with UART2.

I also did have the distance and energy level sensors working but I removed them as they were creating lots of chatter to Home Assistant with the distance and energy levels constantly updating while I was in the room.

sensor:
  - platform: ld2410
    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


Yes, you did it right. IO16/17 are good. But if you don’t plan to use that energy stuff and fine-tuning gate thresholds, you don’t need UART. :slight_smile:

As I have the LD2410C with bluetooth, I found it much easier to use the Android app and connect to it directly via bluetooth to fine tune the gate thresholds and settings rather than setting them in the yaml and having to upload it to the ESP32 board each time.
Wouldn’t I still need to use the UART to get the data for Move Target and Still Target binary sensors?

Yeah you need it, sorry to be unclear. I meant, there’s 5th pin on sensor, and it provides simple binary sensor of presence (without moving/still, joined one). In that case you can use it directly, without UART.

Using gpio binary pins seems to be a good idea and works well in many places. But one also needs to be aware that the delayed off time in the parameter settings can become bothersome.

Very true. The delayed off time for presense (combined move and static) can be configured on the LD2410. I have connected it to an ESP32 using the UART as that way I can directly access the move target sensor which responds very quickly.

I can read at least 2 persons writing that the android app is in English, but I can’t locate / convert it to English.

Any help on this?
Thanks

App is (automatically) in english only if device (phone) language is set to english.

1 Like

Thanks!, i just found it.

I will now try to understand the values…

I attached the LD2410 to a door, and i want to detect the movement through this door. let’s see if i can xD

I got it to work with an ESP32 with one LD2410 over UART, now I would like to connect two or three LD2410 over UART to one ESP32 - how do I configure that in ESPhome (if it is possible)?

I’d agree that the LD2410B doesn’t play well with fans, even if the fan is outside the documented 60˚ cone of detection.

I have an LD2410B on the ceiling, with fan blades as close as 0.8m away and at the same height. The sensor shows an almost continuous moving target peaking at about 4m away, and a strong static target across the full range of 1.5m to 6m. I see no way to filter that out.

I’d guess fans, wind, curtain movement, and the like are problems for many home settings. I’d love to hear if anyone is able to effectively use these devices when dealing with such factors.

1 Like

Have you tested with the code from this link?

Install the dev version of esphome.
You will see which gate is having the most interference from the fan.

1 Like

I have not. I’ve only looked at it via the HiLink phone app + bluetooth. I’m currently using it with HA via Bluetooth and a bluetooth proxy (with all it’s reconnect problems). I only became aware yesterday that connected (via wires), LD2410 support has significant updates that are not released yet.