ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
hmmd.h File Reference

Waveshare HMMD 24 GHz mmWave human micro-motion radar codec (PC_ENABLE_HMMD). More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

Waveshare HMMD 24 GHz mmWave human micro-motion radar codec (PC_ENABLE_HMMD).

The HMMD (Waveshare's FMCW micro-motion detection module, built on the S3KM1110 / SXKMxxx0 class of radar SoC) reports human presence and range over a 115200-baud UART, and additionally drives a bare GPIO OUT pin. It is a close relative of the HLK-LD2410 (services/ld2410) and shares its framing exactly - two frame kinds, the same magic sequences, a little-endian intra-frame length:

report: F4 F3 F2 F1 | len(2) | detect(1) | distance(2) | gate_energy[16](2 each) | F8 F7 F6 F5
command: FD FC FB FA | len(2) | word(2) | [value] | 04 03 02 01
#define F4(X, Y, Z)

A report's intra-frame length is PC_HMMD_REPORT_LEN (1 + 2 + 16*2 = 35), so a whole report frame is 4 + 2 + 35 + 4 = PC_HMMD_FRAME_MAX octets. Everything multi-octet is LITTLE-endian. Unlike the LD2410 the payload carries no head/tail marker or check byte - the header, footer, and the length agreeing with the buffer are the whole of the validation.

Where the LD2410 reports a moving/stationary split with 9 range gates, the HMMD reports a single detection flag, one distance, and the per-gate energy of 16 gates - it is a micro-motion detector, so "still person breathing" is the case it is built to catch.

This codec is pure and host-tested: ::pc_hmmd_parse_report decodes one report frame and ::HmmdStream reassembles frames byte-by-byte from a UART with resync on noise (no heap, fixed buffer), mirroring Ld2410Stream. The command encoders build the config frames, and ::pc_hmmd_parse_ack decodes the module's replies.

The module's GPIO OUT pin is a bare active-high presence line with no protocol at all. Feed it to PresenceCore from services/rcwl0516 (the shared one-GPIO presence facade) to get the same debounced, hold-extended presence the RCWL-0516 gets; that is an application-level wiring choice, so this service deliberately does not depend on that one.

Framing, the report payload layout, the command words, and the open/close command-mode encoding were taken from the public 2Grey/s3km1110 reference library and cross-checked for internal consistency (its kMaxFrameLength of 45 and kDistanceGateCount of 16 agree exactly with the 35-octet report payload derived here). No vendor SDK is used or required.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file hmmd.h.