Hi_Link_LD2410C
Driver for the Hi-Link HLK-LD2410C 24 GHz mmWave human presence radar connected through a serial port; outputs the decoded target state, distances and energies.
Processing
- At start the port is opened at 256000 baud (8N1). The sensor is put into configuration mode, the firmware version, distance resolution and current detection settings (maximum gates, sensitivities, no-one duration) are written to the console, engineering mode is switched on or off according to engineering_mode, and configuration mode is closed. Every command waits for its acknowledgement; if one does not come, the component stops with an error.
- If apply_sensor_settings is true, the detection settings that differ from the properties are written to the sensor and read back for checking. These settings are stored in the sensor and remain after power-off. If it is false, the sensor settings are not changed.
- The serial port is read every polling_ratio_in_ms. Report frames (header F4 F3 F2 F1, tail F8 F7 F6 F5) are extracted from the received bytes and checked (length, AA/55/00 markers, tail). Malformed frames are dropped; their number is written to the console when the component stops.
- Each valid frame is output once; all outputs of a frame carry the time at which the bytes were read.
- polling_ratio_in_ms is limited to 50 ms (20 Hz, twice the report rate), so a read normally contains at most one frame. Reads that still contained several frames (they share one timestamp) are counted and written to the console when the component stops.
Usage
- Typical outputs:
moving_distance_in_m→Oscilloscope.inputA;stationary_distance_in_m→Oscilloscope.inputB;detection_distance_in_m→Oscilloscope.inputC;target_state→Oscilloscope.inputA.
Data format
- target_state: 0 no target, 1 moving, 2 stationary, 3 moving and stationary (4 to 6 only during background noise detection).
- Distances are converted from cm to m. Energies are 0 to 100.
- Engineering mode only: moving_gate_energy and stationary_gate_energy have one value per distance gate 0 to N (9 values with the factory setting; 0.75 m per gate), light_level is 0 to 255 and out_pin is the state of the OUT pin. In basic mode these four outputs are not written.
Notes
- Set port_name to the serial device (e.g. COM3 or /dev/ttyUSB0). The sensor must use its factory baud rate 256000.
- The detection settings are changed only when apply_sensor_settings is true. The property defaults equal the factory settings; run once with them and apply_sensor_settings = true to restore the factory settings.
- The sensor reports at about 10 Hz.
- Version 1.02: the raw data output was replaced by the decoded outputs; engineering_mode and the detection setting properties were added.
- Version 1.03: polling_ratio_in_ms must be 1 to 50; a larger value (e.g. 100 saved by version 1.01) stops the component with an error.
References
- [1] Shenzhen Hi-Link Electronic Co., Ltd., HLK-LD2410C Serial Communication Protocol, V1.07, 2024-08-05. — Used for: serial frames, commands and report data.
Properties
| Name | Default | Description |
|---|---|---|
port_name | COM1 | Serial port name (e.g. COM3 or /dev/ttyUSB0). Must not be empty. |
engineering_mode | true | If true, the sensor is put into engineering mode and the per-gate energies, light level and OUT pin state are output. |
polling_ratio_in_ms | 10 | Period at which the serial port is read, in millisecond (1 to 50; otherwise the component stops with an error). The limit keeps the polling at 20 Hz or faster, twice the report rate of about 10 Hz. |
apply_sensor_settings | false | If true, the five detection settings below are written to the sensor (only the values that differ). They are stored in the sensor and remain after power-off. |
max_moving_gate | 8 | Farthest gate (2 to 8) for moving targets. Used only when apply_sensor_settings is true. |
max_stationary_gate | 8 | Farthest gate (2 to 8) for stationary targets. Used only when apply_sensor_settings is true. |
no_one_duration_in_s | 5 | Time in second (0 to 65535) after the last detection before the state becomes no target. Used only when apply_sensor_settings is true. |
moving_sensitivity | 50,50,40,30,20,15,15,15,15 | Motion sensitivity of gates 0 to 8: nine comma-separated integers from 0 to 100. A target is detected when its energy exceeds the value; 100 disables the gate. Used only when apply_sensor_settings is true. |
stationary_sensitivity | 0,0,40,40,30,30,20,20,20 | Stationary sensitivity of gates 0 to 8 (same format). Gates 0 and 1 cannot be set and are ignored. Used only when apply_sensor_settings is true. |
Outputs
| Name | Description |
|---|---|
target_state | Target state: 0 none, 1 moving, 2 stationary, 3 both (4 to 6: background noise detection). Type: Integer32 |
moving_distance_in_m | Distance of the moving target in meter. Type: Float64 |
moving_energy | Energy of the moving target (0 to 100). Type: Integer32 |
stationary_distance_in_m | Distance of the stationary target in meter. Type: Float64 |
stationary_energy | Energy of the stationary target (0 to 100). Type: Integer32 |
detection_distance_in_m | Detection distance in meter. Type: Float64 |
moving_gate_energy | Motion energy of each distance gate 0 to N (engineering mode only). Type: Integer32 |
stationary_gate_energy | Stationary energy of each distance gate 0 to N (engineering mode only). Type: Integer32 |
light_level | Value of the light sensor, 0 to 255 (engineering mode only). Type: Integer32 |
out_pin | State of the OUT pin, 1 when a person is detected (engineering mode only). Type: Integer32 |
RTMaps Toolkits Documentation