ESP32 LD2411S Human Presence Sensor
Overview
The LD2411S is a 24GHz mmWave radar sensor for human presence detection, supporting both motion and micro-motion detection. It includes Bluetooth functionality for configuration and firmware updates. Due to its unique UART communication protocol, it is not widely compatible with standard libraries.
About LD2411S Human Presence Sensor
The LD2411S is a 24GHz mmWave radar sensor designed for human presence detection. It features both motion and micro-motion detection capabilities, with a detection range of up to 6 meters. The sensor includes Bluetooth functionality, allowing for configuration and firmware updates via the HLKRadarTool app. However, due to its unique UART communication protocol, it is not widely compatible with standard libraries. For more information on the LD2410 series, see LD2410.
Where to Buy
Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
Technical Specifications
Pinout Configuration
The VCC
pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND
pin is the ground connection and must be connected to the ground of your ESP32.
The LD2411S module is a compact, high-precision 24GHz radar sensor capable of detecting both motion and stationary presence. It includes a UART interface for data communication and configuration, along with a digital output pin for immediate presence indication. The pin layout is as follows:
VIN
– Power input pin. Connect to a regulated 5V source. Supplying the correct voltage is essential for reliable performance and sensor longevity.GND
– Ground connection. This must be tied to the same ground as the ESP32 or host microcontroller to ensure proper UART signaling and power stability.TXD
– UART transmit pin. Outputs data from the LD2411S. This pin should be connected to the RX pin (e.g., GPIO16) on the ESP32.RXD
– UART receive pin. Receives configuration or control commands from the host. Connect this pin to the TX pin (e.g., GPIO17) of the ESP32.OUT
– Optional digital output pin. This line goes HIGH (3.3V logic) when presence is detected. It is useful for triggering external interrupts, LEDs, or simple binary logic systems.
Note: While powered via 5V, the OUT signal operates at 3.3V logic, making it safe to connect directly to ESP32 GPIOs without level shifting.
Wiring with ESP32
The LD2411S can be connected to an ESP32 for UART-based communication and optional presence signaling via the OUT pin. Below is a recommended wiring setup, typically using UART2 on the ESP32:
VIN
(red wire) → 5V on ESP32. Provides the main supply voltage for the sensor’s radar and MCU circuitry.GND
(black wire) → GND on ESP32. This common ground reference is essential for clean UART signals and electrical stability.TXD
(green wire) → GPIO16 (RX on ESP32). This connection enables the ESP32 to receive real-time radar data from the LD2411S.RXD
(blue wire) → GPIO17 (TX on ESP32). This line allows the ESP32 to send configuration parameters to the sensor module.OUT
(yellow wire, optional) → GPIO18 on ESP32 if you want to monitor the presence signal directly using a GPIO interrupt or polling logic.
Important: Set the ESP32 UART baud rate to 115200
to match the LD2411S protocol. Also, ensure that BLE is disabled if using a UART-over-Bluetooth firmware, as some versions may conflict with the serial interface.
Troubleshooting Guide
Common Issues
🚫 No Data Received
Issue: The ESP32 receives no data from the sensor.
Ensure correct wiring: swap TX and RX if needed, and confirm baud rate is set to 115200. Verify power is supplied at 5V.
❌ Presence Not Detected
Issue: The sensor does not detect presence even when someone is in range.
Check detection parameters using the HLKRadarTool app. Ensure UART communication is functioning correctly.
⚠️ Intermittent Detection
Issue: Sensor intermittently detects presence or fails to maintain detection.
Adjust detection thresholds using the HLKRadarTool app. Reposition sensor to minimize obstructions.
🔌 UART Initialization Fails
Issue: UART component in ESPHome reports failure to initialize.
Verify UART pins are correct, baud rate is 115200, and no other component is using the same UART bus.
Debugging Tips
🔍 Serial Monitor
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.
⚡ Voltage Checks
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
Code Examples
Arduino Example
As of now, there is no official Arduino library available for the LD2411S sensor. Due to its unique UART communication protocol at 115200 baud, existing LD2410 libraries are incompatible. Developers interested in integrating the LD2411S with Arduino are advised to refer to the sensor's datasheet and implement custom UART communication handling based on the provided protocol specifications.
ESPHome Example
The LD2411S sensor is not currently supported by the official ESPHome LD2410 component due to its different UART protocol and baud rate of 115200. However, there is a custom ESPHome component available that provides preliminary support for the LD2411S. You can find this custom component at Chreece/LD2411S-ESPHome. Please note that this is a community-developed solution and may require additional configuration and testing.
PlatformIO Example
Currently, there is no official PlatformIO library available for the LD2411S sensor. Developers aiming to integrate the LD2411S with PlatformIO should refer to the sensor's datasheet and implement custom UART communication handling based on the provided protocol specifications.
MicroPython Example
At present, there is no official MicroPython library for the LD2411S sensor. Due to its unique UART communication protocol at 115200 baud, existing LD2410 libraries are incompatible. Developers interested in integrating the LD2411S with MicroPython are advised to refer to the sensor's datasheet and implement custom UART communication handling based on the provided protocol specifications.
Conclusion
The ESP32 LD2411S 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.
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.