Connect RCWL-0516 with ESP32 Read Microwave Radar Motion Sensor
Connect RCWL-0516 with ESP32 Read Microwave Radar Motion Sensor
This tutorial shows how to use RCWL-0516 microwave radar sensor with ESP32. Unlike PIR sensors that use infrared, RCWL-0516 detects motion by reading changes in reflected microwave signals. This makes it suitable for applications requiring longer detection range.
Required Components
- ESP32 NodeMCU ESP-WROOM-32
- RCWL-0516 Microwave Radar Sensor
- 5mm Red LED x1
- 220 Ohm Resistor
- Breadboard 170 points
- Jumper wires (M-M, M-F, F-F)
- Micro USB cable for upload
- Power Adapter 5V 2A
How RCWL-0516 Works
RCWL-0516 emits microwave signals. When an object moves within range, the reflected wave frequency changes due to Doppler Effect. The sensor detects this change and outputs a signal at the OUT pin.
Key advantages: detection range of 5-9 meters and can detect through thin materials without direct line of sight.
Wiring ESP32 with RCWL-0516
| ESP32 | Device | Pin |
|---|---|---|
| D22 | LED (via R220) | Anode |
| D23 | RCWL-0516 | OUT |
| VIN | RCWL-0516 | VIN |
| GND | RCWL-0516 | GND |
| GND | LED | Cathode |
Arduino Code for Reading RCWL-0516
// Pin definitions
const int sensorPin = 23; // RCWL-0516 OUT connected to D23
const int ledPin = 22; // LED connected to D22
void setup() {
Serial.begin(115200);
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.println("RCWL-0516 Motion Detection Ready");
}
void loop() {
int motionValue = digitalRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.println(motionValue);
digitalWrite(ledPin, motionValue);
delay(100);
}
Upload Steps
- Open Arduino IDE and paste the code above
- Go to Tools -> Port and select ESP32 port
- Go to Tools -> Board and select ESP32 board type
- Click Upload button
- If “Connecting…” appears during upload, hold BOOT button on the board
- Wait for “Hard resetting via RTS pin…” to confirm success
Expected Results
Open Serial Monitor at Baud Rate 115200 and observe the values:
- No motion → Sensor outputs 0, LED off
- Motion detected → Sensor outputs 1, LED on
- Motion stops → Sensor continues briefly before returning to 0
Customization Points
To make LED blink when motion is detected, add blinking logic in the loop section when motionValue equals 1 using short delay intervals.
Reference Video
อยากทำโปรเจคแบบนี้?
รับทำโปรเจค Arduino / IoT จบงานไว ส่งงานครบ พร้อมสอน
If you need Arduino project service or urgent IoT development, see full service details on the home page
จ้างทำโปรเจคเลย