Are you looking for a reliable motion detection solution that works through obstacles and offers greater sensitivity than traditional PIR sensors? Meet the RCWL-0516 Microwave Radar Proximity Sensor—a compact, affordable module that uses microwave Doppler radar to detect motion. In this detailed guide, we’ll explore how to interface the RCWL-0516 with an ESP32 microcontroller, how it works internally, how to wire it, and how to enhance its functionality using an LDR.
Table of Contents
What is the RCWL-0516 Microwave Radar Sensor?

The RCWL-0516 is a motion detection sensor based on microwave Doppler radar technology. It operates at 3.18 GHz and can detect moving objects up to 7 meters away. Unlike Passive Infrared (PIR) sensors that rely on heat signatures, the RCWL-0516 detects motion using the Doppler shift in reflected microwaves—allowing it to detect objects even through materials like plastic, wood, and glass.
Related project: Human detection Sensor with ESP32
Key Advantages Over PIR Sensors:
- 360° Detection Field: Eliminates directional limitations of PIR sensors
- Material Penetration Capability: Detects motion through thin obstacles
- Speed-Based Triggering: Responds to objects moving up to 2 m/s
- Consistent Performance: Unaffected by temperature fluctuations
- No blind spots due to narrow cone angle
How the RCWL-0516 Works: Doppler Radar Explained
The sensor includes a high-frequency oscillator that emits a continuous microwave signal at 3.18 GHz. This signal bounces off surrounding objects. When a moving object passes within its detection field, the reflected waves return with a frequency shift, known as the Doppler effect.
This change is analyzed by the sensor’s internal circuitry. If the sensor detects a significant frequency shift, it infers motion and sets its digital output pin (OUT) to HIGH. When no motion is detected, the pin remains LOW.
RCWL-0516: Specifications & Features
| Parameter | Specification | Real-World Insight |
|---|---|---|
| Operating Voltage | 4-28V DC | Compatible with 5V ESP32 logic |
| Detection Range | Up to 7 meters | Effective 5m range typical |
| Output Signal | 3.3V (HIGH), <0.7V (LOW) | Direct ESP32 compatibility |
| Current Consumption | 3mA (typical) | Ultra-low power operation |
| Retrigger Interval | Adjustable (default 2s) | Customizable via components |
| Operating Frequency | 3.18 GHz ISM Band | License-free operation |
Critical Performance Notes:
- The advertised 7m range depends on environmental factors. Testing shows consistent 5m detection in typical indoor environments.
- Metal objects near the sensor’s rear reduce performance – maintain >1cm clearance.
- Default 2-second output delay prevents repeated triggering but can be modified.
RCWL-0516 Pinout
The RCWL-0516 module includes five main pins:
| Pin | Description |
|---|---|
| VIN | Power input (4V to 28V) |
| GND | Ground connection |
| OUT | Digital output: HIGH when motion is detected |
| 3V3 | Internal regulated 3.3V output (not for powering the board) |
| CDS | Light-sensing pin for connecting an optional LDR (Light-Dependent Resistor) |
Optional LDR for Intelligent Light-Dependent Operation

The RCWL-0516 allows you to connect an LDR (light sensor) to the CDS pin to make the module operational only in the dark. This creates conditional detection scenarios which are ideal for security lights or energy-saving applications in night.
For dark-activation, Solder LDR leads to CDS and GND pins as shown in the above image. Use 22KΩ pull-up resistor on R-CDS (it will detect motion only in low light conditions). Here’s how it works:
- If the LDR senses low light (output > 0.7V), the sensor will function normally.
- If the LDR detects bright light (output < 0.7V), it disables motion detection output.
Tuning the RCWL-0516 for Your Project

| SMD Pad | Function | Effect When Populated |
|---|---|---|
| C-TM | Retrigger Time Control | Add a capacitor to extend output HIGH duration |
| R-GN | Detection Range Adjustment | Add a resistor to shorten detection range |
| R-CDS | LDR Sensitivity Calibration | Add a resistor in parallel to pull-up for threshold tuning |
How to interface RCWL-0516 with ESP32
Components Required:
| Product Name | Quantity | ||
|---|---|---|---|
| ESP32 Microcontroller | 1 | https://amzn.to/3s0Sut6 | https://amzn.to/3Kw2np2 |
| RCWL-0516 Sensor Module | 1 | https://amzn.to/4l1CrUN | https://amzn.to/44Acgi6 |
| 5V power supply (Micro USB or External). | 1 | https://amzn.to/3s1a8g3 | https://amzn.to/364yInH |
| Few Connecting Wires | https://amzn.to/3H2BV4e | https://amzn.to/3J0WVu2 |
- (Optional) LDR and 22KΩ resistor
- (Optional)Breadboard
Build Smarter Motion Detection: Power Your RCWL-0516 + ESP32 Project with PCBWay!
Struggling with false triggers, range limits, or interference in your microwave radar sensor projects? PCBWay—the engineers’ choice for high-performance PCBs—gives you the manufacturing edge to perfect motion detection systems.
Why Engineers Trust PCBWay for RCWL-0516 + ESP32 Designs
-
EMI-Optimized PCBs: Eliminate noise from the 3.2GHz radar emissions with 4-layer boards featuring ground planes, shielded traces, and precise impedance control.
-
24-Hour Prototyping: Rapidly test antenna adjustments, power stability, or I²C/GPIO layouts—ideal for tuning sensitivity and reducing false alarms.
-
Sensor-Ready Assembly: PCBway’s SMT lines expertly handle ESP32 modules and RCWL-0516’s microwave circuitry, ensuring reliable soldering for high-frequency performance.
Key Technical Perks
-
Stable Power Delivery: Dedicated planes prevent voltage drops during radar bursts.
-
Thermal Management: Metal-core PCBs dissipate heat in always-on applications (e.g., security systems).
-
Real-Time DFM Feedback: Catch layout errors before fabrication—avoid resonance issues or signal crosstalk.
Celebrate PCBWay’s 11th Anniversary: Limited-Time Deals!
Unlock exclusive discounts for your radar project:
-
$5 OFF PCB Orders > $30 → Just visit this link and login to get more coupons in your account → PCBway 11th Anniversary Special
-
Up to 50% OFF 3D Printing & CNC Machining → Enclosures, mounts & prototypes
-
Special Discounts on Selected Items → Multimeters, Tesla coils, Display modules & more
Scale from 5 Prototypes to Mass Production
Zero MOQ • 24/7 Support • Full Supply Chain Transparency
Circuit diagram interfacing RCWL 0516 with ESP32
Connect all the required components as shown in the below circuit diagram

| RCWL-0516 Pin | ESP32 Pin |
|---|---|
| VIN | 5V (or 3.3V if preferred) |
| GND | GND |
| OUT | D12 GPIO 12 (or any digital GPIO) |
You can connect the sensor directly using jumper wires or you can place them on breadboard and connect them.
Arduino Sketch for RCWL-0516 with ESP32
Copy the below Arduino code and paste it in the Arduino IDE workspace on your PC where your Arduino is connected. This sensor doesn’t require any libraries, we can directly write the code.
Example 1: Inbuilt LED glows when motion detected
/*
* ESP32 with RCWL-0516 Motion Sensor
* Blinks built-in LED and prints to serial when motion is detected
*/
const int MOTION_SENSOR_PIN = 12; // GPIO12
const int LED_PIN = 2; // Built-in LED
void setup() {
Serial.begin(115200);
Serial.println("ESP32 Motion Sensor Initialized");
Serial.println("Waiting for motion...");
pinMode(MOTION_SENSOR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW); // Start with LED off
}
void loop() {
bool motionDetected = digitalRead(MOTION_SENSOR_PIN);
if (motionDetected == HIGH) {
digitalWrite(LED_PIN, HIGH);
Serial.println("Motion Detected!");
} else {
digitalWrite(LED_PIN, LOW);
Serial.println("Motion Stopped");
}
delay(500); // Reduce serial flooding
}
This code uses an ESP32 to read motion data from the RCWL-0516 microwave radar sensor. When motion is detected, the built-in LED turns ON and a message is printed to the Serial Monitor.
-
MOTION_SENSOR_PIN = 12: Connects to the OUT pin of the RCWL-0516 to detect motion. -
LED_PIN = 2: Controls the built-in LED on the ESP32 board.
setup()
-
Initializes serial communication for debug messages.
-
Sets the motion sensor pin as input and LED pin as output.
-
Turns the LED off at startup.
loop()
-
Reads the motion sensor’s digital output:
-
If HIGH: Motion detected → LED ON, message printed.
-
If LOW: No motion → LED OFF.
-
-
delay(500): Adds a short pause to reduce Serial Monitor flooding.
Output:
After uploading the code you can see the LED light on the ESP32 board glows when motion detected and prints “motion detected” on the serial monitor and LED turn off when no motion is detected infront of the sensor within its range and prints motion stopped on serial monitor as shown in the below image.

Example 2: Build motion sensor light or siren buzzer using relay
With the help of RCWL-0516 microwave Sensor module we can build a motion sensor lights or even a security sirens. check the below circuits and program code to build it.

/*
* ESP32 with RCWL-0516 Motion Sensor and Relay Control
* LED and relay turn on when motion is detected
*/
const int MOTION_SENSOR_PIN = 12; // GPIO12
const int LED_PIN = 2; // Built-in LED
const int RELAY_PIN = 27; // GPIO27 for relay control
void setup() {
Serial.begin(115200);
Serial.println("ESP32 Motion Sensor Initialized");
Serial.println("Waiting for motion...");
pinMode(MOTION_SENSOR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW); // Start with LED off
digitalWrite(RELAY_PIN, LOW); // Start with relay off (light ON since NC)
}
void loop() {
bool motionDetected = digitalRead(MOTION_SENSOR_PIN);
if (motionDetected == HIGH) {
digitalWrite(LED_PIN, HIGH);
digitalWrite(RELAY_PIN, HIGH); // Turn relay ON (light OFF since NC)
Serial.println("Motion Detected!");
} else {
digitalWrite(LED_PIN, LOW);
digitalWrite(RELAY_PIN, LOW); // Turn relay OFF (light ON since NC)
}
delay(500); // Reduce serial flooding
}
Why Choose Microwave Radar? Real User Experiences
“After struggling with PIR sensors in my sunroom where temperature changes constantly caused false alarms, the RCWL-0516 solved all my problems. It reliably detects people entering without being triggered by sunlight heating the room.” – Sarah K., Home Automation Enthusiast
“I’ve installed these in industrial cabinets where we need to detect hands approaching machinery. They work through the plastic safety covers where infrared sensors fail completely.” – Michael T., Industrial Controls Engineer
Next Steps in Your Project
-
Add Wireless Capability: Have your ESP32 send push notifications when motion is detected
-
Create Timed Actions: Program lights to stay on for 5 minutes after motion stops
-
Build Security Logs: Record detection times to a microSD card
-
Combine Sensors: Use both microwave and PIR for 99% accuracy
Frequently Asked Questions
Q: Can this sensor detect stationary objects?
A: No, it only detects moving objects due to the Doppler effect principle.
Q: Will it work through walls?
A: It can detect motion through thin non-metallic materials like drywall or wood, but effectiveness decreases with material thickness.
Q: How many sensors can I connect to one ESP32?
A: You can connect multiple sensors as long as you have enough GPIO pins (each sensor needs one digital pin).
Q: Why does the sensor stay active for 2 seconds after motion stops?
A: This built-in delay prevents repeated triggering. You can modify it by changing the C-TM capacitor.
Conclusion: Your Gateway to Advanced Motion Sensing
The RCWL-0516 microwave radar sensor opens new possibilities in motion detection that simply aren’t possible with traditional infrared sensors. By following this guide, you’ve learned how to properly wire, program, and optimize this powerful sensor with your ESP32. Whether you’re building a simple automatic light or a complex security system, the combination of microwave radar technology and ESP32’s processing power creates a robust foundation for your projects.
