The microwave radar sensor RCWL-0516 is a highly sensitive, low-cost Doppler radar module used for motion and presence detection. Unlike passive infrared (PIR) sensors that require a direct line of sight and detect heat differentials, this module emits microwaves that penetrate non-metallic materials like drywall, wood, and plastic. The output is strictly digital (a HIGH/LOW logic signal), meaning it does not provide an analog voltage proportional to distance. In 2026, these modules typically cost between $1.50 and $3.00 USD, making them a staple for hidden occupancy sensing in smart home builds.

How the RCWL-0516 Microwave Radar Actually Works

The RCWL-0516 relies on the continuous-wave (CW) Doppler radar principle. It transmits a low-power microwave signal (typically centered around 3.18 GHz) and continuously monitors the phase and frequency of the waves reflecting off objects in its field. When a person or object moves within the sensor's 5 to 9-meter detection radius, the reflected wave undergoes a Doppler shift—a slight change in frequency proportional to the object's velocity relative to the module.

Inside the module, a dedicated microwave oscillator and a high-gain operational amplifier stage detect this micro-Hertz frequency shift. The analog signal is then fed into a timing IC which filters out slow environmental drifts and triggers a digital HIGH output when the shift crosses a hardcoded threshold. Because microwaves penetrate non-metallic materials, you can hide the sensor behind walls or inside plastic enclosures, a massive advantage over PIR sensors for aesthetic DIY installations.

Pinout, Wiring, and Power Requirements

Before wiring, note that while the RCWL-0516 accepts a wide input voltage range, the logic output on the OUT pin behavior varies slightly between manufacturing batches. Some clones output a 3.3V HIGH signal regardless of VCC, while others pass VCC directly to the OUT pin. If you are using a 3.3V microcontroller like the ESP32, always use a voltage divider on the OUT pin to protect your GPIO.

RCWL-0516 Specification and Pinout Table
Pin Function Specification / Range Wiring Notes
VCC Power Supply 4.0V to 28.0V DC Use 5V for standard Arduino/ESP32 compatibility.
GND Ground 0V Reference Must share a common ground with your microcontroller.
OUT Digital Output HIGH (Motion) / LOW (Idle) Use a 2.2kΩ/3.3kΩ voltage divider if VCC is 5V and MCU is 3.3V.
CDS Light Sensor Input Analog (0V - 0.7V threshold) Connect an LDR here to disable the sensor in daylight.
3V3 Internal Regulator Out 3.3V (Max ~100mA) Can power a low-draw LDR or external logic, do not exceed 100mA.
Callout Tip: The CDS Pin Threshold
The CDS pin does not read raw light levels; it acts as an enable gate. If the voltage on the CDS pin is below ~0.7V, the sensor's internal logic disables the OUT pin to save power. Wire a 10kΩ pull-down resistor and an LDR in a voltage divider to this pin if you want the radar to ignore motion when the room lights are on.

Numbered Wiring Steps for ESP32

  1. De-energize: Ensure your ESP32 and the sensor's 5V power supply are unplugged.
  2. Power the Module: Connect the 5V supply positive to VCC and negative to GND.
  3. Build the Voltage Divider: Connect a 2.2kΩ resistor from the sensor's OUT pin to ESP32 GPIO 4. Connect a 3.3kΩ resistor from GPIO 4 to GND.
  4. Common Ground: Connect the sensor GND to the ESP32 GND. This is critical; without a shared reference, the digital logic will float and cause ghost triggers.
  5. Verify: Power the circuit and use a multimeter to probe the ESP32 side of the voltage divider. When motion is detected, it should read ~3.1V (safe for the ESP32's 3.3V limit per Espressif hardware design guidelines).

Decoding the Output: Digital Logic and Timing Math

A common mistake beginners make is trying to read the OUT pin with analogRead() to determine how far away a person is. The RCWL-0516 does not output distance data. The output is a binary state: 1 (Occupancy) or 0 (Vacancy). Therefore, the "raw reading to physical unit" math involves mapping the digital state over time to calculate Dwell Time (how long a space was occupied).

The physical unit we are calculating is Occupancy Duration (Seconds). The formula is:

T_dwell = Σ (t_falling - t_rising)

Here is the complete, copy-pasteable ESP32 Arduino code to handle the digital state mapping, debounce the radar's internal timer, and calculate the physical dwell time:

// RCWL-0516 Dwell Time Calculator for ESP32
const int RADAR_OUT = 4; // GPIO connected to voltage divider output

unsigned long motionStartTime = 0;
unsigned long totalDwellTimeMs = 0;
bool isCurrentlyOccupied = false;

void setup() {
  Serial.begin(115200);
  pinMode(RADAR_OUT, INPUT);
  Serial.println("RCWL-0516 Dwell Time Tracker Initialized.");
}

void loop() {
  // Raw reading: 1 = Motion, 0 = No Motion
  int rawState = digitalRead(RADAR_OUT);
  
  if (rawState == HIGH && !isCurrentlyOccupied) {
    // Transition from Vacancy to Occupancy
    isCurrentlyOccupied = true;
    motionStartTime = millis();
    Serial.println("[STATE] Occupancy Detected (Raw: 1)");
  } 
  else if (rawState == LOW && isCurrentlyOccupied) {
    // Transition from Occupancy to Vacancy
    isCurrentlyOccupied = false;
    unsigned long dwellDuration = millis() - motionStartTime;
    totalDwellTimeMs += dwellDuration;
    
    // Math: Convert raw milliseconds to physical unit (Seconds)
    float dwellSeconds = dwellDuration / 1000.0;
    float totalSeconds = totalDwellTimeMs / 1000.0;
    
    Serial.printf("[STATE] Vacancy (Raw: 0) | Session: %.2f sec | Total Dwell: %.2f sec\n", 
                  dwellSeconds, totalSeconds);
  }
  
  delay(100); // Poll rate (RCWL internal timer holds HIGH for ~2s anyway)
}

Calibration Note: The RCWL-0516 has an internal timing capacitor (usually 104 / 0.1µF) that holds the OUT pin HIGH for roughly 2 seconds after motion stops. If you need faster vacancy detection for precise dwell math, you must physically desolder the timing capacitor on the back of the module and replace it with a smaller value (e.g., 0.01µF), as documented in community reverse-engineering repositories.

Real-World Interference and Mounting Gotchas

Microwave radar is incredibly sensitive, which is both its greatest strength and its biggest liability on the bench. When troubleshooting false triggers, check these specific interference sources:

  • Water and Plumbing: Microwaves at 3.18 GHz are highly absorbed by water. If you mount the sensor on a wall that shares a stud bay with a copper water pipe, the moving water inside the pipe will trigger the sensor. Keep the sensor at least 1 meter away from major plumbing lines.
  • Metal Enclosures and Multipath Ghosting: Microwaves do not penetrate metal; they reflect off it. Mounting the sensor inside a metal electrical box will kill the range entirely. Conversely, mounting it facing a large metal appliance (like a refrigerator) can cause "multipath ghosting," where the radar bounces off the fridge, hits a moving person across the room, and bounces back, triggering the sensor even if the person is outside the intended zone.
  • Wi-Fi and RF Noise: While the sensor operates at ~3.18 GHz, the high-gain op-amp on the module's PCB is notoriously susceptible to strong nearby RF fields. A 2.4GHz Wi-Fi router placed within 12 inches of the sensor can induce enough noise in the front-end amplifier to cause sporadic HIGH outputs. Maintain a 2-foot physical separation from routers and Bluetooth hubs.
  • LED Driver Switching Noise: If you power the sensor from the same 5V rail as cheap, unshielded LED strip drivers, the high-frequency switching noise will ride the VCC line and trigger the radar's sensitive analog stage. Always use a dedicated 100µF decoupling capacitor across the VCC and GND pins of the RCWL-0516 when sharing power rails with inductive or switching loads.

RCWL-0516 Microwave Radar Sensor FAQ

Can the microwave radar sensor RCWL-0516 measure exact distance?

No. The RCWL-0516 is a continuous-wave Doppler radar, not a Frequency-Modulated Continuous-Wave (FMCW) radar. It can only detect the velocity of a moving object (via the Doppler shift) and output a binary presence signal. It cannot calculate the time-of-flight required to determine exact distance. If your project requires distance mapping, you need a 24GHz FMCW module like the LD2410 or a Time-of-Flight (ToF) LiDAR sensor like the VL53L1X.

Why is my RCWL-0516 triggering falsely through the wall?

This is the intended behavior of microwave radar, as 3.18 GHz waves easily pass through standard 1/2-inch drywall and wooden studs. If the sensor is triggering from a hallway when you only want it to monitor a specific bedroom, you must physically shape the RF beam. Apply copper foil tape (grounded to the module's GND) to the sides and back of the sensor PCB to create a directional shield, narrowing the detection cone to your target area.

Do I need a voltage divider for the RCWL-0516 OUT pin on an ESP32?

Yes, it is highly recommended. While the module has an internal 3.3V regulator, the OUT pin logic HIGH voltage on many mass-produced clones is tied directly to the VCC input rather than the internal 3.3V rail. If you power the module with 5V to ensure a clean analog stage, the OUT pin will likely swing to 5V. Feeding 5V into an ESP32 GPIO pin will degrade the silicon over time and eventually brick the microcontroller. A simple 2.2kΩ / 3.3kΩ resistor divider safely steps the 5V signal down to a 3.0V logic HIGH.