Configureer ESP functie voor LD2410

Voorbereiding: ESPHome Builder Integratie


Als ESP-module gebruik ik hier de Wemos D1 mini v3 . Installeer deze in ESPHome met default instellingen. Hoe je dat doet kun je hier lezen.

Als presence sensor gebruik ik de LD2410C:

Er zijn verschillende modellen van deze module en de LD2410C heeft ‘normale’ pin aansluitingen, de LD2410 en LD2410B zijn voorzien van mini-pins en dat is minder handig om aan te sluiten. Daarnaast zijn de modellen B en C tevens voorzien van bluetooth.

Voeg nu deze configuratie onderaan toe, zodat de LD2410 opties er ook in staan, bijvoorbeeld:

uart:
  id: uart_0
  tx_pin: TX
  rx_pin: RX
  baud_rate: 256000 # Change this according to your setting
  parity: NONE
  stop_bits: 1
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: [0xF8,0xF7,0xF6,0xF5]
            
ld2410:

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

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

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

Kies rechtsboven voor SAVE en INSTALL om de configuratie in de ESP te schrijven, dit kan ‘Wirelessly‘.

Hierna kan de LD2410C gekoppeld worden aan de ESP-module, let op dat de Rx en Tx op de ESP aan respectievelijk Tx en Rx op de LD2410 moet worden aangesloten! (zie schema hieronder)

ESP8266 <-> LD2410
5V <-> VCC
GND <-> GND
TX <-> RX
RX <-> TX

Voorzie de ESP32 van spanning middels een usb-kabel en Home Assistant komt dan met een melding dat er een nieuw device is gevonden:

Met VOEG TOE worden de sensors aangemaakt en deze kunnen dan in een Dashboard gebruikt worden of in Automatiseringen, Scènes of Scripts.

De DIAGNOSE resultaten worden getoond in de Engineering-mode. In de Engineering-mode kunnen de verschillende threshold-waardes voor G0 t/m G8 aangepast worden tot het beste resultaat is bereikt. Daarna dient de Engineering-mode weer uitgezet te worden.