Using the HLK-LD2420 Sensor with an ESP32-C3 Supermini in ESPHome

If you’re trying to integrate the HLK-LD2420 24 GHz radar module into ESPHome on an ESP32-C3 board (specifically a “C3 Supermini” style dev board) and finding that ESPHome reports a firmware version of v0.0.0—or simply marks the component as “FAILED”—this guide should help you get it up and running.

Common Symptoms of the Problem

  1. You see messages like:[C][ld2420:069]: Firmware Version : v0.0.0 [W][ld2420:090]: LD2420 Firmware Version v0.0.0 and older are only supported in Simple Mode [E][component:082]: Component ld2420 is marked FAILED in the ESPHome logs.
  2. Changing your UART baud rate (115200 vs 256000) or swapping between the sensor’s OT1, OT2, and RX pins doesn’t appear to make any difference, and the sensor is never recognized correctly.

Root Causes

  • Incorrect wiring (mixing up TX/RX lines, or using the wrong pins on the ESP32-C3).
  • Inadequate power (many HLK-LD2420 modules need 5 V supply to power up fully).
  • ESP32-C3 default pins often conflict with internal USB-CDC (UART0) or with strapping (boot) pins, preventing reliable UART communication.
  • Baud rate mismatch (newer LD2420 modules typically use 115200 bps by default, while older firmware versions used 256000 bps).

Module & Documentation Links

Pinout for HLK-LD2420 (5-Pin Version)

Typically, the 5-pin HLK-LD2420 board is labeled as follows:

3V3   GND   OT1   RX   OT2
  • OT1: Transmit (TX) from the sensor’s perspective
  • RX: Receive (RX) from the sensor’s perspective
  • OT2: Another digital output (often used for a secondary trigger signal)

For UART communication, you only need OT1 (the sensor’s TX) and RX (the sensor’s RX). You also need 3V3 or 5V (depending on your module specs) and GND.

Important: Many people report the HLK-LD2420 requires 5 V on the power pin to operate reliably, even though the board label says “3V3.” If 3.3 V does not work, use 5 V. The UART signal lines typically remain 3.3 V logic.

Pinout for the ESP32-C3 Supermini

Below is a typical pinout diagram (note that some C3 Supermini boards differ slightly). In this example, we choose GPIO6 (RX) and GPIO7 (TX) for our custom UART.

Why GPIO6 & GPIO7?

  • They are generally not tied directly to the internal USB-CDC lines (unlike GPIO20 & GPIO21 on some boards).
  • They are less likely to cause conflicts with other essential strapping pins.
  • They typically support using uart: in ESPHome without disabling console USB logs.

Wiring Diagram

  1. Power
    • HLK-LD2420 3V3 or 5V5V pin on your ESP32-C3 dev board (or an external 5 V supply).
    • HLK-LD2420 GNDGND on the ESP32-C3.
  2. UART Lines
    • HLK-LD2420 OT1 (sensor TX) → ESP32-C3 GPIO6 (configured as RX).
    • HLK-LD2420 RX (sensor RX) → ESP32-C3 GPIO7 (configured as TX).
  3. Optional: HLK-LD2420 OT2 can be left unconnected unless you want that additional output signal.

ESPHome Configuration Example

Below is an example of a working ESPHome configuration using GPIO6 and GPIO7 for UART and 5 V supply. This snippet also shows two GPIO switches for controlling external relays (on GPIO2 and GPIO3):

...

# UART for HLK-LD2420
uart:
id: ld2420_uart
tx_pin: GPIO7 # C3 TX -> Sensor RX
rx_pin: GPIO6 # C3 RX -> Sensor TX (OT1)
baud_rate: 115200

# HLK-LD2420 Sensor
ld2420:
# no extra config needed if default advanced mode is enough
# the firmware is typically 1.5.3+ (2.1.0 in some cases)

text_sensor:
- platform: ld2420
fw_version:
name: "LD2420 Firmware Version"

sensor:
- platform: ld2420
moving_distance:
name: "Moving Distance"

binary_sensor:
- platform: ld2420
has_target:
name: "Presence"

select:
- platform: ld2420
operating_mode:
name: "LD2420 Operating Mode"

number:
- platform: ld2420
presence_timeout:
name: "Detection Presence Timeout"
min_gate_distance:
name: "Detection Gate Minimum"
max_gate_distance:
name: "Detection Gate Maximum"
gate_select:
name: "Select Gate to Set"
still_threshold:
name: "Set Still Threshold Value"
move_threshold:
name: "Set Move Threshold Value"

button:
- platform: ld2420
apply_config:
name: "Apply Config"
factory_reset:
name: "Factory Reset"
restart_module:
name: "Restart Module"
revert_config:
name: "Undo Edits"

# Example: two relay outputs on GPIO2 and GPIO3
switch:
- platform: gpio
name: "Rele 1"
id: relay1
pin: GPIO2
restore_mode: ALWAYS_OFF

- platform: gpio
name: "Rele 2"
id: relay2
pin: GPIO3
restore_mode: ALWAYS_OFF

Once you flash this onto your ESP32-C3 and wire the HLK-LD2420 correctly, the ESPHome logs should show a correct firmware version (e.g., v1.9.x, v2.1.x, etc.) instead of v0.0.0. You’ll be able to see presence detection data, distance data, and configure gates or thresholds in Home Assistant.

Key Points & Best Practices

  1. Use 5 V power if 3.3 V does not work—many HLK modules need the higher voltage even though labeled “3V3.”
  2. Choose UART pins carefully on the ESP32-C3. Avoid default USB-CDC pins or ones that cause a build-time conflict (e.g., GPIO20 or GPIO21).
  3. Check strapping pin warnings. You can still use GPIO6/7/8/9, but watch out for external pull-ups or pull-downs that might disrupt the boot process.
  4. Baud Rate: Most HLK-LD2420 modules running firmware ≥ 1.5.3 default to 115200 baud. Older versions may need 256000 baud.
  5. Verify the sensor physically. If in doubt, test it with a USB-TTL serial adapter (5 V supply, 3.3 V signals) to confirm you can read data from OT1 at 115200.

Conclusion

If your LD2420-based radar module was constantly showing v0.0.0 and failing to connect in ESPHome, the fix is usually:

  1. Supply the module with 5 V.
  2. Wire OT1 → ESP32-C3 RX and RX → ESP32-C3 TX.
  3. Configure a suitable pair of GPIO pins (e.g., 6 & 7) for UART at 115200 baud.

With this setup, you should be able to take full advantage of the LD2420’s presence detection capabilities and advanced configuration features within Home Assistant. Enjoy your now fully-functional radar sensor!