esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
412 stars 26 forks source link

Support Hi-Link LD2420 (HLK-LD2420) 24GHz Radar Sensor #2219

Open zimmra opened 1 year ago

zimmra commented 1 year ago

Describe the problem you have/What new integration you would like

Please describe your use case for this integration and alternatives you've tried:

Additional context

Huymee commented 8 months ago

当你使用ESP01的时候可以配置以下信息,将日志串口切换到别的pin,然后就可是正确输出LD2420的固件版本了

# Enable logging
logger:
  hardware_uart: UART1

Hi, FW version is 1.5.9, here following ESPHome log. Anyway, putting a capacitor on 3v3 didn't help.

[16:51:24][C][logger:439]: Logger: [16:51:24][C][logger:440]: Level: DEBUG [16:51:24][C][logger:441]: Log Baud Rate: 115200 [16:51:24][C][logger:443]: Hardware UART: UART0 [16:51:24][C][uart.arduino_esp8266:102]: UART Bus: [16:51:24][C][uart.arduino_esp8266:103]: TX Pin: GPIO4 [16:51:24][C][uart.arduino_esp8266:104]: RX Pin: GPIO5 [16:51:24][C][uart.arduino_esp8266:106]: RX Buffer Size: 256 [16:51:24][C][uart.arduino_esp8266:108]: Baud Rate: 115200 baud [16:51:24][C][uart.arduino_esp8266:109]: Data Bits: 8 [16:51:24][C][uart.arduino_esp8266:110]: Parity: NONE [16:51:24][C][uart.arduino_esp8266:111]: Stop bits: 1 [16:51:24][C][uart.arduino_esp8266:115]: Using software serial [16:51:24][C][ld2420:068]: LD2420: [16:51:24][C][ld2420:069]: Firmware Version : v1.5.9 [16:51:24][C][ld2420:070]: LD2420 Number: [16:51:24][C][ld2420:072]: ld2420 Gate Timeout: 'Timeout di rilevazione presenza' [16:51:24][C][ld2420:072]: ld2420 Icon: 'mdi:timelapse' [16:51:24][C][ld2420:072]: ld2420 Unit of Measurement: 's' [16:51:24][C][ld2420:073]: ld2420 Gate Max Distance: 'Distanza massima gate' [16:51:24][C][ld2420:073]: ld2420 Icon: 'mdi:motion-sensor' [16:51:24][C][ld2420:073]: ld2420 Device Class: 'distance' [16:51:24][C][ld2420:074]: ld2420 Gate Min Distance: 'Distanza minima gate'

我的LD2420固件版本也是1.5.9 上面这个日志单独看起来没什么问题,不过我没有发现距离的报文。

另外你需要注意一下LD2420附近是不是有什么干扰源,我昨天测试的时候发现如果存在干扰的时候会导致雷达只上报10~12cm的数据(不同环境可能数值会不同),后来我把雷达换了一个位置就不存在这个现象了。

另外还有一种情况是日志中出现“Firmware Version :v0.0.0”,这时候不会出现距离的报文,出现这种情况的时候给ESP模块单独断电(雷达不断电)一次之后,等待ESP模块重新启动就好了。 -----出现这种情况的原因我怀疑是ESP模块在初始化的时候LD2420还没有完成启动,然后ESP只向雷达发送一次初始化请求,但由于LD2420还未启动完成导致它没有收到初始化信息而不会通过串口向ESP发送数据,对于硬件这块我不是太了解,所以需要一位这方面的专家帮忙确认一下我这个猜想是否能帮忙解决这个问题。

itestoni commented 8 months ago

I think I was able to replicate the issue. To do it simply reduce the max distance to 5. Then the distance will be always 35cm more or less...

Here the log when changing from 4 to 5 the max gate distance.

[17:24:23][D][number:012]: 'Distanza minima gate': Sending state 1.000000 [17:24:23][D][number:012]: 'Distanza massima gate': Sending state 4.000000 [17:24:23][D][number:012]: 'Impostazione soglia immobilità': Sending state 40000.000000 [17:24:23][D][number:012]: 'Impostazione soglia movimento': Sending state 60000.000000 [17:24:23][D][ld2420:671]: Sending write system mode command: 12 [17:24:23][D][ld2420:483]: LD2420 reply - set system parameter(s): 12 success [17:24:23][D][ld2420:567]: Sending set config disable command: FE [17:24:23][D][ld2420:450]: LD2420 reply - set config disable: CMD = FE success [17:24:23][D][select:015]: 'Modalità operativa': Sending state Normal (index 0) [17:24:23][C][ld2420:179]: LD2420 reconfig complete. [17:24:23][W][component:214]: Component web_server took a long time for an operation (0.92 s). [17:24:23][W][component:215]: Components should block for at most 20-30ms. [17:24:24][D][sensor:093]: 'Distanza di movimento': Sending state 86.00000 cm with 0 decimals of accuracy [17:24:27][D][sensor:093]: 'Distanza di movimento': Sending state 51.00000 cm with 0 decimals of accuracy [17:24:28][D][sensor:093]: 'Distanza di movimento': Sending state 67.00000 cm with 0 decimals of accuracy [17:24:30][D][sensor:093]: 'Distanza di movimento': Sending state 71.00000 cm with 0 decimals of accuracy [17:24:31][D][sensor:093]: 'Distanza di movimento': Sending state 57.00000 cm with 0 decimals of accuracy [17:24:32][D][sensor:093]: 'Distanza di movimento': Sending state 49.00000 cm with 0 decimals of accuracy [17:24:33][D][sensor:093]: 'Distanza di movimento': Sending state 82.00000 cm with 0 decimals of accuracy [17:24:34][D][sensor:093]: 'Distanza di movimento': Sending state 91.00000 cm with 0 decimals of accuracy [17:24:35][D][sensor:093]: 'Distanza di movimento': Sending state 72.00000 cm with 0 decimals of accuracy [17:24:37][D][sensor:093]: 'Distanza di movimento': Sending state 74.00000 cm with 0 decimals of accuracy [17:24:38][D][sensor:093]: 'Distanza di movimento': Sending state 75.00000 cm with 0 decimals of accuracy [17:24:39][D][sensor:093]: 'Distanza di movimento': Sending state 66.00000 cm with 0 decimals of accuracy [17:24:45][D][number:054]: 'Distanza massima gate' - Setting number value [17:24:45][D][number:113]: New number value: 5.000000 [17:24:45][D][number:012]: 'Distanza massima gate': Sending state 5.000000 [17:24:48][D][button:010]: 'Applica configurazione' Pressed. [17:24:48][C][ld2420:161]: Reconfiguring LD2420... [17:24:48][D][ld2420:567]: Sending set config enable command: FF [17:24:48][D][ld2420:447]: LD2420 reply - set config enable: CMD = FF success [17:24:48][D][ld2420:716]: Sending write gate min max and timeout command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 0 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 1 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 2 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 3 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 4 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 5 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 6 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 7 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 8 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate 9 sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate A sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate B sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate C sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate D sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate E sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][ld2420:742]: Sending set gate F sensitivity command: 7 [17:24:48][D][ld2420:468]: LD2420 reply - write gate parameter(s): 7 success [17:24:48][D][number:012]: 'Timeout di rilevazione presenza': Sending state 5.000000 [17:24:48][D][number:012]: 'Selezione gate': Sending state 0.000000 [17:24:48][D][number:012]: 'Distanza minima gate': Sending state 1.000000 [17:24:48][D][number:012]: 'Distanza massima gate': Sending state 5.000000 [17:24:48][D][number:012]: 'Impostazione soglia immobilità': Sending state 40000.000000 [17:24:48][D][number:012]: 'Impostazione soglia movimento': Sending state 60000.000000 [17:24:48][D][ld2420:671]: Sending write system mode command: 12 [17:24:48][D][ld2420:483]: LD2420 reply - set system parameter(s): 12 success [17:24:48][D][ld2420:567]: Sending set config disable command: FE [17:24:48][D][ld2420:450]: LD2420 reply - set config disable: CMD = FE success [17:24:48][D][select:015]: 'Modalità operativa': Sending state Normal (index 0) [17:24:48][C][ld2420:179]: LD2420 reconfig complete. [17:24:48][W][component:214]: Component web_server took a long time for an operation (0.30 s). [17:24:48][W][component:215]: Components should block for at most 20-30ms. [17:24:49][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [17:24:52][D][sensor:093]: 'Distanza di movimento': Sending state 42.00000 cm with 0 decimals of accuracy [17:24:53][D][sensor:093]: 'Distanza di movimento': Sending state 36.00000 cm with 0 decimals of accuracy [17:24:54][D][sensor:093]: 'Distanza di movimento': Sending state 41.00000 cm with 0 decimals of accuracy [17:24:55][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [17:25:01][D][sensor:093]: 'Distanza di movimento': Sending state 38.00000 cm with 0 decimals of accuracy [17:25:02][D][sensor:093]: 'Distanza di movimento': Sending state 39.00000 cm with 0 decimals of accuracy [17:25:03][D][sensor:093]: 'Distanza di movimento': Sending state 40.00000 cm with 0 decimals of accuracy [17:25:05][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [17:25:09][D][sensor:093]: 'Distanza di movimento': Sending state 40.00000 cm with 0 decimals of accuracy [17:25:10][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [17:25:11][D][sensor:093]: 'Distanza di movimento': Sending state 41.00000 cm with 0 decimals of accuracy

descipher commented 8 months ago

The issue you are describing is known by HLK. The module will go into a state where all threshold register values are ignored and the detections are spurious. Used to be more frequent at 256000 baud. A power cycle will clear it. I can can create the issue by flooding the unit with a high rate of serial commands. Once configured it will be stable all the time. It's just when it has to process rapid register updates. I will experiment with a throttle function as a work around for now.

itestoni commented 8 months ago

The point is that when in this condition I'm not able to revert it back. It is stuck. I need to cycle the power supply. :(

descipher commented 8 months ago

Yes, I am frustrated by that, It's not a component code issue. I can probably work around it.

itestoni commented 8 months ago

Yes, I am frustrated by that, It's not a component code issue. I can probably work around it.

Ok but I got frozen the module also with no other apparent reason. It was simply left on his own mounted on the wall overnight. Then I found it stuck... So, at least I have two different conditions to get it stuck. By the way, I have no issue after OTA FW update like user before.

Huymee commented 8 months ago

我刚才查了一下协议文档,可以发送以下命令重启LD2420:

FD FC FB FA 02 00 68 00 04 03 02 01

image

descipher commented 8 months ago

With clean sufficient power I have never seen the module lockup.

I just checked the protocol document and I can send the following command to restart LD2420:

FD FC FB FA 02 00 68 00 04 03 02 01

The component code sends that command with the restart option button.

image

descipher commented 8 months ago

It will not fix the problem since the module ignores all commands when in this state.

hagak commented 7 months ago

One issue I have noticed with on ld2420 v1.5.8 and esp32s3 is that it would not reliably connect to the ld2420 at setup. I suspect it was because the LD2420 had not initialized before the esp32 attempted to connect to it and then the LD2420 was in the "locked state". This behaviour appeared to happen rather often at power up.

I was able to workaround this issue and it has been reliable at startup by adding this:

ld2420:
  setup_priority: -100

To prevent the esp32 from trying to setup the ld2420 too early and seems to be reliable now.

descipher commented 7 months ago

@hagak Thanks,I will submit a PR to adjust the priority.

Technology67 commented 7 months ago

Hello,

I have a technical solution to get around the problem on ESPHOME. For information, the problem also exists on the latest versions of LD2420. I made a sensor which is controlled by an interval and does a hard reset when it is frozen.

Directly connect the GPIO16 port to the RST port on the ESP.

dans Yaml : switch:

interval:

Every minute, it checks if the value is digital and if not does an electrical reboot.

hagak commented 7 months ago

Hello,

I have a technical solution to get around the problem on ESPHOME. For information, the problem also exists on the latest versions of LD2420. I made a sensor which is controlled by an interval and does a hard reset when it is frozen.

Directly connect the GPIO16 port to the RST port on the ESP.

dans Yaml : switch:

  • platform: gpio pin: D0 name: "Hard reset" id: hard_reset entity_category: "diagnostic" restore_mode: ALWAYS_ON

interval:

  • interval: 1min startup_delay: 1min then:

    • if: condition:
    • lambda: 'return id(distance).state >= 0.0;' then:
    • logger.log: "health check => good" else:
    • logger.log: "health check => bad => hard reset"
    • switch.turn_off: hard_reset

Every minute, it checks if the value is digital and if not does an electrical reboot.

How are you powering the LD2420? Cause this would not power off the LD2420 and that is what needs to happen when the locked condition happens.

I am planning a minor change to my next design that will have a separate 3v3 voltage regulator that has an EN pin for everything but the ESP. This way I can have the ESP control the EN pin on the 3v3 voltage regulator to power cycle.

Technology67 commented 7 months ago

a physical reset is equivalent to pressing the switch RESET on the ESP and resolves the problem in my case. LD2420 is connected to the 3.3v port of the ESP.

chrnico2 commented 7 months ago

Hello,

I'm testing the ld2420 on an ESP32 S2 Mini from Wemoss. My problem is that without the ld2420, the ESP32 S2 MINI connects well to my WIFI network. If I connect an ld2420 to it, the ESP32 S2 MINI can no longer access WIFI. If I remove the ld2420, the ESP32 S2 MINI accesses my WIFI again. I have tried several times, with identical board and ld2420 and the result is always the same.

`esphome: name: esp32-1 friendly_name: ESP32_1

esp32: board: lolin_s2_mini framework: type: arduino

Enable logging

logger:

Enable Home Assistant API

api: encryption: key: "*removed for this post**"

ota: password: "*removed for this post**"

wifi: ssid: !secret wifi_ssid password: !secret wifi_password manual_ip: static_ip: 192.168.76.2 gateway: 192.168.76.1 subnet: 255.255.255.0 dns1: 192.168.76.1

Enable fallback hotspot (captive portal) in case wifi connection fails

ap: ssid: "Esp32-1 Fallback Hotspot" password: "98WZjFNWE1ih" power_save_mode: none

captive_portal:

web_server: port: 80

uart: tx_pin: GPIO18 rx_pin: GPIO33 baud_rate: 256000 parity: NONE stop_bits: 1

ld2420:

text_sensor:

sensor:

binary_sensor:

switch:

select:

number:

button:

Technology67 commented 7 months ago

try use TX=21 and RX=22 pin by crossing the tx and rx pins

descipher commented 7 months ago

Is the baud really 256000 for your LD2420, that's only on v1.5.2 and older.

chrnico2 commented 7 months ago

I tried with the baud rate at 115200 but I still have a problem connecting to WIFI when the LD2420 is connected to the ESP32 S2 MINI

INFO ESPHome 2023.12.9 INFO Reading configuration /config/esphome/esp32-3.yaml... INFO Starting log output from /dev/ttyACM0 with baud rate 115200 [06:57:23][W][wifi_esp32:455]: Event: Disconnected ssid='LaPaillotte' reason='Probe Request Unsuccessful' [06:57:23][W][wifi:618]: Error while connecting to network. [06:57:23][W][wifi:654]: Restarting WiFi adapter... [06:57:28][I][wifi:300]: WiFi Connecting to 'LaPaillotte'... [06:57:31][W][wifi_esp32:455]: Event: Disconnected ssid='LaPaillotte' reason='Probe Request Unsuccessful' [06:57:31][W][wifi:618]: Error while connecting to network. [06:57:31][W][wifi:654]: Restarting WiFi adapter...

chrnico2 commented 7 months ago

IMG_20240204_192043 IMG_20240204_192020

chrnico2 commented 7 months ago

This twitt helped me : https://twitter.com/andresvahter/status/1712460762206372032

After modification of UART

_uart: tx_pin: GPIO18 rx_pin: GPIO16 baud_rate: 115200 parity: NONE stopbits: 1

My last log

_INFO ESPHome 2023.12.9 INFO Reading configuration /config/esphome/esp32-3.yaml... INFO Starting log output from /dev/ttyACM0 with baud rate 115200 [10:20:11][D][sensor:094]: 'Moving Distance': Sending state 5.00000 cm with 0 decimals of accuracy [10:20:12][W][wifi_esp32:455]: Event: Disconnected ssid='LaPaillotte' reason='Probe Request Unsuccessful' [10:20:13][D][sensor:094]: 'Moving Distance': Sending state 4.00000 cm with 0 decimals of accuracy [10:20:14][I][wifi:300]: WiFi Connecting to 'LaPaillotte'... [10:20:14][W][wifi:618]: Error while connecting to network. [10:20:14][I][wifi:300]: WiFi Connecting to 'LaPaillotte'... [10:20:14][W][wifi:628]: WiFi network can not be found anymore. [10:20:14][D][sensor:094]: 'Moving Distance': Sending state 5.00000 cm with 0 decimals of accuracy [10:20:17][W][wifi_esp32:455]: Event: Disconnected ssid='LaPaillotte' reason='Probe Request Unsuccessful' [10:20:19][I][wifi:300]: WiFi Connecting to 'LaPaillotte'... [10:20:19][W][wifi:618]: Error while connecting to network. [10:20:19][I][wifi:300]: WiFi Connecting to 'LaPaillotte'... [10:20:19][W][wifi:628]: WiFi network can not be found anymore. [10:20:20][D][sensor:094]: 'Moving Distance': Sending state 4.00000 cm with 0 decimals of accuracy [10:20:22][D][sensor:094]: 'Moving Distance': Sending state 5.00000 cm with 0 decimals of accuracy [10:20:22][W][wifi_esp32:455]: Event: Disconnected ssid='LaPaillotte' reason='Probe Request Unsuccessful' [10:20:24][I][wifi:300]: WiFi Connecting to 'LaPaillotte'... [10:20:24][W][wifi:618]: Error while connecting to network. [10:20:24][I][wifi:300]: WiFi Connecting to 'LaPaillotte'... [10:20:24][W][wifi:628]: WiFi network can not be found anymore. [10:20:27][W][wifiesp32:455]: Event: Disconnected ssid='LaPaillotte' reason='Probe Request Unsuccessful'

LD2420 communication OK WIFI KO

descipher commented 7 months ago

The LD2420 requires 3.3v, you are soldering it to 5v. VBUS=5v You are lucky it still works. It will draw too much current and the mini will brownout on WIFI activation.

chrnico2 commented 7 months ago

Okay I did something stupid. I just realized that the LD2420 is 3.3V and I connected it to the VBUS which should be 5V. I just did another test by connecting the LD2420 to pins 15/GND/17/21. I defined a switch for pin 15. When I switch on, I see the blue LED light up, the Wifi still works, but the LD2420 does not communicate anything. To avoid having to wire the LD2420, I need 3v3 on pin 15. How can I do this?

hagak commented 7 months ago

Not sure the specs on the board but GPIO pins generally do not do well at all supply power. While the LD2420 is a low power device compared to other mmWave devices it still a pretty high load and I would not expect it to be powered by GPIO. So you need to get a 3v3 power to it

chrnico2 commented 7 months ago

Problem solved. Thank you all for your valuable advice.

IMG_20240205_172457

Tomasinjo commented 7 months ago

I have the same setup as guy above me:

After flashing it goes to safe mode, like if it fell to a boot loop. But it does it immediately.

It does above no matter if the sensor is connected or not. It does it if I add anything related to ld2420. If it delete this config and add config from my other project that uses ld2410, I can access web portal etc. (sensor outputs are empty of course).

This is serial log:

Reconnecting to COM9 .... Connected!
[I][app:029]: Running through setup()...
[C][wifi:038]: Setting up WiFi... [C][wifi:051]: Starting WiFi... [C][wifi:052]: Local MAC: x [I][wifi:300]: WiFi Connecting to 'IoT'... [I][wifi:587]: WiFi Connected! [C][wifi:405]: Local MAC: x [C][wifi:410]: SSID: m'IoT'm [C][wifi:411]: IP Address: 192.168.30.213 [C][wifi:413]: BSSID: y

[C][wifi:416]: Signal strength: -51 dB ▂▄▆█ [C][wifi:420]: Channel: 11 [C][wifi:421]: Subnet: 255.255.255.0 [C][wifi:422]: Gateway: 192.168.30.1 [C][wifi:423]: DNS1: 192.168.10.15 [C][wifi:424]: DNS2: 192.168.30.1 [D][wifi:596]: Disabling AP... [C][ota:097]: Over-The-Air Updates: [C][ota:098]: Address: 192.168.30.213:3232 [C][ota:101]: Using Password. [W][ota:107]: Last Boot was an unhandled reset, will proceed to safe mode in 0 restarts [I][app:062]: setup() finished successfully! [I][ota:493]: Waiting for OTA attempt. [I][app:102]: ESPHome version 2023.12.9 compiled on Feb 10 2024, 21:39:08

[C][wifi:405]: Local MAC: x [C][wifi:410]: SSID: m'IoT'm [C][wifi:411]: IP Address: 192.168.30.213 [C][wifi:413]: BSSID: y

[C][wifi:416]: Signal strength: -51 dB ▂▄▆█ [C][wifi:420]: Channel: 11 [C][wifi:421]: Subnet: 255.255.255.0 [C][wifi:422]: Gateway: 192.168.30.1 [C][wifi:423]: DNS1: 192.168.10.15 [C][wifi:424]: DNS2: 192.168.30.1

[C][logger:440]: Level: DEBUG [C][logger:441]: Log Baud Rate: 115200 [C][logger:443]: Hardware UART: USB_CDC [C][captive_portal:088]: Captive Portal:

[C][mdns:116]: Hostname: esp32-1 [C][ota:097]: Over-The-Air Updates: [C][ota:098]: Address: 192.168.30.213:3232 [C][ota:101]: Using Password. [W][ota:107]: Last Boot was an unhandled reset, will proceed to safe mode in 0 restarts

Any help appreciated!

descipher commented 7 months ago

@Tomasinjo Well based on your information provided, either the module is dead, or the module is older firmware and the baud is wrong or it's not wired the same.

Tomasinjo commented 7 months ago

Module was tested using vendor's software using 115200 baud so I assume it is running newer versions of firmware.

I will do some more testing with other boards. Just one more thing: Is the board going to boot without module connected, and with ld2420 esphome configuration?

Thanks!

descipher commented 7 months ago

The component code will boot without the module but will be marked failed, thus it will not be functional but will observable with usb serial logging for sure.. You may be experiencing power regulation issues, the quality of many ESP mini boards sourced from china are not that good. Quite often they are defective batches picked up by sketchy resellers.

Tomasinjo commented 7 months ago

I solved it, it was configuration error. I defined "uart:" within "ld2420:". I moved it outside and now it works.

Tomasinjo commented 7 months ago

Does this sensor also support per-gate energy measurements just like LD2410?

descipher commented 7 months ago

The sensor will report all gate energies in report mode as of v1.5.4 The component code uses that output mode to calibrate the modules sensitivity settings.

BDog1600 commented 5 months ago

Can you set these to 6”, 8”, and 11” detection ranges? Obviously in cm

descipher commented 5 months ago

Can you set these to 6”, 8”, and 11” detection ranges? Obviously in cm

Nope. The minimum gate time window is 70 cm, in other words the signal echo detection time slot center point is at ~70cm. Processing 2-5 centimetres of time window would require some impressive cpu processing power.

BDog1600 commented 5 months ago

Is there a radar like sensor that would work at the small distances but still have a FOV of Atleast 60-90 degrees

descipher commented 5 months ago

Radar .. nope, have a look at Lidar modules, they do 3cm to 300+ and other formats.

heibertelf commented 5 months ago

Can you set these to 6”, 8”, and 11” detection ranges? Obviously in cm

Minimal distance my 2420 sensor can indicate is 35cm. But it's not very precise.

cuongdm75 commented 5 months ago

I setup ld2420 with nodemcu esp8266, I've got signal in log output but nothing in mqtt broker as in my screenshotScreenshot_20240412_204416_Home Assistant.jpg

Please help me out how to solve. My config is as followed:

substitutions: name: esphome-web-71a75e friendly_name: Human presence sensor

external_components:

esphome: name: ld2420-esp8266 friendly_name: ld2420-esp8266

esp8266: board: nodemcuv2 framework: version: recommended

Enable logging

logger: level: debug baud_rate: 0

Enable Home Assistant API

api:

encryption:

key: Bm5stsuCa4tCx0r+K/L6rstGHcYL816ngNc6lBPbAlU=

ota: safe_mode: True password: 123456

wifi: networks:

web_server: port: 80

mqtt: broker: 192.168.1.5 username: xxxxx password: xxxxx

uart: id: ld2420_uart tx_pin: 1 rx_pin: 3 baud_rate: 115200 parity: NONE stop_bits: 1

The LD2420 has 16 sense gates 0-15 and each gate detects 0.7 meters 15th gate = 9m

ld2420:

text_sensor:

sensor:

binary_sensor:

switch:

select:

number:

descipher commented 5 months ago

Usually it's a wiring issue. What are your pin connections?

cuongdm75 commented 5 months ago

I'm sure it is not wiring problem. I tried to reverse, change ot1 to ot2 in ld2420 but it didn't work. Btw, as I said, I'd got the output in the log/console.

Can someone confirm me the configuration is correct or not?

descipher commented 5 months ago

I'm sure it is not wiring problem. I tried to reverse, change ot1 to ot2 in ld2420 but it didn't work. Btw, as I said, I'd got the output in the log/console.

Can someone confirm me the configuration is correct or not?

There is no issue with the config, would have flagged that, this is not a support page. For support use https://discord.gg/hrhJCHbBf4

cuongdm75 commented 5 months ago

Thank you and sorry for disturbing. I tried press reset button and the information from the sensor appeared on HA. Unfortunately, after a while it is disconnect and reconnect to the broker. It may cause by mqtt alive error for your more information.

descipher commented 5 months ago

Thank you and sorry for disturbing. I tried press reset button and the information from the sensor appeared on HA. Unfortunately, after a while it is disconnect and reconnect to the broker. It may cause by mqtt alive error for your more information.

No worries, quite often boards like the nodemcuv2 will not have enough power to run the WiFi and a LD2420 module at the same time. They often have low current SOT-23-5 3.3v regulators on the board. Add a 47uf cap to the power pins on the LD2420 module to rule it out.

mkbodanu4 commented 5 months ago

Hello!

Today I got LD2420, firmware 1.5.9. It works well with the tool from the website but completely does not work when I was trying to install it into ESPHome.

ESP32 board: LILYGO T-ETH-LITE Chip: ESP32-D0WD-V3 (revision v3.1)

Yaml with ESPHome configuration:

esphome:
  name: hallway-sensors

esp32:
  board: esp32dev
  framework:
    type: arduino

ethernet:
  type: RTL8201
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 0
  power_pin: GPIO12

ota:

logger:
  baud_rate: 0

web_server:
  port: 80

uart:
  id: ld2420_uart
  tx_pin: GPIO01
  rx_pin: GPIO03
  baud_rate: 115200

ld2420:
  setup_priority: -100

text_sensor:
  - platform: ld2420
    fw_version:
      name: LD2420 Firmware

sensor:
  - platform: ld2420
    moving_distance:
      name : Moving Distance

binary_sensor:
  - platform: ld2420
    has_target:
      name: Presence

select:
  - platform: ld2420
    operating_mode:
      name: Operating Mode

number:
  - platform: ld2420
    presence_timeout:
      name: Detection Presence Timeout
    min_gate_distance:
      name: Detection Gate Minimum
    max_gate_distance:
      name: Detection Gate Maximum
    # See "Number" section below for detail
    gate_select:
      name: Select Gate to Set
    still_threshold:
      name: Set Still Threshold Value
    move_threshold:
      name: Set Move Threshold Value

button:
  - platform: ld2420
    apply_config:
      name: Apply Config
    factory_reset:
      name: Factory Reset
    restart_module:
      name: Restart Module
    revert_config:
      name: Undo Edits

The module was not starting at all before I added 'setup_priority: -100', even without LD2420 connected. After I added that configuration, it started but loops without any success. If LD2420 is not connected, this is what I getting in UART:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13132
load:0x40080400,len:3036
entry 0x400805e4
E (14730) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (14730) task_wdt:  - loopTask (CPU 1)
E (14730) task_wdt: Tasks currently running:
E (14730) task_wdt: CPU 0: IDLE
E (14730) task_wdt: CPU 1: loopTask
E (14730) task_wdt: Aborting.

abort() was called at PC 0x400ef991 on core 0

Backtrace:0x400836bd:0x3ffbe7bc |<-CORRUPTED

ELF file SHA256: 0000000000000000

Rebooting...

I don't know why it is so and can't find anyone who has the same issue, except this thread https://community.home-assistant.io/t/ld2420-unable-to-setup/713080 What is wrong with my setup?

descipher commented 5 months ago

@mkbodanu4 Not a great choice for the uart pins see https://www.gelidus.ca/ps1-setup-guide/

mkbodanu4 commented 5 months ago

@descipher thanks for the reply, I tried another UART pins without success but I think I found an issue.

I tried to add UART debug with GPIO01/GPIO03 UART0 and found that ESP32 module starts without a problem. Just nothing was received from LD2420. So I added button to request firmware version from LD2420:

button:
  - platform: template
    name: "LD2420 Get Version"
    on_press:
      - uart.write: [0xFD,0xFC,0xFB,0xFA,0x02,0x00,0x00,0x00,0x04,0x03,0x02,0x01]

There was no reply from LD2420, so I tried to disconnect and connect the module and after this power cycle, it started sending lots of messages "OFF\r\n", and replying to firmware version requests as well.

Next, I tried adding AOD4184 module to be able to turn on and off LD2420 module via GPIO switch

switch:
  - platform: gpio
    pin: GPIO33
    # AOD4184 module input pin to GPIO33
    name: "LD2420 Power"

Now I'm able to start the module by clicking on that switch on the webserver page and it working. Looks like my ESP32 board has not enough available power capacity on 3.3 V line during ESP32 boot and only starting the module with a significant delay helps to get LD2420 working. Adding a capacitor up to 240 uF did not help. Seems I need to find a way to get power for LD2420 using any small DC-DC converter directly from PoE module.

descipher commented 5 months ago

@mkbodanu4 I would just use a simple 3.3v LDO module and tap the 5v line, you only need about 100ma to run the LD2420.

Matteo8825 commented 5 months ago

Hi everyone, I tried to carry out the calibration, but without success because this appeared in the logs:

INFO ESPHome 2024.4.0 INFO Reading configuration /config/esphome/sensore-salotto.yaml... INFO Starting log output from 192.168.1.30 using esphome API INFO Successfully connected to sensore-salotto @ 192.168.1.30 in 0.004s INFO Successful handshake with sensore-salotto @ 192.168.1.30 in 2.727s [16:49:20][I][app:100]: ESPHome version 2024.4.0 compiled on Apr 18 2024, 15:59:57

[16:49:20][C][wifi:408]: Local MAC: 08:F9:E0:73:BF:53 [16:49:20][C][wifi:413]: SSID: '****'[redacted] [16:49:20][C][wifi:416]: IP Address: **** [16:49:20][C][wifi:419]: BSSID: 00:EB:D8:89:FD:CC[redacted]

[16:49:20][C][wifi:423]: Signal strength: -56 dB ▂▄▆█ [16:49:20][C][wifi:427]: Channel: 9 [16:49:20][C][wifi:428]: Subnet: ** [16:49:20][C][wifi:429]: Gateway: [16:49:20][C][wifi:430]: DNS1: **** [16:49:20][C][wifi:431]: DNS2: 0.0.0.0

[16:49:20][C][logger:167]: Level: DEBUG [16:49:20][C][logger:169]: Log Baud Rate: 115200 [16:49:20][C][logger:170]: Hardware UART: UART0 [16:49:20][C][i2c.arduino:071]: I2C Bus: [16:49:20][C][i2c.arduino:072]: SDA Pin: GPIO4 [16:49:20][C][i2c.arduino:073]: SCL Pin: GPIO5 [16:49:20][C][i2c.arduino:074]: Frequency: 50000 Hz [16:49:20][C][i2c.arduino:086]: Recovery: bus successfully recovered [16:49:20][I][i2c.arduino:096]: Results from i2c bus scan: [16:49:20][I][i2c.arduino:102]: Found i2c device at address 0x23 [16:49:20][C][uart.arduino_esp8266:118]: UART Bus: [16:49:20][C][uart.arduino_esp8266:119]: TX Pin: GPIO12 [16:49:20][C][uart.arduino_esp8266:120]: RX Pin: GPIO13 [16:49:20][C][uart.arduino_esp8266:122]: RX Buffer Size: 256 [16:49:20][C][uart.arduino_esp8266:124]: Baud Rate: 115200 baud [16:49:20][C][uart.arduino_esp8266:125]: Data Bits: 8 [16:49:20][C][uart.arduino_esp8266:126]: Parity: NONE [16:49:20][C][uart.arduino_esp8266:127]: Stop bits: 1 [16:49:20][C][uart.arduino_esp8266:131]: Using software serial

[16:49:20][C][ld2420:069]: Firmware Version : v1.5.9 [16:49:20][C][ld2420:070]: LD2420 Number: [16:49:20][C][ld2420:072]: ld2420 Gate Timeout: 'Timeout di rilevazione presenza' [16:49:20][C][ld2420:072]: ld2420 Icon: 'mdi:timelapse' [16:49:20][C][ld2420:072]: ld2420 Unit of Measurement: 's' [16:49:20][C][ld2420:073]: ld2420 Gate Max Distance: 'Distanza massima gate' [16:49:20][C][ld2420:073]: ld2420 Icon: 'mdi:motion-sensor' [16:49:20][C][ld2420:073]: ld2420 Device Class: 'distance' [16:49:20][C][ld2420:074]: ld2420 Gate Min Distance: 'Distanza minima gate' [16:49:20][C][ld2420:074]: ld2420 Icon: 'mdi:motion-sensor' [16:49:20][C][ld2420:074]: ld2420 Device Class: 'distance' [16:49:20][C][ld2420:075]: ld2420 Gate Select: 'Selezione gate' [16:49:20][C][ld2420:075]: ld2420 Icon: 'mdi:motion-sensor' [16:49:20][C][ld2420:075]: ld2420 Device Class: 'distance' [16:49:20][C][ld2420:077]: ld2420 Gate Move Threshold: 'Impostazione soglia movimento' [16:49:20][C][ld2420:077]: ld2420 Icon: 'mdi:motion-sensor' [16:49:21][C][ld2420:078]: ld2420 Gate Still Threshold:: 'Impostazione soglia immobilità' [16:49:21][C][ld2420:078]: ld2420 Icon: 'mdi:motion-sensor' [16:49:21][C][ld2420:082]: ld2420 Apply Config: 'Applica configurazione' [16:49:21][C][ld2420:082]: ld2420 Icon: 'mdi:restart-alert' [16:49:21][C][ld2420:083]: ld2420 Revert Edits: 'Undo modifiche' [16:49:21][C][ld2420:083]: ld2420 Icon: 'mdi:restart' [16:49:21][C][ld2420:084]: ld2420 Factory Reset: 'Reset a impostazioni di fabbrica' [16:49:21][C][ld2420:084]: ld2420 Icon: 'mdi:database' [16:49:21][C][ld2420:085]: ld2420 Restart Module: 'Riavvio modulo' [16:49:21][C][ld2420:085]: ld2420 Icon: 'mdi:database' [16:49:21][C][ld2420:087]: LD2420 Select: [16:49:21][C][ld2420:088]: ld2420 Operating Mode 'Modalità operativa' [16:49:21][C][LD2420.text_sensor:011]: LD2420 TextSensor:

[16:49:21][C][wifi_info:013]: WifiInfo Mac Address 'indirizzo MAC' [16:49:21][C][LD2420.sensor:011]: LD2420 Sensor:

[16:49:21][C][LD2420.sensor:012]: Device Class: 'distance' [16:49:21][C][LD2420.sensor:012]: State Class: '' [16:49:21][C][LD2420.sensor:012]: Unit of Measurement: 'cm' [16:49:21][C][LD2420.sensor:012]: Accuracy Decimals: 0

[16:49:21][C][dht:018]: Pin: GPIO2 [16:49:21][C][dht:024]: Model: DHT22 (or equivalent) [16:49:21][C][dht:027]: Update Interval: 60.0s

[16:49:21][C][dht:029]: Device Class: 'temperature' [16:49:21][C][dht:029]: State Class: 'measurement' [16:49:21][C][dht:029]: Unit of Measurement: '°C' [16:49:21][C][dht:029]: Accuracy Decimals: 1

[16:49:21][C][dht:030]: Device Class: 'humidity' [16:49:21][C][dht:030]: State Class: 'measurement' [16:49:21][C][dht:030]: Unit of Measurement: '%' [16:49:21][C][dht:030]: Accuracy Decimals: 1

[16:49:21][C][bh1750.sensor:118]: Device Class: 'illuminance' [16:49:21][C][bh1750.sensor:118]: State Class: 'measurement' [16:49:21][C][bh1750.sensor:118]: Unit of Measurement: 'lx' [16:49:21][C][bh1750.sensor:118]: Accuracy Decimals: 1 [16:49:21][C][bh1750.sensor:119]: Address: 0x23 [16:49:21][C][bh1750.sensor:124]: Update Interval: 30.0s [16:49:21][C][LD2420.binary_sensor:011]: LD2420 BinarySensor:

[16:49:21][C][LD2420.binary_sensor:012]: Device Class: 'occupancy' [16:49:21][C][restart:068]: Restart Switch 'Riavvio nodo ESPHome'

[16:49:21][C][restart:090]: Restore Mode: always OFF [16:49:21][C][captive_portal:088]: Captive Portal: [16:49:21][C][web_server:169]: Web Server: [16:49:21][C][web_server:170]: Address: sensore-salotto.local:80

[16:49:21][C][mdns:116]: Hostname: sensore-salotto [16:49:21][C][ota:096]: Over-The-Air Updates: [16:49:21][C][ota:097]: Address: sensore-salotto.local:8266 [16:49:21][C][ota:100]: Using Password. [16:49:21][C][ota:103]: OTA version: 2. [16:49:21][C][api:139]: API Server: [16:49:21][C][api:140]: Address: sensore-salotto.local:6053 [16:49:21][C][api:142]: Using noise encryption: YES [16:49:21][C][wifi_info:009]: WifiInfo IPAddress 'indirizzo IP' [16:49:21][C][wifi_signal.sensor:009]: WiFi Signal 'WiFi' [16:49:21][C][wifi_signal.sensor:009]: State Class: 'measurement' [16:49:21][C][wifi_signal.sensor:009]: Unit of Measurement: '%' [16:49:21][C][wifi_signal.sensor:009]: Accuracy Decimals: 0 [16:49:33][D][sensor:093]: 'Distanza di movimento': Sending state 7424.00000 cm with 0 decimals of accuracy [16:49:33][D][select:062]: 'Modalità operativa' - Setting [16:49:33][D][select:115]: 'Modalità operativa' - Set selected option to: Calibrate [16:49:33][D][select:015]: 'Modalità operativa': Sending state Calibrate (index 1) [16:49:33][D][select:015]: 'Modalità operativa': Sending state Calibrate (index 1) [16:49:34][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [16:49:34][I][ld2420:286]: Gate: 0 Avg: 2429 Peak: 54749 [16:49:34][I][ld2420:286]: Gate: 1 Avg: 1546 Peak: 37250 [16:49:34][I][ld2420:286]: Gate: 2 Avg: 943 Peak: 20045 [16:49:34][I][ld2420:286]: Gate: 3 Avg: 2709 Peak: 45305 [16:49:34][I][ld2420:286]: Gate: 4 Avg: 1629 Peak: 27098 [16:49:34][I][ld2420:286]: Gate: 5 Avg: 761 Peak: 13021 [16:49:34][I][ld2420:286]: Gate: 6 Avg: 615 Peak: 10309 [16:49:34][I][ld2420:286]: Gate: 7 Avg: 481 Peak: 7993 [16:49:34][I][ld2420:286]: Gate: 8 Avg: 280 Peak: 4909 [16:49:34][I][ld2420:286]: Gate: 9 Avg: 273 Peak: 5125 [16:49:34][I][ld2420:286]: Gate: 10 Avg: 228 Peak: 4090 [16:49:34][I][ld2420:286]: Gate: 11 Avg: 148 Peak: 2789 [16:49:34][I][ld2420:286]: Gate: 12 Avg: 146 Peak: 2745 [16:49:34][I][ld2420:286]: Gate: 13 Avg: 113 Peak: 2146 [16:49:34][I][ld2420:286]: Gate: 14 Avg: 84 Peak: 1538 [16:49:34][I][ld2420:286]: Gate: 15 Avg: 101 Peak: 1937 [16:49:34][I][ld2420:288]: Total samples: 4 [16:49:34][W][component:237]: Component ld2420 took a long time for an operation (90 ms). [16:49:34][W][component:238]: Components should block for at most 30 ms. [16:49:38][I][ld2420:286]: Gate: 0 Avg: 20820 Peak: 64388 [16:49:38][I][ld2420:286]: Gate: 1 Avg: 19522 Peak: 63080 [16:49:38][I][ld2420:286]: Gate: 2 Avg: 17885 Peak: 63787 [16:49:38][I][ld2420:286]: Gate: 3 Avg: 28791 Peak: 58799 [16:49:38][I][ld2420:286]: Gate: 4 Avg: 18274 Peak: 51559 [16:49:38][I][ld2420:286]: Gate: 5 Avg: 10808 Peak: 43055 [16:49:38][I][ld2420:286]: Gate: 6 Avg: 10710 Peak: 58670 [16:49:38][I][ld2420:286]: Gate: 7 Avg: 7604 Peak: 53538 [16:49:38][I][ld2420:286]: Gate: 8 Avg: 4829 Peak: 64014 [16:49:38][I][ld2420:286]: Gate: 9 Avg: 7953 Peak: 61718 [16:49:38][I][ld2420:286]: Gate: 10 Avg: 5705 Peak: 60683 [16:49:38][I][ld2420:286]: Gate: 11 Avg: 8385 Peak: 62731 [16:49:38][I][ld2420:286]: Gate: 12 Avg: 6232 Peak: 58375 [16:49:38][I][ld2420:286]: Gate: 13 Avg: 6449 Peak: 59909 [16:49:38][I][ld2420:286]: Gate: 14 Avg: 7026 Peak: 54278 [16:49:38][I][ld2420:286]: Gate: 15 Avg: 11566 Peak: 63495 [16:49:38][I][ld2420:288]: Total samples: 43 [16:49:38][W][component:237]: Component ld2420 took a long time for an operation (80 ms). [16:49:38][W][component:238]: Components should block for at most 30 ms. [16:49:39][W][dht:169]: Requesting data from DHT failed! [16:49:39][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number). [16:49:39][D][sensor:093]: 'Temperatura': Sending state nan °C with 1 decimals of accuracy [16:49:39][D][sensor:093]: 'Umidità': Sending state nan % with 1 decimals of accuracy [16:49:42][D][bh1750.sensor:159]: 'Luminosità': Got illuminance=3.8lx [16:49:42][D][sensor:093]: 'Luminosità': Sending state 3.84842 lx with 1 decimals of accuracy [16:49:42][I][ld2420:286]: Gate: 0 Avg: 32004 Peak: 65186 [16:49:42][I][ld2420:286]: Gate: 1 Avg: 32325 Peak: 65277 [16:49:42][I][ld2420:286]: Gate: 2 Avg: 25650 Peak: 63787 [16:49:42][I][ld2420:286]: Gate: 3 Avg: 44013 Peak: 64171 [16:49:42][I][ld2420:286]: Gate: 4 Avg: 28126 Peak: 63850 [16:49:42][I][ld2420:286]: Gate: 5 Avg: 14610 Peak: 43055 [16:49:42][I][ld2420:286]: Gate: 6 Avg: 13850 Peak: 58670 [16:49:42][I][ld2420:286]: Gate: 7 Avg: 10892 Peak: 60703 [16:49:42][I][ld2420:286]: Gate: 8 Avg: 8797 Peak: 64014 [16:49:42][I][ld2420:286]: Gate: 9 Avg: 10494 Peak: 62734 [16:49:42][I][ld2420:286]: Gate: 10 Avg: 6899 Peak: 62734 [16:49:42][I][ld2420:286]: Gate: 11 Avg: 8796 Peak: 62731 [16:49:42][I][ld2420:286]: Gate: 12 Avg: 9046 Peak: 59656 [16:49:42][I][ld2420:286]: Gate: 13 Avg: 7546 Peak: 59909 [16:49:42][I][ld2420:286]: Gate: 14 Avg: 7758 Peak: 59655 [16:49:42][I][ld2420:286]: Gate: 15 Avg: 13949 Peak: 63495 [16:49:42][I][ld2420:288]: Total samples: 82 [16:49:42][W][component:237]: Component ld2420 took a long time for an operation (80 ms). [16:49:42][W][component:238]: Components should block for at most 30 ms. [16:49:45][D][select:062]: 'Modalità operativa' - Setting [16:49:45][D][select:115]: 'Modalità operativa' - Set selected option to: Normal [16:49:45][D][select:015]: 'Modalità operativa': Sending state Normal (index 0) [16:49:45][D][select:015]: 'Modalità operativa': Sending state Normal (index 0) [16:49:45][D][sensor:093]: 'Distanza di movimento': Sending state 8484.00000 cm with 0 decimals of accuracy [16:49:47][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [16:49:48][D][sensor:093]: 'Distanza di movimento': Sending state 32803.00000 cm with 0 decimals of accuracy [16:49:49][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [16:49:50][D][sensor:093]: 'Distanza di movimento': Sending state 39460.00000 cm with 0 decimals of accuracy [16:49:51][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy [16:49:51][D][sensor:093]: 'WiFi': Sending state 90.00000 % with 0 decimals of accuracy

from that moment on the sensor constantly signals the active presence with a distance of 35cm. how can I solve it? my yaml is as follows:

esphome: name: sensore-salotto friendly_name: sensore salotto

esp8266: board: d1_mini

Enable logging

logger:

Enable Home Assistant API

api:

ota: password:

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

Enable fallback hotspot (captive portal) in case wifi connection fails

ap: ssid: password:

web_server: port: 80 log: true ota: false

captive_portal:

serve per dichiarare il bus di comunicazione del sensore bh1750

i2c: sda: D2 scl: D1 scan: true id: bus_a

serve per dichiarare il bus di comunicazione del sensore ld2420

uart: id: ld2420_uart tx_pin: D6 # RX rx_pin: D7 # OT1 baud_rate: 115200 parity: NONE stop_bits: 1

ld2420:

text_sensor:

sensore presenza

sensor:

sensore temperatura e umidità dht22

sensore per potenza wifi

sensore luminosità

binary_sensor:

switch:

select:

number:

descipher commented 5 months ago

@Matteo8825 You will need to power cycle the LD2420, this is a know firmware issue on the v1.54 and up modules. There is a workaround for it that mostly by passes it in ESPHome v2024.3.0

descipher commented 5 months ago

@Matteo8825 when posting yaml please prefix the text with ''' on a line before it e.g it will format it as:


platform: ld2420
apply_config:
name: Applica configurazione
factory_reset:
name: Reset a impostazioni di fabbrica
restart_module:
name: Riavvio modulo
revert_config:
name: Undo modifiche
Matteo8825 commented 5 months ago

how can I turn it on and off, I don't understand because I already tried to turn off the power, but it didn't work

these are the values that it continuously marks for distance, while presence always remains off

[17:06:57][D][sensor:093]: 'Distanza di movimento': Sending state 14848.00000 cm with 0 decimals of accuracy [17:06:58][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy

[17:07:14][D][sensor:093]: 'Distanza di movimento': Sending state 19712.00000 cm with 0 decimals of accuracy [17:07:15][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy

[17:07:45][D][sensor:093]: 'Distanza di movimento': Sending state 56576.00000 cm with 0 decimals of accuracy [17:07:46][D][sensor:093]: 'Distanza di movimento': Sending state 35.00000 cm with 0 decimals of accuracy