LD2420 Human Presence Sensor

View on Amazon
Overview
About LD2420 Human Presence Sensor
The LD2420 is a high-performance 24GHz mmWave radar sensor designed for human presence detection, capable of sensing motion, micro-motion, and stationary targets within a range of up to 8 meters. It features UART and GPIO outputs, operates at 3.3V, and is suitable for a wide range of smart home and automation applications. The sensor supports flexible configuration options via UART and is compatible with ESPHome and Arduino environments. For firmware versions below 1.5.3, the baud rate is 256000; for newer firmware, it's 115200. No MicroPython or ESP-IDF libraries are available yet.
Get Your LD2420
💡 Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
LD2420 Specifications
Complete technical specification details for LD2420 Human Presence Sensor
📊 Technical Parameters
LD2420 Pinout
The **LD2420** is a 5-pin 24GHz mmWave radar with firmware-dependent baud rate:
Visual Pinout Diagram

Pin Types
Quick Tips
**Interface**: UART (baud depends on firmware version),📡 **Technology**: 24GHz FMCW radar,👤 **Detection**: Motion, micro-motion, and stationary presence,📏 **Range**: 0.3 to 8 meters
**Gates**: Configurable distance gates for zone-based detection,⚡ **Power**: 3.3V ONLY (not 5V tolerant),📊 **Baud Rate**: 256000 (firmware <1.5.3) or 115200 (firmware ≥1.5.3)
**Firmware**: Check firmware version to determine correct baud rate,💡 **OUT Logic**: 3.3V compatible, safe for ESP32 GPIO,🎯 **Applications**: Smart lighting, occupancy sensing, automation systems
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 VCC | Power | Power input | 3.3V DC only (not 5V tolerant) |
2 GND | Power | Ground connection | |
3 TX | Communication | UART transmit | Sends data from sensor (connect to ESP32 RX) |
4 RX | Communication | UART receive | Receives commands (connect to ESP32 TX) |
5 OUT | Communication | Digital presence output | 3.3V HIGH when presence detected (optional) |
Wiring LD2420 to ESP32
To interface the **LD2420** with an **ESP32** for presence detection via UART:
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| LD2420 Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 VCC Required | 3.3V | Power supply (3.3V only) | |
2 GND Required | GND | Ground | |
3 TX Required | GPIO16 (RX2) | Sensor transmit to ESP32 receive | |
4 RX Required | GPIO17 (TX2) | Sensor receive from ESP32 transmit | |
5 OUT Optional | GPIO18 | Digital presence output (optional) |
**UART2**: Use UART2 on ESP32 (GPIO16/17 are default UART2 pins)
**Baud Rate**: 256000 (firmware <1.5.3) or 115200 (≥1.5.3) - check firmware version
**Power**: 3.3V ONLY - do NOT connect to 5V (will damage sensor)
**TX/RX**: Connect sensor TX to ESP32 RX, sensor RX to ESP32 TX
**OUT Pin**: 3.3V logic level, safe for direct ESP32 GPIO connection
**Firmware Check**: Verify firmware version to set correct baud rate
**Configuration**: Use UART commands or ESPHome for gate configuration
**Distance Gates**: Configurable for precise zone-based detection
LD2420 Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: Sensor does not respond over UART.
Check firmware version: use 256000 baud for firmware < v1.5.3 and 115200 baud for ≥ v1.5.3. Ensure both TX and RX lines are properly connected.
Issue: The sensor does not detect movement.
Verify power is 3.3V. Confirm detection zones and sensitivity settings via UART or ESPHome configuration.
Issue: Sensor data updates inconsistently.
Ensure stable UART connection. Check signal quality and reduce environmental interference or obstacles.
Issue: Home Assistant shows unknown or unavailable sensor states.
Ensure sensor firmware matches baud rate in configuration. Also confirm ESPHome version supports LD2420.
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
LD2420 Programming Examples
Ready-to-use code examples for different platforms and frameworks
#if defined(ESP32)
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#define MONITOR_SERIAL Serial
#define RADAR_SERIAL Serial1
#define RADAR_RX_PIN 32
#define RADAR_TX_PIN 33
#elif CONFIG_IDF_TARGET_ESP32S2
#define MONITOR_SERIAL Serial
#define RADAR_SERIAL Serial1
#define RADAR_RX_PIN 9
#define RADAR_TX_PIN 8
#elif CONFIG_IDF_TARGET_ESP32C3
#define MONITOR_SERIAL Serial
#define RADAR_SERIAL Serial1
#define RADAR_RX_PIN 4
#define RADAR_TX_PIN 5
#else
#error Target CONFIG_IDF_TARGET is not supported
#endif
#else // ESP32 Before IDF 4.0
#define MONITOR_SERIAL Serial
#define RADAR_SERIAL Serial1
#define RADAR_RX_PIN 32
#define RADAR_TX_PIN 33
#endif
#elif defined(__AVR_ATmega32U4__)
#define MONITOR_SERIAL Serial
#define RADAR_SERIAL Serial1
#define RADAR_RX_PIN 0
#define RADAR_TX_PIN 1
#endif
#include <ld2410.h>
ld2410 radar;
uint32_t lastReading = 0;
bool radarConnected = false;
void setup(void)
{
MONITOR_SERIAL.begin(115200); //Feedback over Serial Monitor
//radar.debug(MONITOR_SERIAL); //Uncomment to show debug information from the library on the Serial Monitor. By default this does not show sensor reads as they are very frequent.
#if defined(ESP32)
RADAR_SERIAL.begin(256000, SERIAL_8N1, RADAR_RX_PIN, RADAR_TX_PIN); //UART for monitoring the radar
#elif defined(__AVR_ATmega32U4__)
RADAR_SERIAL.begin(256000); //UART for monitoring the radar
#endif
delay(500);
MONITOR_SERIAL.print(F("
Connect LD2410 radar TX to GPIO:"));
MONITOR_SERIAL.println(RADAR_RX_PIN);
MONITOR_SERIAL.print(F("Connect LD2410 radar RX to GPIO:"));
MONITOR_SERIAL.println(RADAR_TX_PIN);
MONITOR_SERIAL.print(F("LD2410 radar sensor initialising: "));
if(radar.begin(RADAR_SERIAL))
{
MONITOR_SERIAL.println(F("OK"));
MONITOR_SERIAL.print(F("LD2410 firmware version: "));
MONITOR_SERIAL.print(radar.firmware_major_version);
MONITOR_SERIAL.print('.');
MONITOR_SERIAL.print(radar.firmware_minor_version);
MONITOR_SERIAL.print('.');
MONITOR_SERIAL.println(radar.firmware_bugfix_version, HEX);
}
else
{
MONITOR_SERIAL.println(F("not connected"));
}
}
void loop()
{
radar.read();
if(radar.isConnected() && millis() - lastReading > 1000) //Report every 1000ms
{
lastReading = millis();
if(radar.presenceDetected())
{
if(radar.stationaryTargetDetected())
{
Serial.print(F("Stationary target: "));
Serial.print(radar.stationaryTargetDistance());
Serial.print(F("cm energy:"));
Serial.print(radar.stationaryTargetEnergy());
Serial.print(' ');
}
if(radar.movingTargetDetected())
{
Serial.print(F("Moving target: "));
Serial.print(radar.movingTargetDistance());
Serial.print(F("cm energy:"));
Serial.print(radar.movingTargetEnergy());
}
Serial.println();
}
else
{
Serial.println(F("No target"));
}
}
}The LD2420 is supported by the Bolukan/ld2420 Arduino library. This library provides initialization, data reading, and configuration functions for working with the LD2420 via UART. Developers should match the correct baud rate according to the sensor's firmware version (115200 or 256000).
# Example configuration entry
ld2420:
text_sensor:
- platform: ld2420
fw_version:
name: LD2420 Firmware
sensor:
- platform: ld2420
moving_distance:
name : Moving Distance
binary_sensor:
- platform: ld2420
has_target:
name: Presence
select:
- platform: ld2420
operating_mode:
name: 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
# See "Number" section below for detail
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 EditsThe LD2420 is natively supported by ESPHome. The official component allows full UART communication and exposes multiple binary and numeric sensors such as presence state, motion energy, and distance. Refer to the documentation at esphome.io for configuration examples. Ensure baud rate and firmware compatibility (256000 for firmware <1.5.3, 115200 for ≥1.5.3).
No official PlatformIO support exists for the LD2420 sensor at this time. Developers can use the Arduino library manually within a PlatformIO project if needed.
There is currently no MicroPython driver for the LD2420. Developers may implement their own UART-based parser based on the official datasheet protocol.
Wrapping Up LD2420
The ESP32 LD2420 Human Presence Sensor is a powerful Human Presence sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the LD2420 into your ESP32 project and bring your ideas to life!
Explore Alternative Sensors
Looking for alternatives to the LD2420? Check out these similar sensors that might fit your project needs.

LD2450 Human Presence Sensor
The LD2450 is a 24GHz mmWave radar sensor designed for precise human presence detection and tracking. It supports both UART and BLE...

MR24HPB1 Human Presence Radar Sensor
The MR24HPB1 is a high-sensitivity 24GHz radar sensor capable of detecting human presence and motion. It communicates via UART and is ideal...

LD2410S Human Presence Sensor
The LD2410S is an ultra-low-power 24GHz mmWave radar sensor for human presence detection, supporting both stationary and moving target...




