Skip to content

Commit

Permalink
Add instructions for HLK-LD2410 and HLK-LD2410S (#1428)
Browse files Browse the repository at this point in the history
* Add HLK-LD2410

* Add LD2410S

* fix

---------

Co-authored-by: [email protected] <[email protected]>
  • Loading branch information
md5sum-as and [email protected] authored Nov 11, 2024
1 parent c4ff93e commit 96c7281
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ SetOption156<a class="cmnd" id="setoption156"></a>|`1` = (Sen5x) Run in passive
SetOption157<a class="cmnd" id="setoption157"></a>|`0` = hide NeoPool sensitive data _(default)_<BR>`1` = show NeoPool sensitive data
SetOption158<a class="cmnd" id="setoption158"></a>|`0` = Disable publish ModbusReceived MQTT messages (`1`), in this case you must use event trigger rules instead
SetOption159<a class="cmnd" id="setoption159"></a>|Set counting for Counter on falling edge or rising and falling edge<BR>`0` = Counter only reacts on falling edge _(default)_<BR>`1` = Counter reacts on falling and rising edge

SetOption160<a class="cmnd" id="setoption160"></a>|`1` = Disable generate moving event by sensor report - use LD2410 out pin for events

### TuyaMCU

Expand Down
102 changes: 102 additions & 0 deletions docs/HLK-LD2410.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# HLK-LD2410 24GHz mmWave presence sensor

??? failure "This feature is not included in precompiled binaries"

When [compiling your build](Compile-your-build) add the following to `user_config_override.h`:
```c++
#ifndef USE_LD2410
#define USE_LD2410
#endif
```

!!! warning "This feature is designed only to work with HLK-LD 2410, HLK-LD2410B and HLK-LD2410C modules. To work with the HLK-LD2410S module see [here](HLK-LD2410S.md)."

![HLK-LD2410(B)](_media/devices/HLK/LD2410/board_2410b.jpg)
![HLK-LD2410C](_media/devices/HLK/LD2410/board_2410c.png)

## Configuration
### Wiring
![HLK-LD2410-wiring](_media/devices/HLK/LD2410/2410_wiring.png)

| HLK-LD2410(B,C) | ESP |
|---|---|
|GND |GND
|VCC | 5V
|TX | GPIOx
|RX | GPIOy
|OUT | GPIOz

!!! Warning "Warning: The power supply voltage of the module is **5V**, and the power supply capacity of the input power supply is required to be greater than 200mA.<br>**The module IO output level is 3.3V!**"

### Tasmota Settings
In the **_Configuration -> Configure Module_** page assign:

- GPIOx to `LD2410 Tx`
- GPIOy to `LD2410 Rx`
- GPIOz to `Switch` or `Button`

??? example "Settings example"
<img src="../_media/devices/HLK/LD2410/2410_templ_example.png" width=50%>

## Usage
Tasmola is ready to read the status packet from the LD2410 module

<img src="../_media/devices/HLK/LD2410/2410_main_web.png" width=50%>

Console output:
```
12:52:46.234 RSL: SENSOR = {"Time":"2024-11-09T12:52:46","LD2410":{"Distance":[200.0,181.0,144.0],"Energy":[13,100]}}
```

If an object is detected, a report will be sent every second. You can disable sending every second by setting [`SetOption160`](Commands.md#setoption160) to `1`

### Commands

Set factory default settings:
```
LD2410Duration 0
```

Set no-one duration in seconds (default 5):
```
LD2410Duration 1..65535
```

Set moving distance sensitivity for up to 9 gates (at 0.75 meter interval):
```
LD2410MovingSens 50,50,40,30,20,15,15,15,15
```

Set static distance sensitivity for up to 9 gates (at 0.75 meter interval):
```
LD2410StaticSens 0,0,40,40,30,30,20,20,20
```
#### Engineering mode
Start/stop engineering mode:
```
LD2410EngineeringStart
LD2410EngineeringEnd
```

Read last sensors received in engineering mode command and output:
```
LD2410Get
```
```
13:40:21.997 RSL: RESULT = {"LD2410":{"Moving energy":[13,12,10,9,9,8,1,4,4],"Static energy":[0,0,100,100,45,32,147,15,5],"Light":103,"Out_pin":1}}
```

In engineering mode, the main page additionally displays the obtained values for moving and static targets:

<img src="../_media/devices/HLK/LD2410/2410_web_engineering.png" width=50%>

!!! info "Light sensor available if installed on board"

### Rules

You can use the LD2410 trigger to create rules, example:
```
rule1 ON LD2410 DO state ENDON
```
!!! warning "If [`SetOption160`](Commands.md#setoption160) is set to `1` rules wii be triggered only in log interval. Set [`SetOption160`](Commands.md#setoption160) to `0` for trigger on detected piople"

114 changes: 114 additions & 0 deletions docs/HLK-LD2410S.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# HLK-LD2410S Low energy 24GHz mmWave presence sensor

??? failure "This feature is not included in precompiled binaries"

When [compiling your build](Compile-your-build) add the following to `user_config_override.h`:
```c++
#ifndef USE_LD2410S
#define USE_LD2410S
#endif
```

!!! warning "This feature is designed only to work with HLK-LD 2410S module. To work with the HLK-LD2410(B,C) modules see [here](HLK-LD2410.md)."

<img src="../_media/devices/HLK/LD2410S/LD2410s_board.png" width=50%>

## Configuration
### Wiring
![HLK-LD2410S-wiring](_media/devices/HLK/LD2410S/2410S_pinout.png)

| HLK-LD2410S | ESP |
|---|---|
|GND |GND
|3V3 | 3.3V
|OT1 | GPIOx
|RX | GPIOy
|OT2 | GPIOz

!!! Warning "Warning: The power supply voltage of the module is **3.3V**"

### Tasmota Settings
In the **_Configuration -> Configure Module_** page assign:

- GPIOx to `LD2410S Rx`
- GPIOy to `LD2410S Tx`
- GPIOz to `Switch` or `Button`

??? example "Settings example"
<img src="../_media/devices/HLK/LD2410S/LD2410S_setting.png" width=50%>

## Usage
Tasmola is ready to read the status packet from the LD2410S module

<img src="../_media/devices/HLK/LD2410S/LD2410S_web.png" width=50%>

Console output:
```
15:46:09.267 RSL: SENSOR = {"Time":"2024-11-09T15:46:09","LD2410S":{"Distance":196.0, "People":2}}
```
Where **_People_** values: 0/1 - not detected, 2/3 - detected

### Commands

- **Reread common, trigger and hold parameters from device (_use this command after change module settings or after `LD2410S_AutoUpdate` command_):**
```
LD2410S_ReRead
```
- **Show previously received parameters on startup or after `LD2410S_ReRead` command:**
```
LD2410S_Parameters
```
and result:
```
15:55:56.399 RSL: RESULT = {"LD2410S_Common":{"Near Door": 0,"Far Door":16,"Hold Time":10,"Status freq":10,"Distance freq":10,"Response speed":5},"Trigger values":[47,46,37,35,31,30,31,32,31,30,29,31,30,29,27,29],"Hold values":[45,45,34,32,30,29,30,31,30,29,28,30,29,28,26,28]}
```
- **Set common parameters: near door, far door, hold_time, status_freq, distance_freq, response_speed (see [manual](https://www.hlktech.net/)):**
```
LD2410S_SetCommon 0-16,1-16,10-120,5-80,5-80,5/10
```
- **Set trigger values (the value at which the status changes to "people"):**
```
LD2410S_SetTrigger n,n1..n16
```
- **Set hold values (the value of holding the "people" status):**
```
LD2410S_SetHold n,n1..n16
```
- **Set device output mode `0`-short, `1`-normal:**
```
LD2410S_Out_Mode 0/1
```
_Console output in short mode:_
```
16:09:49.247 RSL: SENSOR = {"Time":"2024-11-09T16:09:49","LD2410S":{"Distance":0.0, "People":0}}
```
_Console output in normal mode:_
```
16:22:59.255 RSL: SENSOR = {"Time":"2024-11-09T16:22:59","LD2410S":{"Distance":187.0, "People":2, "Energy":[0,0,209,217,86,131,104,141,80,128,116,253,251,209,51,232]}}
```
- **Start autoupdate trigger and hold thresholds/ Params: trigger_scale,retension_factor,scan_time:**
```
LD2410S_AutoUpdate 2,1,60
```
_Concole output:_
```
16:29:58.239 RSL: SENSOR = {"Time":"2024-11-09T16:29:58","LD2410S":{"Update threshold":"0%"}}
16:29:59.261 RSL: SENSOR = {"Time":"2024-11-09T16:29:59","LD2410S":{"Update threshold":"2%"}}
16:30:00.277 RSL: SENSOR = {"Time":"2024-11-09T16:30:00","LD2410S":{"Update threshold":"3%"}}
...
16:31:01.230 RSL: SENSOR = {"Time":"2024-11-09T16:31:01","LD2410S":{"Update threshold":"100%"}}
```
And in main web page:<br><img src="../_media/devices/HLK/LD2410S/LD2410S_update.png" width=50%>

- **Start reports every seconds (need for tuning in normal output mode):**
```
LD2410S_Follow 0/1
```

### Rules

You can use the LD2410S trigger to create rules, example:
```
rule1 ON LD2410S#Distance >0 DO state ENDON
rule2 ON LD2410S#People =2 DO state ENDON
```
3 changes: 2 additions & 1 deletion docs/Supported-Peripherals.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ DS3502 | Digital potentiometer| I^2^C
**[HC-SR04<BR>HC-SR04P<BR>JSN-SR04T)](HC-SR04)** | Ultrasonic sensor | gpio
**HM330x** | SeedStudio Grove HM3301 particulate matter sensor | I^2^C
[**HMC5883L**](https://github.com/arendst/Tasmota/blob/development/tasmota/tasmota_xsns_sensor/xsns_101_hmc5883l.ino) | 3-Axis digital compass sensor | I^2^C
**HLK-LD2410** | 24GHz mmWave presence sensor | serial
**[HLK-LD2410<br>HLK-LD2410B](HLK-LD2410)** | 24GHz mmWave presence sensor | serial
**[HLK-LD2410S](HLK-LD2410S)** | Low energy 24GHz mmWave presence sensor | serial
**[Honeywell HIH](Honeywell-HIH)** | Temperature and humidity sensor| I^2^C
**Honeywell HPMA115xx** | Particulate matter sensor| serial
**HTU21** | Temperature and humidity sensor| I^2^C
Expand Down
Binary file added docs/_media/devices/HLK/LD2410/2410_main_web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/devices/HLK/LD2410/2410_wiring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/devices/HLK/LD2410/board_2410b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/devices/HLK/LD2410/board_2410c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/devices/HLK/LD2410S/2410S_pinout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/devices/HLK/LD2410S/LD2410S_web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 96c7281

Please sign in to comment.