If you need presence detection that sees through drywall, ignores ambient light, and detects micro-movements like breathing, a microwave radar sensor is the correct tool for the bench. While legacy PIR sensors only trigger on large thermal shifts, modern 24GHz mmWave modules and 5.8GHz Doppler boards provide continuous spatial awareness. However, their output signals and interference profiles are radically different. This guide breaks down the exact wiring, UART byte-parsing math, and physical mounting rules for the two most common modules in 2026: the Hi-Link HLK-LD2410B (24GHz) and the generic RCWL-0516 (5.8GHz).

How Microwave Radar Sensors Actually Work

Microwave radar sensors operate on the Frequency Modulated Continuous Wave (FMCW) or Doppler shift principles. The module continuously emits a radio frequency chirp (e.g., sweeping from 24.0 to 24.25 GHz). When these waves strike an object, they reflect back to the receiving antenna. By mixing the transmitted and received signals, the sensor calculates the "beat frequency". In FMCW mmWave sensors like the LD2410B, this phase and frequency shift is processed by an onboard DSP to calculate exact distance (via time-of-flight equivalent) and velocity, allowing it to distinguish between a stationary human (detecting chest cavity micro-movements) and a moving pet.

Because microwave frequencies easily penetrate non-metallic materials like plastics, wood, and drywall, you can hide these sensors behind walls or inside enclosures. This penetration is also their biggest liability. Common interference sources include water flowing in PVC pipes (water heavily absorbs and reflects 24GHz signals), vibrating HVAC ductwork, large ceiling fans, and Wi-Fi routers (which can desensitize 5.8GHz modules via harmonic bleed). To prevent false triggers from adjacent rooms, you must physically map your environment and use software "distance gates" to mask out returns beyond your physical walls.

Spec Sheet & Wiring: 24GHz mmWave vs 5.8GHz Doppler

Before wiring anything to your ESP32, you must understand the electrical and RF differences between the modern mmWave standard and the legacy Doppler module. The table below provides the hard specifications you need for power supply design and GPIO selection.

Table 1: Microwave Radar Sensor Specification Comparison (2026 Bench Data)
Parameter HLK-LD2410B (24GHz mmWave) RCWL-0516 (5.8GHz Doppler)
Operating Frequency 24.00 - 24.25 GHz (FMCW) 5.8 GHz ± 75 MHz (Doppler)
Max Detection Range 6m (Moving) / 6m (Static) ~9m (Moving only)
Output Signal Type UART (3.3V Logic) + GPIO Digital HIGH/LOW (5V) + Analog
Supply Voltage Range 3.3V to 5V (Typ 5V) 4.0V to 28V (Typ 5V)
Quiescent Current ~75 mA ~2.8 mA
Typical 2026 Pricing $4.50 - $6.00 $1.10 - $1.50
⚠️ Critical Logic Level Warning: The RCWL-0516 outputs a 5V HIGH signal on its OUT pin when triggered. If you wire this directly to an ESP32 GPIO (which is strictly 3.3V tolerant), you will degrade or destroy the ESP32's input pin over time. You must use a simple voltage divider (e.g., 1kΩ and 2kΩ resistors) or a logic level shifter. The HLK-LD2410B natively outputs 3.3V UART logic and is safe for direct ESP32 connection.

ESP32 Wiring Pinout

Table 2: ESP32 DevKit V1 Wiring Matrix
Sensor Pin LD2410B Connection RCWL-0516 Connection
VCC / VIN ESP32 5V (VIN) External 5V PSU (Recommended)
GND ESP32 GND ESP32 GND
TX / OUT ESP32 GPIO 16 (RX2) Voltage Divider → ESP32 GPIO 16
RX ESP32 GPIO 17 (TX2) N/A (Module is TX only)

Output Signal Math: Raw UART Bytes to Physical Units

A common mistake in embedded forums is conflating the analog envelope of a Doppler sensor with the digital UART packets of an mmWave sensor. The RCWL-0516's analog OUT pin simply provides a raw 0-3.3V envelope that rises as a target gets closer; it requires arbitrary analogRead() thresholding and cannot yield physical distance. The HLK-LD2410B, however, outputs structured hexadecimal UART frames at 256,000 baud, allowing you to extract exact physical units.

In the LD2410B's standard reporting mode, the sensor transmits a continuous stream of frames. A standard target data frame looks like this:

[F4 F3 F2 F1] [Len_L] [Len_H] [01] [State] [Dist_L] [Dist_H] [Energy] ... [F8 F7 F6 F5]

The Raw-to-Unit Math

The output is strictly digital UART data. To convert the raw hex bytes into physical centimeters and percentage energy, you must parse the little-endian byte pairs.

  • Target State (1 Byte): 0x00 = No target, 0x01 = Moving, 0x02 = Static, 0x03 = Both.
  • Distance Math: The distance is encoded in two bytes (Dist_L and Dist_H) representing centimeters.
    Formula: Distance_cm = (Dist_H << 8) | Dist_L
  • Energy Math: The target energy (confidence/movement magnitude) is a single byte from 0x00 to 0x64 (0 to 100 decimal).
    Formula: Energy_Percent = Energy_Byte

Calibration and Scaling

You do not apply a mathematical scaling factor to the distance output; the DSP handles the physics. However, you must calibrate the Distance Gates. The LD2410B divides its 6-meter range into 8 "gates" (each 0.75m wide). If your sensor is mounted 4 meters from a drywall partition, it will detect people walking in the next room. You must send UART configuration commands to set the "Max Detection Gate" to Gate 5 (3.75m) and reduce the sensitivity of Gate 5 to ignore the static reflection of the drywall.

ESP32 Implementation & Interference Debugging

Below is the exact implementation for reading the LD2410B UART stream on an ESP32 using the Arduino core. This code isolates the frame headers, verifies the checksum boundaries, and extracts the physical distance.

#include <HardwareSerial.h>

// Use UART2 on ESP32 (GPIO 16 = RX, GPIO 17 = TX)
HardwareSerial radarSerial(2);

void setup() {
  Serial.begin(115200);
  // LD2410B requires 256000 baud rate
  radarSerial.begin(256000, SERIAL_8N1, 16, 17);
  Serial.println("ESP32 Microwave Radar Interfacing Initialized.");
}

void loop() {
  if (radarSerial.available() >= 12) {
    byte header[4];
    radarSerial.readBytes(header, 4);
    
    // Check for LD2410 standard frame header: F4 F3 F2 F1
    if (header[0] == 0xF4 && header[1] == 0xF3 && header[2] == 0xF2 && header[3] == 0xF1) {
      byte dataLenL = radarSerial.read();
      byte dataLenH = radarSerial.read();
      byte dataHead = radarSerial.read(); // Should be 0x01
      
      if (dataHead == 0x01) {
        byte targetState = radarSerial.read();
        byte distL = radarSerial.read();
        byte distH = radarSerial.read();
        byte energy = radarSerial.read();
        
        // Raw to Unit Math
        int distance_cm = (distH << 8) | distL;
        
        Serial.print("State: "); Serial.print(targetState);
        Serial.print(" | Dist: "); Serial.print(distance_cm); Serial.print(" cm");
        Serial.print(" | Energy: "); Serial.println(energy);
      }
    }
  }
}

Debugging Common Failure Modes

When your microwave radar sensor refuses to trigger or throws phantom detections, run through this decision path:

  1. Sensor reads 0 cm or fluctuates wildly: You are likely experiencing multipath interference from a nearby metal object or enclosure. Fix: Never mount mmWave sensors inside metal enclosures or directly against metal studs. Maintain at least a 2cm air gap from metallic surfaces.
  2. ESP32 UART buffer overflows / garbage data: The 256,000 baud rate of the LD2410B pushes a lot of data. If you are running WiFi/BLE concurrently on the ESP32, the CPU interrupts can drop UART bytes. Fix: Increase the hardware serial RX buffer size in setup using radarSerial.setRxBufferSize(512); before calling .begin().
  3. RCWL-0516 triggers when no one is in the room: This is almost always caused by a 2.4GHz Wi-Fi router placed within 1 meter of the sensor, or water moving in a nearby pipe. Fix: Add a 10µF capacitor across the RCWL VCC and GND pins to stabilize the local oscillator, and physically relocate the sensor away from plumbing and routers.

For deeper protocol configuration (like writing to the EEPROM to change gate sensitivities), refer to the ESPHome LD2410 integration documentation, which maps the exact hex command structure for the configuration mode. For a broader understanding of the FMCW physics governing these 24GHz modules, the Texas Instruments mmWave Radar Fundamentals guide remains the definitive industry reference.