HLK-LD2410C com Nodemcu V3 - EspHome

Bom dia

estou fazendo integração do Nodemcu V3 com o HLK-LD2410C
Consegui tudo corretamente. Mas os sensores so mostram os dados como DESCONHECIDO.

Codigo

========================================
esphome:
name: hlk-ld2410-b
friendly_name: HLK-LD2410-B

esp8266:
board: esp01_1m

Enable logging

logger:
baud_rate: 0

Enable Home Assistant API

api:
encryption:
key: “U6u25+ZeL6ATVGZhZX/sCjvZumao33i+m0oK6+NUdYU=”

ota:
password: “b318ef1fd91a0ca44d6449d23d6c4e39”

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

uart:
tx_pin: 1
rx_pin: 3
baud_rate: 256000
parity: NONE
stop_bits: 1

ld2410:
timeout: 150s
max_move_distance : 6m
max_still_distance: 0.75m
g0_move_threshold: 10
g0_still_threshold: 20
g1_move_threshold: 10
g1_still_threshold: 20
g2_move_threshold: 20
g2_still_threshold: 21
g3_move_threshold: 30
g3_still_threshold: 31
g4_move_threshold: 40
g4_still_threshold: 41
g5_move_threshold: 50
g5_still_threshold: 51
g6_move_threshold: 60
g6_still_threshold: 61
g7_move_threshold: 70
g7_still_threshold: 71
g8_move_threshold: 80
g8_still_threshold: 81

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

binary_sensor:

  • platform: ld2410
    has_target:
    name: Presence
    has_moving_target:
    name: Moving Target
    has_still_target:
    name: Still Target
    =======================================================

Alguem pode ajudar ?

Tenho quase certeza que o modelo C ainda não tem suporte nativo no esphome.

No fórum internacional acho que tem um código para o modelo C.

Obs quando for postar o código coloque ```` antes e depois do código para a formatação fique correta.

Walber a pinagem é a mesma do

Suporta igualmente o modelo A e o Modelo C

O sensor usa comunicação via uart, mas isso não quer dizer que os dados transmitidos são os mesmos.
O ld2410 e o ld2410b são iguais sendo a única diferença que o B tem Bluetooth.
O C é outro sensor.
----‐--------

Vc cruzou os pinos rx tx?

Posta o log do esphome, provavelmente o esp não achou o sensor.

Eu não consegui fazer o modelo B comunicar com o 8266, apenas com o 32. E muitas pessoas tem a mesma dificuldade.

E aparentemente sua placa está configurada errada.

board: esp01_1m

Walber

Cruzei os pinos.
O log não lista nenhum erro - é perfeito.

Eu segui todos os passos deste vídeo COMO Integrar o Sensor LD2410C com o NodeMCU via Home Assistant - YouTube

Só para ficar claro, o log que falei seria da placa e não do addon.

Caso seja esse log que vc verificou então ignore.

[11:09:15][C][logger:301]: Logger:
[11:09:15][C][logger:302]:   Level: DEBUG
[11:09:15][C][logger:303]:   Log Baud Rate: 115200
[11:09:15][C][logger:305]:   Hardware UART: UART0
[11:09:15][C][uart.arduino_esp32:124]: UART Bus 1:
[11:09:15][C][uart.arduino_esp32:125]:   TX Pin: GPIO17
[11:09:15][C][uart.arduino_esp32:126]:   RX Pin: GPIO16
[11:09:15][C][uart.arduino_esp32:128]:   RX Buffer Size: 256
[11:09:15][C][uart.arduino_esp32:130]:   Baud Rate: 256000 baud
[11:09:15][C][uart.arduino_esp32:131]:   Data Bits: 8
[11:09:15][C][uart.arduino_esp32:132]:   Parity: NONE
[11:09:15][C][uart.arduino_esp32:133]:   Stop bits: 1
[11:09:15][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'gpio out pin presence'
[11:09:15][C][gpio.binary_sensor:015]:   Device Class: 'presence'
[11:09:15][C][gpio.binary_sensor:016]:   Pin: GPIO19
[11:09:15][C][ld2410:020]: LD2410:

O modelo C tem BT? Se sim vc conseguiu conectar e verificar o funcionamento com o APP?

Eu uso o código abaixo, ele tem mais opções, mas vc tem que instalar o esphome DEV para usar

esphome:
  name: suite
  friendly_name: Suite

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxx="
  services:
    - service: set_ld2410_bluetooth_password
      variables:
        password: string
      then:
        - bluetooth_password.set:
            id: ld2410_comp
            password: !lambda 'return password;'
ota:
  password: "xxxxxxxxxxxxxxxx"

wifi:
  ssid: IOT
  password: !secret wifi_password

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

captive_portal:

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

uart:
  id: ld2410_uart
  tx_pin: GPIO17 # amarelo
  rx_pin: GPIO16 # verde
  # tx_pin: GPIO15 
  # rx_pin: GPIO13   
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

ld2410:
  uart_id: ld2410_uart
  #throttle: 1000ms
  id: ld2410_comp

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

button:
  - platform: ld2410
    factory_reset:
      name: "factory reset"
    restart:
      name: "restart"
    query_params:
      name: query params

number:
  - platform: ld2410
    timeout:
      name: timeout
    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
    light_threshold:
      name: light threshold

text_sensor:
  - platform: ld2410
    version:
      name: "presenece sensor version" 
    mac_address:
      name: "presenece sensor mac address"
      internal: true

switch:
  - platform: ld2410
    engineering_mode:
      name: "engineering mode" 
    bluetooth:
      name: control Bluetooth
      internal: true
      
binary_sensor:
  - platform: ld2410
    has_target:
      name: "presence"
    has_moving_target:
      name: "movement"
    has_still_target:
      name: "still"
    out_pin_presence_status:
      name: out pin presence status
  - platform: gpio
    pin: GPIO19
    name: gpio out pin presence
    device_class: presence

sensor:
  - platform: ld2410
    moving_distance:
      name: "Moving distance (cm)"
    still_distance:
      name: "Still Distance (cm)"
    moving_energy:
      name: "Move Energy (%)"
    still_energy:
      name: "Still Energy (%)"
    detection_distance:
      name: "Distance Detection (cm)"
    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
    light:
      name: light

Vc testou outros pinos?
Posta foto da sua ligação

Bloco de Citação
INFO ESPHome 2023.5.5
INFO Reading configuration /config/esphome/hlk-ld2410-b.yaml…
INFO Starting log output from 192.168.1.137 using esphome API
INFO Successfully connected to 192.168.1.137
[09:47:42][I][app:102]: ESPHome version 2023.5.5 compiled on Jun 13 2023, 21:33:11
[09:47:42][C][wifi:505]: WiFi:
[09:47:42][C][wifi:363]: Local MAC: AC:0B:FB:DA:97:53
[09:47:42][C][wifi:364]: SSID: [redacted]
[09:47:42][C][wifi:365]: IP Address: 192.168.1.137
[09:47:42][C][wifi:366]: BSSID: [redacted]
[09:47:42][C][wifi:368]: Hostname: ‘hlk-ld2410-b’
[09:47:42][C][wifi:370]: Signal strength: -68 dB ▂▄▆█
[09:47:42][C][wifi:374]: Channel: 8
[09:47:42][C][wifi:375]: Subnet: 255.255.255.0
[09:47:42][C][wifi:376]: Gateway: 192.168.1.1
[09:47:42][C][wifi:377]: DNS1: 0.0.0.0
[09:47:42][C][wifi:378]: DNS2: 0.0.0.0
[09:47:42][C][logger:301]: Logger:
[09:47:42][C][logger:302]: Level: DEBUG
[09:47:42][C][logger:303]: Log Baud Rate: 0
[09:47:42][C][logger:305]: Hardware UART: UART0
[09:47:42][C][uart.arduino_esp8266:102]: UART Bus:
[09:47:42][C][uart.arduino_esp8266:103]: TX Pin: GPIO1
[09:47:42][C][uart.arduino_esp8266:104]: RX Pin: GPIO3
[09:47:42][C][uart.arduino_esp8266:106]: RX Buffer Size: 256
[09:47:42][C][uart.arduino_esp8266:108]: Baud Rate: 256000 baud
[09:47:42][C][uart.arduino_esp8266:109]: Data Bits: 8
[09:47:42][C][uart.arduino_esp8266:110]: Parity: NONE
[09:47:42][C][uart.arduino_esp8266:111]: Stop bits: 1
[09:47:42][C][uart.arduino_esp8266:113]: Using hardware serial interface.
[09:47:42][C][ld2410:012]: LD2410:
[09:47:42][C][ld2410:014]: HasTargetSensor ‘Presence’
[09:47:42][C][ld2410:014]: Device Class: ‘occupancy’
[09:47:42][C][ld2410:015]: MovingSensor ‘Moving Target’
[09:47:42][C][ld2410:015]: Device Class: ‘motion’
[09:47:42][C][ld2410:016]: StillSensor ‘Still Target’
[09:47:42][C][ld2410:016]: Device Class: ‘occupancy’
[09:47:42][C][ld2410:019]: Moving Distance ‘Moving Distance’
[09:47:42][C][ld2410:019]: Device Class: ‘distance’
[09:47:42][C][ld2410:019]: State Class: ‘’
[09:47:42][C][ld2410:019]: Unit of Measurement: ‘cm’
[09:47:42][C][ld2410:019]: Accuracy Decimals: 0
[09:47:42][C][ld2410:020]: Still Distance ‘Still Distance’
[09:47:42][C][ld2410:020]: Device Class: ‘distance’
[09:47:42][C][ld2410:020]: State Class: ‘’
[09:47:42][C][ld2410:020]: Unit of Measurement: ‘cm’
[09:47:42][C][ld2410:020]: Accuracy Decimals: 0
[09:47:42][C][ld2410:021]: Moving Energy ‘Move Energy’
[09:47:42][C][ld2410:021]: Device Class: ‘energy’
[09:47:42][C][ld2410:021]: State Class: ‘’
[09:47:42][C][ld2410:021]: Unit of Measurement: ‘%’
[09:47:42][C][ld2410:021]: Accuracy Decimals: 0
[09:47:42][C][ld2410:022]: Still Energy ‘Still Energy’
[09:47:42][C][ld2410:022]: Device Class: ‘energy’
[09:47:42][C][ld2410:022]: State Class: ‘’
[09:47:42][C][ld2410:022]: Unit of Measurement: ‘%’
[09:47:42][C][ld2410:022]: Accuracy Decimals: 0
[09:47:42][C][ld2410:023]: Detection Distance ‘Detection Distance’
[09:47:42][C][ld2410:023]: Device Class: ‘distance’
[09:47:42][C][ld2410:023]: State Class: ‘’
[09:47:42][C][ld2410:023]: Unit of Measurement: ‘cm’
[09:47:42][C][ld2410:023]: Accuracy Decimals: 0
[09:47:42][C][ld2410:028]: Firmware Version : 0.0.0000
[09:47:42][C][mdns:108]: mDNS:
[09:47:42][C][mdns:109]: Hostname: hlk-ld2410-b
[09:47:42][C][ota:093]: Over-The-Air Updates:
[09:47:42][C][ota:094]: Address: 192.168.1.137:8266
[09:47:42][C][ota:097]: Using Password.
[09:47:42][C][api:138]: API Server:
[09:47:42][C][api:139]: Address: 192.168.1.137:6053
[09:47:42][C][api:141]: Using noise encryption: YES

Bloco de Citação

O bus está vazio, acredito que não está reconhecendo o módulo.

Se seu modelo tem bt ? Instale o app e verifique se ele está funcionando normalmente via bt.

Ontem estava mexendo em outro projeto e estava testando a placa da foto acima, alimentada via USB. O pino vin que o Leandro indica fazer a ligação tinha apenas 1,3v, não sei se é um defeito da minha placa ou se esse pino serve apenas para alimentação do esp8266. Nos esp32 que tenho, quando alimentados via USB o pino VIN fica com 5v.
Teste com um multímetro se tem 5v ou não. Caso não tenha mude para o pino VOUT USB

1 curtida

Bom dia!! Tb sou iniciante em HA .
A solução esta toda detalhada no youtube do Leandro - LNPBR

Testei duas placas, uma o pino vin estava com 1.3v e outra com 5v.
No pino VOUT ambas apresentam 5v. :man_shrugging:t3:
Antes de fazer as ligações é bom testar a placa.

Aliás, para quem tem impressora 3D, fiz uma caixinha para colocar um nodemcu, um LD2410C e um TEMT6000. O arquivo está no Thingverse neste link: NodeMCU / LD2410C / TEMT6000 sensor box case holder by fabiorac - Thingiverse

Captura de Tela 2023-06-21 às 15.33.17

1 curtida

@Walber @fabiorac o pin vin não é feito para usar de saida mesmo. Quando a placa tá alimentada por usb, pode se partir do princípio que você tem 5 volts regulados já alimentado pelo vin não, por isso é comum ter algum tipo de circuito entre onde chega alimentação usb e o vin que pode impedir de ser usado como output.