The Hi-Link LD2410 talks 256000 baud, 8N1, 3.3 V logic, on the LD2410C board with 2.54 mm pins. Aliases: LD2410, LD2410B, LD2410C, HLK-LD2410, Hi-Link, mmWave, 24 GHz radar, human presence sensor, occupancy sensor.
Pins
| Pin | Name | What it does |
|---|---|---|
| 1 | TX |
Reports and answers out, 3.3 V logic. |
| 2 | RX |
Commands in, 3.3 V logic. |
| 3 | OUT |
High (3.3 V) while someone is there, low when nobody is. |
| 4 | GND |
Ground. |
| 5 | VCC |
Supply, 5 V (the manual allows up to 12 V). |
The report
About ten times a second the radar sends F4 F3 F2 F1, a two byte length, the data, and
F8 F7 F6 F5. Numbers are little-endian. The basic data is 13 bytes: 02 AA, the target
state (0 nobody, 1 moving, 2 still, 3 both), the moving target's distance in cm (2 bytes)
and energy (0 to 100), the still target's distance and energy, the detection distance
(2 bytes), and 55 00. In engineering mode the type is 01 and each distance gate's moving
and still energy follow, 35 bytes in all.
Gates and sensitivity
The radar splits its range into gates 0 to 8, each 0.75 m deep (or 0.2 m). A target counts when its gate is no further than the maximum gate (8 from the factory) and its energy is over that gate's sensitivity. The factory moving sensitivities are 50, 50, 40, 30, 20 and then 15; the still ones from gate 2 are 40, 40, 30, 30, 20, 20, 20. After the person leaves, the radar goes on reporting them, and holds OUT high, for the no-one duration: 5 seconds from the factory.
Commands
Each is FD FC FB FA, a length, a two byte command word, its value, and 04 03 02 01, and
is answered in the same frame with the word plus 0x0100 and a status (0 success). Send
"enable configuration" (FF 00 01 00) first: the radar ignores anything else until then,
and stops reporting until "end configuration" (FE 00).
| Word | What it does |
|---|---|
0x0060 |
Maximum moving and still gate (2 to 8) and the no-one duration in seconds. |
0x0061 |
Read every setting. |
0x0062 / 0x0063 |
Engineering mode on / off. |
0x0064 |
One gate's moving and still sensitivity, or all gates with 0xFFFF. |
0x00A0 |
Firmware version. |
0x00A1 |
Baud rate, 9600 to 460800, after a restart. |
0x00A2 |
Factory settings, after a restart. |
0x00A3 |
Restart. |
0x00AA / 0x00AB |
Set / read the gate depth, 0.75 m or 0.2 m (set after a restart). |
The settings outlive a power cut; engineering mode does not.
Properties
| Property | What it is |
|---|---|
presence |
Who is there: 0 nobody, 1 moving, 2 still, 3 both. |
moving_cm, still_cm |
How far the moving and the still person are, 0 to 1000 cm. |
moving_energy, still_energy |
Their signal energy, 0 to 100. |
The three sliders on the part set the first three while it runs.
Libraries
ld2410.h (ncmreynolds' ld2410 library): radar.begin(Serial1), then radar.read() as
often as you can, and presenceDetected(), movingTargetDetected(),
movingTargetDistance(), stationaryTargetDetected() and their energies.
setMaxValues(), setGateSensitivityThreshold(), requestCurrentConfiguration() and the
engineering mode calls send the commands above. Or just read OUT with digitalRead().
Which boards can keep up
256000 baud is a bit every 3.9 microseconds, too fast for SoftwareSerial. Use a hardware
serial port: an ESP32's Serial1 or Serial2 (any baud rate, set exactly), or a Mega's
Serial1 to Serial3, where 16 MHz makes 250000 baud, 2.3 percent slow, which the radar
still reads. On an Uno the one hardware port is the serial monitor's, so use OUT alone,
or set the radar to 9600 baud first with command 0x00A1.
What the model gets right
The frames, the commands and their answers, the configuration mode, the gates, the sensitivities and maximum gates, the no-one hold on the reports and on OUT, engineering mode, the baud rate and gate depth that wait for a restart, and the factory settings are the Hi-Link manual's (LD2410C protocol V1.00). The firmware version and MAC address are the manual's examples.
What it does not model
There is no radio: the energies are what is set, and the distances hold still where a real radar's wander. The manual gives no report rate, answer time or restart time, so the model reports every 100 ms, answers in 10 ms and restarts in 1 second. Bluetooth commands are answered but nothing goes over the air. The still sensitivity of gates 0 and 1 cannot be set, as on the real radar; here it reads 0, so a still person that close is always seen.
Common mistakes
Using SoftwareSerial at 256000 baud: it cannot keep up. Forgetting the enable configuration command, so every other command is ignored. Expecting OUT to drop the moment someone leaves: it waits the no-one duration.
See it in action
LD2410 presence radar runs the radar on a Mega's Serial1 with the ld2410 library and lights the LED from OUT. Open it at /templates.