LD2420 24GHz mmWave 雷达传感器
ld2420 传感器平台允许您使用 HLK-LD2420 运动和存在传感器。此传感器需要在您的配置中设置 UART 才能工作。
根据固件版本,串口波特率在固件低于 v1.5.3 的任何模块上为 256000,在新版本上为 115200。从固件 v1.5.3 开始,tx_pin 从 ot2 更改为 ot1。 固件 v1.5.4 及以上版本新增了观察门能量信号水平的功能,通过此 版本我们可以动态校准门的静止和运动阈值。
此组件具有动态配置功能,采用紧凑的 UI 格式。 选择器、数值和按钮组件提供配置值输入和控制。

固件 1.5.2 及更早版本
Section titled “固件 1.5.2 及更早版本”| 引脚# | 名称 | 功能 |
|---|---|---|
| 1 | 3v3 | VCC |
| 2 | GND | GND |
| 3 | OT1 | 存在信号输出 |
| 4 | RX | 串口 Rx(到 ESP Tx) |
| 5 | OT2 | 串口 Tx(到 ESP Rx) |
固件 1.5.3 及更新版本
Section titled “固件 1.5.3 及更新版本”| 引脚# | 名称 | 功能 |
|---|---|---|
| 1 | 3v3 | VCC |
| 2 | GND | GND |
| 3 | OT1 | 串口 Tx(到 ESP Rx) |
| 4 | RX | 串口 Rx(到 ESP Tx) |
| 5 | OT2 | 存在信号输出 |
# Example configuration entryld2420:
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 Editsld2420:ld2420(必选): 组件平台。
运行模式:
select: - platform: ld2420 operating_mode: name: Operating Mode动态 UI 提供三种运行模式:正常、校准和简单。选择器组件允许 您选择活动模式。
-
正常:这是默认模式。它将 ld2420 设置为能量报告模式,适用于固件 v1.5.4 或更高版本。在此模式下,模块持续在本地数组中记录所有门的能量水平,使其 可用于动态校准功能。
-
校准:选择校准模式时,模块将收集平均和峰值能量水平, 每五秒报告一次。报告在日志控制台中提供,仅供参考。为了 校准门的配置,目标环境中不应存在任何物体。记录将 建立 mmWave 噪声底限水平和不希望出现的反射或信号失真峰值。这应至少 收集 30 秒。较长的运行可以在模块附近设备(如微波炉和其他噪声源)使用时捕捉到更多潜在虚假信号。
在校准模式下按下 apply_config 按钮时,LD2420 将根据其收集的噪声底限数据以计算出的值 进行配置,模块将返回正常模式。选择任何其他模式将丢弃 会话收集的噪声数据,且不暂存任何更改的设置。一旦执行了 apply_config 操作,计算出的值 将持久保存。门的值可以手动调整或再次校准,也可以使用 工厂重置按钮恢复模块的默认设置。
-
简单:提供与固件 v1.5.3 及更早版本的向后兼容性,当 检测到的固件版本为 v1.5.3 或更早版本时将自动设置。
- operating_mode(必选): 提供运行模式选择器组件。 可包含来自 Select 的任何选项。
number: - platform: ld2420 presence_timeout: name: Detection Presence Timeout min_gate_distance: name: Detection Gate Minimum max_gate_distance: name: Detection Gate Maximum
gate_select: name: Select Gate to Set still_threshold: name: Set Still Threshold Value move_threshold: name: Set Move Threshold Value
gate_move_sensitivity: name: Move Calibration Sensitivity Factor gate_still_sensitivity: name: Still Calibration Sensitivity Factor
gate_0: move_threshold: name: Gate 0 Move Threshold still_threshold: name: Gate 0 Still Threshold gate_1: move_threshold: name: Gate 1 Move Threshold still_threshold: name: Gate 1 Still Threshold-
presence_timeout (可选): 在不再检测到存在后,占用状态(存在)将持续保持的 秒数。时间窗口内的任何能量检测都会从此值重新启动倒计时。 默认为 120s。当指定了
min_gate_distance和max_gate_distance时为必需。可包含 来自 Number 的任何选项。 -
min_gate_distance (可选): 运动或静止能量检测的最小距离。值介于 0 到
max_gate_distance- 1 之间。每次递增等于 70 厘米。默认为 1。当指定了presence_timeout和max_gate_distance时为必需。可包含来自 Number 的任何选项。 -
max_gate_distance (可选): 运动检测的最大门。值从 1 到 15。每个门以 70 厘米递增检测运动和静止能量。在最大值处,传感器范围约为 12 米;然而,此范围的精度可能有所降低。推荐的最大值为 12,结果 约为 9 米。当指定了
presence_timeout和min_gate_distance时为必需。可包含 来自 Number 的任何选项。 -
gate_still_sensitivity (可选): 门静止阈值校准灵敏度因子。默认为 0.5, 范围为 0-1,0 = 高,1 = 低。可包含来自 Number 的任何选项。
-
gate_move_sensitivity (可选): 门运动阈值校准灵敏度因子。默认为 0.5, 范围为 0-1,0 = 高,1 = 低。可包含来自 Number 的任何选项。
-
gate_select (可选): 选择要编辑的门值(门 # 从 0 到 15)。门阈值 通过选择门编号然后调整运动和静止阈值来编辑。注意,当 定义了此变量时,组件将以紧凑 UI 模式运行,此时以下两个配置变量成为 必需: 可包含来自 Number 的任何选项。
-
gate_n (可选): 提供单独的门阈值数值输入。范围为
gate_0到gate_15。 不可与gate_select(上方)一起使用。每个门条目都需要一个still_threshold和move_threshold:
button: - platform: ld2420 apply_config: name: Apply Config factory_reset: name: Factory Reset restart_module: name: Restart Module revert_config: name: Undo Edits提供四个按钮组件,实现对 LD2420 模块的编辑、保存、重启和工厂重置的配置控制。
-
apply_config(必选): 保存手动配置调优或自动校准的静止和运动阈值配置 设置。可包含来自 Button 的任何选项。
-
restart_module (可选): 重启 LD2420 模块。可包含来自 Button 的任何选项。
-
revert_config (可选): 撤销在通过
apply_config按钮应用之前的进行中编辑。 可包含来自 Button 的任何选项。 -
factory_reset (可选): 恢复 LD2420 的基础配置值集。可包含来自 Button 的任何选项。
| 设置: | 值: |
|---|---|
| 超时 | 120s |
| 最小门距离 | 1 |
| 最大门距离 | 12 |
| 门编号: | 运动阈值 | 静止阈值 |
|---|---|---|
| 0 | 60000 | 40000 |
| 1 | 30000 | 20000 |
| 2 | 400 | 200 |
| 3 | 300 | 250 |
| 4 | 250 | 150 |
| 5 | 250 | 150 |
| 6 | 250 | 150 |
| 7 | 250 | 150 |
| 8 | 300 | 150 |
| 9 | 250 | 150 |
| 10 | 250 | 150 |
| 11 | 250 | 150 |
| 12 | 250 | 100 |
| 13 | 200 | 100 |
| 14 | 200 | 100 |
| 15 | 200 | 100 |
ld2420 传感器允许您使用 Ld2420 近似传感器与
其检测场中移动的物体之间的距离。
sensor: - platform: ld2420 moving_distance: name : Moving Distance- moving_distance (可选): 传感器与检测到的运动目标之间的距离。可包含来自 Sensor 的任何选项。
ld2420 二值传感器允许您使用 Ld2420 感知存在。
binary_sensor: - platform: ld2420 has_target: name: Presence- has_target (可选): 如果检测到静止或运动的目标,则在 presence_time_window 设置期间 has_target 将设为 true。 可包含来自 Binary Sensor 的任何选项。
ld2420 文本传感器为 Ld2420 提供版本信息。
text_sensor: - platform: ld2420 fw_version: name: LD2420 Firmware- fw_version (可选): 允许您获取 Ld2420 固件版本。可包含来自 Text Sensor 的任何选项。
detection_gate_max 和 detection_gate_min 之外的固体物体和噪声可能导致虚假
检测或导致异常门阈值。例如,门最大范围内的墙壁可能导致
信号反射。如果传感器报告了意外的检测,应在一个
完全开放且没有移动物体的房间中进行测试。
另外,切勿以检测场重叠的方式放置两个或更多传感器,因为这必定 会导致虚假检测。
固件更新功能可使用 HLKTech 提供的 LD2420 工具。 您需要向他们发送电子邮件并索取 bin 文件。 目前只有固件版本 v1.5.6 及以上版本可以升级。 请勿尝试更新到更早的固件版本。这将导致模块变砖。
- 官方网站
https://www.hlktech.net/