Build a smaller human body radar sensor using ESP32-S2 and LD2410C

Yea, once I connected to esphome it turned off.

I have 2 ESP32 S2 mini and have setup using the LD2410C sensor. One of the S2 disconnects from wifi at random time once it is power up. Only way to reconnect is either reset button or re plug in the power. Is this one faulty? The other S2 stays connected or at least it reconnects when it looses wifi connection.

Have anyone tried adding (2) LD2410C sensors to (1) S2 mini board???

There are some clones of the S2 mini with shrunken parts that can affect wifi performance, setting the wifi power consumption to energy saving will help.

Is there another version framework I can try to figure out why the device disconnects from wifi and never regain connection again? I have tried many settings and even desolder the sensor from the board, but still disconnect.

Update: I think I figure out the issue. Removing the the web_server seems to helped the disconnects. Testing for over 15 hours and still connected.

Are you referring to setting up 2 LD2410C? I tried, but I cannot get both sensors to work at one time.

substitutions:
  name: entry-human-sensor
  hlk1: hallway
  hlk2: genkan

esphome:
  name: $name
  platformio_options:
    board_build.flash_mode: dio
    board_build.f_cpu: 80000000L
    board_build.extra_flags:
      - "-DARDUINO_USB_CDC_ON_BOOT=0" 

  on_boot:
    priority: 900
    then:
       lambda: |-
        id(cpu_speed) = ESP.getCpuFreqMHz() ;
  project: 
    name: Screek.Human Presence Sensor
    version: 1U
  min_version: 2023.6.1

globals:
   - id: cpu_speed
     type: int
     restore_value: no
     initial_value: '0'

external_components:
  - source:
      type: git
      url: https://github.com/screek-workshop/custom_components_support_for_screek_1u
      ref: master

esp32:
  board: lolin_s2_mini
  framework:
    type: arduino
    version: 2.0.9
    platform_version:  6.3.2

improv_serial:

logger:
  hardware_uart: uart0

wifi:
  ssid: !secret ssid
  password: !secret ssid_pwd
  power_save_mode: none

captive_portal:

api:
  encryption:
    key: !secret esphome_apikey

ota:
  - platform: esphome
    password: !secret ota_pass

binary_sensor:
  - platform: ld2410 
    ld2410_id: ld2410_1
    has_target:
      name: $hlk1 Presence
    has_moving_target:
      name: $hlk1 Moving Target
    has_still_target:
      name: $hlk1 Still Target
  - platform: ld2410 
    ld2410_id: ld2410_2
    has_target:
      name: $hlk2 Presence
    has_moving_target:
      name: $hlk2 Moving Target
    has_still_target:
      name: $hlk2 Still Target

  - platform: status
    name: $name Online

sensor:
  - platform: template
    name: $name ESP Cpu Speed
    accuracy_decimals: 0
    unit_of_measurement: Mhz
    lambda: |-
      return (id(cpu_speed));
    entity_category: "diagnostic"

  - platform: template
    id: sys_esp_temperature
    name: $name ESP Temperature
    lambda: return temperatureRead();
    unit_of_measurement: °C
    device_class: TEMPERATURE
    update_interval: 5s
    entity_category: "diagnostic"

  - platform: uptime
    name: $name Uptime
    id: sys_uptime
    update_interval: 10s

  - platform: wifi_signal 
    name: $name RSSI
    id: wifi_signal_db
    update_interval: 5s
    entity_category: "diagnostic"

  - platform: template
    id: esp_memory
    icon: mdi:memory
    name: $name ESP Free Memory
    lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
    unit_of_measurement: 'kB'
    state_class: measurement
    entity_category: "diagnostic"

  - platform: ld2410
    ld2410_id: ld2410_1
    moving_distance:
      name: $hlk1 Moving Distance
    still_distance:
      name: $hlk1 Still Distance
    moving_energy:
      name: $hlk1 Move Energy
    still_energy:
      name: $hlk1 Still Energy
    detection_distance:
      name: $hlk1 Detection Distance
    light:
      name: $hlk1 Sun Light

  - platform: ld2410
    ld2410_id: ld2410_2
    moving_distance:
      name: $hlk2 Moving Distance
    still_distance:
      name: $hlk2 Still Distance
    moving_energy:
      name: $hlk2 Move Energy
    still_energy:
      name: $hlk2 Still Energy
    detection_distance:
      name: $hlk2 Detection Distance
    light:
      name: $hlk2 Sun Light

light:
  - platform: status_led
    name: $name sys_status
    pin: GPIO15
    internal: True
    restore_mode: ALWAYS_OFF

time:
  - platform: sntp
    id: time_sntp

uart:
  - id: uart_0 
    tx_pin: GPIO18 #18
    rx_pin: GPIO33 #33
    baud_rate: 256000
    parity: NONE
    stop_bits: 1

  - id: uart_1
    tx_pin: GPIO12
    rx_pin: GPIO11
    baud_rate: 256000
    parity: NONE
    stop_bits: 1


ld2410:
  - id: ld2410_1 
    timeout: 150s
    uart_id: uart_0

  - id: ld2410_2 
    timeout: 150s
    uart_id: uart_1


button:
  - platform: template
    name: "$hlk1 Enable LD2410 BLE"
    # disabled_by_default: True
    entity_category: "config"
    icon: mdi:bluetooth
    on_press:
      lambda: |-
        id(ld2410_1) -> ble_control(true);
  - platform: template
    name: "$hlk1 Disable LD2410 BLE"
    # disabled_by_default: True
    entity_category: "config"
    icon: mdi:bluetooth-off
    on_press:
      lambda: |-
        id(ld2410_1) -> ble_control(false);
  - platform: template
    name: "$hlk1 LD2410 Reboot"
    icon: mdi:radar
    entity_category: "config"
    on_press:
      lambda: |-
        // auto* radar = LD2410Component::get(ld2410); 
        // radar -> roboot();
        id(ld2410_1) -> reboot();

  - platform: template
    name: "$hlk2 Enable LD2410 BLE"
    # disabled_by_default: True
    entity_category: "config"
    icon: mdi:bluetooth
    on_press:
      lambda: |-
        id(ld2410_2) -> ble_control(true);
  - platform: template
    name: "$hlk2 Disable LD2410 BLE"
    # disabled_by_default: True
    entity_category: "config"
    icon: mdi:bluetooth-off
    on_press:
      lambda: |-
        id(ld2410_2) -> ble_control(false);
  - platform: template
    name: "$hlk2 LD2410 Reboot"
    icon: mdi:radar
    entity_category: "config"
    on_press:
      lambda: |-
        // auto* radar = LD2410Component::get(ld2410); 
        // radar -> roboot();
        id(ld2410_2) -> reboot();

  - platform: restart
    icon: mdi:power-cycle
    name: "$name ESP Reboot"

  - platform: factory_reset
    disabled_by_default: True
    name: $name Factory Reset
    id: factory_reset_all

This may be partly the reason, reducing the burden on the wifi, but the key part may still be in the hardware. The quality of some s2 mini is very poor, and poor parts are used.
In other cases, lowering the transmission power via the wifi settings is also an option.

Sorry, we do not try to set two sensors at the same time.
In theory, they should work simultaneously, just parsing two sets of serial protocols.
From your yaml code, I see that the wifi part is set to power_save_mode: none, which may be part of the reason why your wifi drops.
Are there any error logs for the two groups not being able to work at the same time?

I suspect the device is partly bad because I have another s2 mini with exactly the same setup. Runs fine with the stock code. The device has taken a beaten now. The solder joints has worn out, I had to bridge the tx/rx pins to another via wires to get it working.

I need to reword what I said. Only uart_0 works. If I set the sensor on uart_1 pins, the sensor stays unknown. Do you see anything wrong with the code why it shouldn’t work? I didn’t see any errors in log. Though the log has been set as to your code. I did not change it.