Every smart home enthusiast reaches a point where traditional motion sensors fail to deliver on the promise of seamless automation. Whether you are reading quietly on the sofa, typing at your desk, or taking a warm bath, Passive Infrared (PIR) sensors inevitably timeout and switch off the lights. The HLK-LD2410 millimeter-wave (mmWave) radar completely eliminates this problem by detecting minute biometric displacements, such as human thoracic chest movements during normal respiration.
In this guide, we walk through building a production-grade, highly reliable human presence sensor using the HLK-LD2410B/C module, an ESP32 or ESP8266 microcontroller, and ESPHome for seamless integration into Home Assistant.
Why mmWave Radar Outperforms PIR Sensors
PIR sensors operate by monitoring differential infrared radiation across a dual-element pyroelectric crystal. When an organism with thermal radiation moves across the lens facets, a voltage pulse is generated. However, when motion ceases, the thermal gradient disappears, making PIR blind to stationary occupants.
The HLK-LD2410 operates as a 24 GHz Frequency Modulated Continuous Wave (FMCW) radar. By emitting continuous linear frequency sweeps and measuring the Doppler shift in reflected RF energy, it can identify:
- Macro Movement (Walking/Approaching): Large Doppler shifts across multiple distance bins up to 6 meters.
- Micro Movement (Breathing/Typing): Tiny phase variations within a single distance gate while remaining stationary.
- Absolute Distance: Discrete measurement of target location in 75 cm increments across 8 configurable gates.
Hardware Wiring and Pinout Architecture
The HLK-LD2410 module exposes five primary interface pins. While the sensor’s RF processing circuitry requires a stable 5V input, its serial communications logic operates safely at 3.3V, making it directly compatible with ESP32 and ESP8266 GPIO pins without requiring voltage level translation:
| HLK-LD2410 Pin | ESP32 NodeMCU / D1 Mini | Function & Description |
|---|---|---|
| VCC | 5V / VIN Rail | Main power input (requires clean 5V DC, peak 80mA) |
| GND | GND | Common system ground |
| TX | GPIO16 (RX2) | Sensor UART Transmit (connects to ESP RX) at 256000 baud |
| RX | GPIO17 (TX2) | Sensor UART Receive (connects to ESP TX) for dynamic tuning |
| OUT | GPIO4 (Optional) | Hardware presence digital pin (HIGH = Presence, LOW = Clear) |
Complete ESPHome Production Configuration
ESPHome includes native support for the LD2410 radar series. The following production-ready YAML configuration exposes all gate energy sensors, move/still thresholds, and configuration switches directly to Home Assistant:
esphome:
name: living-room-presence
friendly_name: "Living Room Presence Sensor"
esp32:
board: esp32dev
framework:
type: esp-idf
logger:
level: INFO
baud_rate: 0 # Disable serial logging to free UART pins
uart:
id: radar_uart
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2410:
id: my_ld2410
uart_id: radar_uart
throttle: 500ms
binary_sensor:
- platform: ld2410
has_target:
name: "Living Room Human Presence"
device_class: occupancy
has_moving_target:
name: "Living Room Moving Target"
device_class: motion
has_still_target:
name: "Living Room Static Occupancy"
device_class: occupancy
sensor:
- platform: ld2410
moving_target_distance:
name: "Moving Distance"
unit_of_measurement: "cm"
still_target_distance:
name: "Static Distance"
unit_of_measurement: "cm"
detection_distance:
name: "Current Detection Distance"
unit_of_measurement: "cm"
number:
- platform: ld2410
timeout:
name: "Absence Timeout"
max_move_distance_gate:
name: "Max Moving Gate"
max_still_distance_gate:
name: "Max Static Gate"
Calibrating Distance Gates to Eliminate False Triggers
The superpower of the HLK-LD2410 lies in its gate-level energy sensitivity. The detection range from 0 to 6 meters is divided into 8 discrete gates (~0.75m per gate):
- Gate 0 (0 – 0.75m): Close-range interactions (often kept around motion threshold 40, static 30).
- Gate 1 – 3 (0.75 – 3.0m): Primary seating or desk area. Lower the static threshold to 15–20 for reliable breathing detection.
- Gate 4 – 5 (3.0 – 4.5m): Perimeter zone. If you have an oscillating fan or window curtains in this area, raise the motion threshold to 75–85 to prevent phantom activations.
- Gate 6 – 8 (4.5 – 6.0m): Boundary cutoff. You can set the Max Detection Gate to Gate 4 to physically ignore motion beyond 3.75 meters (such as people walking in the hallway outside the room).
Recommended Enclosure and Physical Placement
- Mounting Height: Install the sensor at chest height (approximately 1.2 to 1.5 meters from the floor) angled slightly downward toward the primary seating area.
- Plastic Wall Mount: Enclose the electronics in a 3D-printed PETG or PLA case. The 24 GHz signal passes effortlessly through 1.5mm to 3mm plastic walls with less than 0.5 dB attenuation.
- Avoid Metallic Shielding: Keep the front face of the patch antenna at least 5mm away from any interior plastic walls to prevent near-field de-tuning, and never use metallic filament or screws near the RF path.











