← How-Tos
electronics 5 days ago ◑ 11 views ◯ 6 min read

mmWave Presence Sensing for Makers: Wiring the HLK-LD2410 to ESP32 for Smart Home and Robotics

mmwaveLD2410presence detectionESP32home assistantESPHomeradar sensorsmart home

PIR motion sensors have one job and one weakness: they see movement, not people. Sit still at a desk for two minutes and a PIR-driven light will switch off underneath you, because a passive infrared sensor only fires on the thermal edge of a moving object crossing its field of view. 24 GHz millimeter-wave (mmWave) radar modules solve this by detecting the tiny physical motion of breathing and micro-movement, which means they can report "someone is present" even when that someone is sitting dead still. The Hi-Link HLK-LD2410 (and its successors, the LD2410B and LD2410C) has become the default cheap mmWave module for makers because it is a complete radar-on-a-board for a few dollars, talks UART, and has first-class support in ESPHome. This guide covers wiring it to an ESP32, understanding what it actually reports, and the calibration work that separates a sensor that nags you with false triggers from one you forget is even there.

What the LD2410 Actually Measures

The LD2410 is a 24 GHz FMCW (frequency-modulated continuous-wave) radar that reports two independent distance values every reporting cycle: a "moving target" distance and a "static target" distance, each with its own energy/signal level per distance gate. In practice that means the sensor can tell you "there is motion 1.2 m away" and, separately, "there is a motionless body 1.8 m away" at the same time. This is the feature PIR cannot replicate: once a person stops moving, the moving-target report drops to zero but the static-target report keeps reporting their presence as long as they are breathing within range. The module divides its field of view into distance gates (roughly 0.75 m increments out to a configurable max, typically 6-8 m for the stock firmware) and has independent sensitivity thresholds per gate, which is the main lever you will pull during setup.

Wiring to an ESP32

LD2410 PinFunctionESP32 Connection VCCPower5V (the radio section wants a real 5V rail, not 3.3V, even though logic is 3.3V-tolerant) GNDGroundGND TXUART data outESP32 RX (any free UART-capable GPIO, e.g. GPIO16) RXUART data inESP32 TX (e.g. GPIO17) OUTSimple digital presence pinOptional GPIO input if you only want a binary occupied/vacant signal without UART parsing

The default UART baud rate is 256000, which is unusual but well within what the ESP32's hardware UART peripherals handle without issue; just make sure your software serial library (if you're not using ESPHome) supports that rate, since many Arduino SoftwareSerial implementations top out well below it. The OUT pin is a convenience: it goes high within about 1-2 seconds of detected presence (moving or static) and low after the configured no-presence delay, and some makers wire it directly to a relay or MOSFET gate for a zero-code occupancy switch. Most projects skip it entirely and read the richer UART data instead.

Getting It Running in ESPHome

ESPHome has a native ld2410 component that exposes the sensor's full feature set as entities: a binary "presence" sensor, separate "moving target" and "still target" binary sensors, distance sensors for each, and signal-strength sensors per gate if you enable engineering mode. A minimal configuration looks like this:

uart: id: uart_bus tx_pin: GPIO17 rx_pin: GPIO16 baud_rate: 256000 parity: NONE stop_bits: 1 ld2410: uart_id: uart_bus binary_sensor: - platform: ld2410 has_target: name: "Presence" has_moving_target: name: "Moving Target" has_still_target: name: "Still Target" sensor: - platform: ld2410 moving_distance: name: "Moving Distance" still_distance: name: "Still Distance"

Flash that and the sensor shows up in Home Assistant within a minute, fully native, with no cloud dependency and no polling delay — ESPHome pushes state changes as they happen.

Calibration: Sensitivity Gates and the False-Trigger Problem

Straight out of the box, the LD2410's default sensitivity settings are tuned for a generic "detect a person in a room" use case, which means in a workshop full of moving machinery, fans, and vibrating equipment it will report presence constantly whether anyone is there or not. The fix is per-gate sensitivity tuning, exposed in ESPHome as number entities for each of the 9 distance gates (0 through 8, each roughly 0.75 m), with separate "moving" and "still" thresholds per gate. The practical workflow: enable engineering mode (a switch entity ESPHome exposes), watch the live signal-strength values for each gate while the room is genuinely empty and your dust collector or CNC spindle is running, and raise the sensitivity threshold for any gate that lights up from vibration rather than a human body until it stops false-triggering with nobody present. Then walk into the room and confirm it still catches you at the gates that matter. This is iterative — it typically takes 10-15 minutes of walking in and out of a room while watching the dashboard to land on thresholds that are quiet when empty and instant when occupied.

A second common failure mode is placement: the LD2410's antenna pattern is a flattened cone, and mounting it low on a wall aimed at ankle height, or behind a metal enclosure that reflects its own signal back at it, produces erratic distance readings. Mount it at chest-to-head height, aimed roughly horizontally into the space you care about, with a plastic or 3D-printed enclosure (never a sealed metal box) and it behaves far more predictably.

mmWave vs PIR vs BLE Presence: Picking the Right Tool

SensorDetects stationary people?Through-wall/furniture?CostBest for PIRNo — needs motionNoLowestHallways, outdoor lights, simple motion triggers mmWave (LD2410)Yes — breathing detectionLimited (thin materials only)Low-moderateOccupied-room lighting, desk/workshop presence, bathroom fans BLE phone/tag trackingYes, but tracks the device not the bodyYes, room-levelLowWhole-house room-to-room location, leaves if phone leaves

These aren't competing technologies so much as complementary ones: a BLE presence tracker knows which room your phone last pinged from, while an LD2410 in that room confirms a body is actually still there even if the phone is left on a charger elsewhere. For a workshop, the LD2410's killer use case is keeping task lighting on while you stand at a bench reading a drawing or waiting on a glue-up, something a PIR will cheerfully switch off on you every single time.

Beyond Lighting: Robotics and Safety Interlocks

Because the LD2410 reports actual range-gated distance rather than a simple binary, it is also useful as a cheap proximity/safety sensor on small robots and machine interlocks — detecting that a person has stepped within a defined distance band of a moving part is a very different (and more useful) signal than "something moved nearby." It will not replace a certified safety light curtain on anything that can actually hurt someone, but for a hobby robot that should pause when a person gets close, or a shop light that should stay on a lathe operator even while they stand still cutting a long thread pass, it is a few dollars of hardware doing a job that used to require an array of PIRs or an always-on camera.

The LD2410 is one of those parts that quietly makes smart-home automation feel less dumb: lights that stay on while you're actually in the room, not just while you're twitching in it. Spend the fifteen minutes on gate calibration and placement, and it becomes invisible infrastructure rather than another gadget you have to work around.