RCWL-0516 Radar Sensor with Arduino: Range, Wiring and PIR
How do you use the RCWL-0516 radar sensor with Arduino, ESP32 and Pico? Wiring, 7 m range, sensing through walls, PIR differences and false trigger fixes.
The RCWL-0516 is a small, very cheap microwave radar motion sensor you can use with Arduino, ESP32 and Raspberry Pi Pico. It sends out a weak signal at about 3.18 GHz and detects motion from the frequency shift in the reflection. The moment it sees movement, the OUT pin goes HIGH for about 2 seconds. No library is needed. By reading a single digital pin you can detect motion 5–7 metres away. The sensor can even see movement behind a thin wall or a plastic box.
In this post you'll first learn how the sensor works through the Doppler principle. Then we'll look at its pins, the adjustment pads on the back of the board and which materials it can see through. We'll also compare it with the classic PIR sensor in tables. After that you'll build a lamp with Arduino Uno, ESP32 and Pico: it turns on when there's motion and turns itself off 30 seconds after the motion stops. Finally, you'll see how to reduce false triggers, the biggest problem with radar sensors, in software and hardware.
What is the RCWL-0516 and how does it work?
At the heart of the sensor are an antenna made of copper traces on the board and a small high-frequency oscillator. The oscillator constantly transmits a signal of about 3.18 GHz, with a wavelength of about 9.4 cm. When the signal hits a stationary wall and returns, its frequency doesn't change. If it hits a moving person, the frequency of the returning signal shifts slightly. This is called the Doppler effect, and the shift is given by fd = 2 × v × f0 / c. For example, for someone walking at 1.4 m/s, fd = 2 × 1.4 × 3.18×10^9 / 3×10^8 ≈ 30 Hz. The RCWL-9196 chip on the board mixes the transmitted and returned signals, picks up this difference of a few tens of hertz and amplifies it. When the difference exceeds a threshold, it sets OUT HIGH. An interesting detail: the RCWL-9196 is very similar to the BISS0001 chip in PIR sensors, so its retriggerable output and timing logic are also similar to a PIR. The sensor doesn't see heat but motion: a walking person, a swaying curtain and a spinning fan are all the same to it.
| Feature | Value |
|---|---|
| Signal processing chip | RCWL-9196 |
| Operating frequency | About 3.18 GHz |
| Supply (VIN) | 4–28 V |
| Operating current | About 3 mA |
| Detection distance | 5–7 m (can be shortened with a pad) |
| Detection area | Wide, about 360°; strongest in front of the component side |
| Output level | About 3.3 V when motion is detected, 0 V when not |
| Default trigger time | About 2 s, retriggerable |
| 3V3 output | 3.3 V, 100 mA maximum |
| Operating temperature | -20 °C to +80 °C |
| Board size | About 36 × 17 mm |
Pins and the adjustment pads on the back
| Pin | Function | Note |
|---|---|---|
| 3V3 | 3.3 V output | Comes from the on-board regulator; 100 mA maximum, not a supply input |
| GND | Ground | Must be shared with the microcontroller's GND |
| OUT | Motion output | About 3.3 V when there's motion, 0 V when there isn't |
| VIN | Supply input | 4–28 V |
| CDS | Disables the sensor | Detection stops if pulled below 0.7 V; normally left unconnected |
On the back of the board there are three bare solder pads that most people never notice. A capacitor soldered to the C-TM pad extends the time OUT stays HIGH beyond the default 2 seconds; the bigger the capacitor, the longer the time. A resistor fitted to the R-GN pad reduces the receiver gain and shortens the range. According to common measurements, 1 MΩ cuts the range to about 5 metres and 270 kΩ to about 1.5 metres. The R-CDS pad is for an LDR (light sensor). With an LDR fitted, the CDS line is pulled down when the room is bright, so the sensor works only in the dark. That way you can build a night light that stays off in the daytime even without a microcontroller.
RCWL-0516 vs PIR sensor comparison
| Feature | RCWL-0516 (radar) | HC-SR501 (PIR) |
|---|---|---|
| Detection principle | Microwave Doppler (active, emits a signal) | Infrared heat change (passive, emits nothing) |
| What it detects | Any moving object | Moving objects at a different temperature from the surroundings |
| Range | 5–7 m | 3–7 m (adjustable with a potentiometer) |
| Detection area | About 360° | About 110–120° cone |
| Behind obstacles | Sees through plastic, wood, glass and plasterboard | Can't even see through glass |
| Affected by heat and sun | No | Yes |
| Standby current | About 3 mA | About 50 µA |
| Warm-up at power-up | A few seconds | 30–60 seconds |
| Time adjustment | C-TM pad or software | Potentiometer (a few seconds to about 5 minutes) |
| Typical false triggers | Curtains, fans, vibration, supply noise | Hot air currents, sun, radiators |
Which should you choose? In a battery-powered device that sleeps for months and wakes only on motion, the PIR's microamp-level current is a big advantage. Because a PIR responds only to warm objects, it also isn't bothered by things like curtains and fans. In some places the RCWL-0516 works more reliably: projects where the sensor must be hidden or placed inside a closed box, sunny areas, and spots with frequent temperature changes such as garages, stairwells or front doors. Many professional alarm detectors use both technologies together, and the alarm sounds only when both the PIR and the radar see motion. You can get the same reliability by combining the two sensors' outputs with an AND operation in code. For the PIR side, see the PIR motion sensor post.
Sensing through walls: range and materials
The microwave signal passes through most non-conductive materials. That's why the RCWL-0516 can be hidden inside a plastic box or a wooden panel with no hole or lens visible from outside. This is a big advantage over a PIR but also the biggest trap: the sensor will also detect someone in the room on the other side of the wall or on the floor above. The range is 5–7 metres on paper. In practice it varies with the board's orientation, supply noise and the size of the target. The human body is mostly water, so it reflects the signal well. Small animals like cats are detected only from closer up.
| Material | Effect on the signal |
|---|---|
| Plasterboard, wooden door, plastic box | The signal passes easily, range shortens a little |
| Plain glass | Passes; weakens through metal-coated heat-control glass |
| Brick and concrete | Heavy attenuation; detection at short range may continue through thin walls |
| Water (aquarium, wet wall) | Weakens the signal strongly |
| Metal sheet, aluminium foil, metal box | Doesn't pass, reflects the signal |
Wiring: Arduino Uno, ESP32 and Raspberry Pi Pico
| Connection | Arduino Uno | ESP32 | Raspberry Pi Pico |
|---|---|---|---|
| RCWL-0516 VIN | 5V | VIN (5 V from USB) | VBUS (pin 40) |
| RCWL-0516 GND | GND | GND | GND |
| RCWL-0516 OUT | D2 | GPIO 27 | GP15 (pin 20) |
| RCWL-0516 3V3 and CDS | Leave unconnected | Leave unconnected | Leave unconnected |
| Lamp (LED + 220 Ω or relay IN) | D8 | GPIO 26 | GP14 (pin 19) |
Step by step: a motion-activated lamp with Arduino
- Connect the RCWL-0516's VIN pin to Arduino's 5V pin, GND to GND and OUT to D2. Leave the 3V3 and CDS pins unconnected.
- Connect an LED to pin D8 through a 220 Ω resistor. One end of the resistor goes to D8 and the other to the LED's anode; the LED's cathode connects to GND. For a red LED at 5 V the current is (5 − 2) / 220 ≈ 13.6 mA. For other LEDs you can use the LED resistor calculator.
- If you want a real lamp, connect the IN input of a relay module to D8 instead of the LED. Details are in the relay module post. Some relay modules switch on with LOW, so you may need to swap HIGH and LOW in the code.
- Point the component side of the sensor at the area you want to monitor. Don't leave a metal object or a pile of wires within 1–2 cm of the board.
- Upload the code, open the Serial Monitor at 9600 baud and wave your hand in front of the sensor.
- Leave the room or stay completely still. 30 seconds after the last motion, the lamp turns off by itself.
1// RCWL-0516 ile hareketle yanan lamba / Motion-activated lamp with RCWL-0516
2const int RADAR_PIN = 2; // RCWL-0516 OUT
3const int LAMP_PIN = 8; // LED (220 ohm) ya da röle IN / LED (220 ohm) or relay IN
4const unsigned long LAMP_ON_TIME = 30000UL; // son hareketten sonra 30 s / 30 s after last motion
5
6unsigned long lastMotion = 0;
7bool lampOn = false;
8
9void setup() {
10 pinMode(RADAR_PIN, INPUT); // OUT aktif sürülür, pull-up gerekmez / OUT is actively driven, no pull-up needed
11 pinMode(LAMP_PIN, OUTPUT);
12 digitalWrite(LAMP_PIN, LOW);
13 Serial.begin(9600);
14 Serial.println(F("RCWL-0516 hazir / ready"));
15}
16
17void loop() {
18 if (digitalRead(RADAR_PIN) == HIGH) { // hareket var / motion detected
19 lastMotion = millis();
20 if (!lampOn) {
21 lampOn = true;
22 digitalWrite(LAMP_PIN, HIGH);
23 Serial.println(F("Hareket: lamba acik / Motion: lamp on"));
24 }
25 }
26
27 if (lampOn && millis() - lastMotion >= LAMP_ON_TIME) { // 30 s hareket yok / no motion for 30 s
28 lampOn = false;
29 digitalWrite(LAMP_PIN, LOW);
30 Serial.println(F("Hareket yok: lamba kapali / No motion: lamp off"));
31 }
32}| Code part | What it does |
|---|---|
| pinMode(RADAR_PIN, INPUT) | The OUT pin drives HIGH or LOW itself, so no internal pull-up is needed |
| lastMotion = millis() | Updates the last motion time on every HIGH reading; ongoing motion keeps the lamp on |
| millis() - lastMotion >= LAMP_ON_TIME | Overflow-safe time comparison; with no delay() the loop never stops |
| lampOn flag | Updates the relay and Serial Monitor only when the state changes, not on every loop |
| 30000UL | Marks the constant as unsigned long; change the lamp's on-time here |
Reducing false triggers in software
Even a single false trigger makes a radar sensor's OUT go HIGH for about 2 seconds. So filtering out short HIGH times doesn't work. A better method is to confirm motion in two stages. You only note the first trigger. To turn on the lamp, you wait either for a second trigger within 8 seconds or for the output to stay HIGH for more than 4 seconds. A real person who keeps moving will always meet one of these conditions. Single pulses from supply noise or a distant vibration get filtered out. The price is that the lamp comes on about 2–4 seconds later instead of on the first step. In corridor lighting this delay is usually unnoticeable, while in alarm systems it greatly reduces false alarms.
1// İki aşamalı doğrulama ile yanlış tetiklemeyi azaltma / Reducing false triggers with two-stage confirmation
2const int RADAR_PIN = 2;
3const int LAMP_PIN = 8;
4const unsigned long CONFIRM_WINDOW = 8000UL; // ikinci tetik için süre / window for a second trigger
5const unsigned long LONG_HIGH = 4000UL; // tek darbe ~2 s, daha uzunu gerçek hareket / single pulse ~2 s, longer means real motion
6const unsigned long LAMP_ON_TIME = 30000UL;
7
8int lastState = LOW;
9unsigned long highStart = 0;
10unsigned long firstTrigger = 0;
11unsigned long lastMotion = 0;
12bool waiting = false;
13bool lampOn = false;
14
15void confirmMotion(unsigned long now) {
16 waiting = false;
17 lastMotion = now;
18 if (!lampOn) {
19 lampOn = true;
20 digitalWrite(LAMP_PIN, HIGH);
21 Serial.println(F("Hareket dogrulandi / Motion confirmed"));
22 }
23}
24
25void setup() {
26 pinMode(RADAR_PIN, INPUT);
27 pinMode(LAMP_PIN, OUTPUT);
28 digitalWrite(LAMP_PIN, LOW);
29 Serial.begin(9600);
30 delay(5000); // açılışta sensörün oturmasını bekle / let the sensor settle at power-up
31 lastState = digitalRead(RADAR_PIN);
32 highStart = millis();
33}
34
35void loop() {
36 unsigned long now = millis();
37 int state = digitalRead(RADAR_PIN);
38
39 if (state == HIGH && lastState == LOW) { // yükselen kenar / rising edge
40 highStart = now;
41 if (!lampOn) {
42 if (waiting && now - firstTrigger <= CONFIRM_WINDOW) {
43 confirmMotion(now); // ikinci tetik geldi / second trigger arrived
44 } else {
45 waiting = true; // ilk tetik, sadece not al / first trigger, just note it
46 firstTrigger = now;
47 Serial.println(F("Tek tetik, bekleniyor / Single trigger, waiting"));
48 }
49 }
50 }
51
52 if (state == HIGH && !lampOn && now - highStart >= LONG_HIGH) {
53 confirmMotion(now); // uzun HIGH = süren hareket / long HIGH = ongoing motion
54 }
55
56 if (state == HIGH && lampOn) {
57 lastMotion = now; // lamba açıkken her hareket süreyi uzatır / each motion extends the time
58 }
59
60 if (waiting && now - firstTrigger > CONFIRM_WINDOW) {
61 waiting = false; // ikinci tetik gelmedi, yok say / no second trigger, ignore
62 }
63
64 if (lampOn && now - lastMotion >= LAMP_ON_TIME) {
65 lampOn = false;
66 digitalWrite(LAMP_PIN, LOW);
67 Serial.println(F("Lamba kapali / Lamp off"));
68 }
69
70 lastState = state;
71}Reducing false triggers in hardware
- Supply filter: Add a 100 µF electrolytic and a 100 nF ceramic capacitor between the sensor's VIN and GND pins, as close to the board as possible. The radar receiver can mistake even millivolt ripples on the supply for motion.
- Keep it away from Wi-Fi: If you use an ESP32 or ESP8266, place the sensor at least 10–20 cm from the board's antenna. Current spikes during Wi-Fi transmission are the most common cause of false triggers.
- Don't put two radars side by side: The frequencies of two RCWL-0516 boards are very close and they can trigger each other. Leave at least 1 metre between them.
- Don't point it at moving objects: Keep fans, air-conditioner vanes, curtains, potted plants and washing machines out of the sensor's field of view. Places where a water pipe runs inside the wall can also cause problems.
- Shorten the range: If you only need to monitor the nearby area, solder a resistor of 270 kΩ–1 MΩ to the R-GN pad. That way movement in the neighbouring room isn't detected.
- Mount it firmly: A vibrating or swinging sensor detects its own movement. Fix the board with a screw or double-sided tape.
- Pull-down on long wires: If the OUT line is longer than a metre, put a 10 kΩ resistor between the input pin and GND. That way the line doesn't float and pick up interference.
RCWL-0516 with the ESP32
The code is almost the same on the ESP32. You power the sensor from the VIN pin (5 V from USB) and connect OUT to GPIO 27. Since OUT already gives 3.3 V, no level shifter is needed. A red LED with a 220 Ω resistor on GPIO 26 draws about (3.3 − 2) / 220 ≈ 5.9 mA at 3.3 V and is easily visible. The example below also counts every rising edge with attachInterrupt. If you leave the sensor in an empty room and watch how many triggers arrive per hour on the Serial Monitor, you can measure false triggers. You then choose the filter times based on that measurement. The code compiles without changes on versions 2.x and 3.x of the ESP32 Arduino core.
1// ESP32 + RCWL-0516: hareketle yanan lamba ve tetik sayacı / motion lamp and trigger counter
2const int RADAR_PIN = 27; // RCWL-0516 OUT
3const int LAMP_PIN = 26; // LED (220 ohm) ya da röle IN / LED (220 ohm) or relay IN
4const unsigned long LAMP_ON_TIME = 30000UL;
5
6volatile bool newTrigger = false;
7volatile unsigned long triggerCount = 0;
8
9unsigned long lastMotion = 0;
10bool lampOn = false;
11
12void IRAM_ATTR onRadar() { // kesme fonksiyonu kısa olmalı / keep the ISR short
13 triggerCount = triggerCount + 1;
14 newTrigger = true;
15}
16
17void setup() {
18 Serial.begin(115200);
19 pinMode(RADAR_PIN, INPUT);
20 pinMode(LAMP_PIN, OUTPUT);
21 digitalWrite(LAMP_PIN, LOW);
22 delay(5000); // sensörün oturmasını bekle / let the sensor settle
23 attachInterrupt(digitalPinToInterrupt(RADAR_PIN), onRadar, RISING);
24}
25
26void loop() {
27 if (newTrigger) {
28 newTrigger = false;
29 unsigned long count = triggerCount;
30 Serial.printf("Tetik / Trigger #%lu, sure / uptime %lu s\n", count, millis() / 1000);
31 }
32
33 if (digitalRead(RADAR_PIN) == HIGH) { // hareket var / motion detected
34 lastMotion = millis();
35 if (!lampOn) {
36 lampOn = true;
37 digitalWrite(LAMP_PIN, HIGH);
38 }
39 }
40
41 if (lampOn && millis() - lastMotion >= LAMP_ON_TIME) {
42 lampOn = false;
43 digitalWrite(LAMP_PIN, LOW);
44 }
45 delay(10);
46}RCWL-0516 with Raspberry Pi Pico and MicroPython
On the Raspberry Pi Pico, power the sensor from the VBUS pin (5 V from USB). Connect OUT to GP15 and the LED to GP14 through a 220 Ω resistor. No extra library is needed in MicroPython. You read the pin with machine.Pin and keep time with time.ticks_ms() and time.ticks_diff(). ticks_diff gives the right result even when the counter wraps around, so always use it for time comparisons. If you're new to MicroPython, first take a look at the MicroPython basics post.
1from machine import Pin
2import time
3
4radar = Pin(15, Pin.IN) # RCWL-0516 OUT -> GP15
5lamp = Pin(14, Pin.OUT) # LED (220 ohm) -> GP14
6LAMP_ON_MS = 30000 # son hareketten sonra 30 s / 30 s after last motion
7
8lamp.value(0)
9time.sleep(5) # sensörün oturmasını bekle / let the sensor settle
10lamp_on = False
11last_motion = time.ticks_ms()
12
13while True:
14 now = time.ticks_ms()
15 if radar.value() == 1: # hareket var / motion detected
16 last_motion = now
17 if not lamp_on:
18 lamp_on = True
19 lamp.value(1)
20 print("Hareket: lamba acik / Motion: lamp on")
21 if lamp_on and time.ticks_diff(now, last_motion) >= LAMP_ON_MS:
22 lamp_on = False
23 lamp.value(0)
24 print("Hareket yok: lamba kapali / No motion: lamp off")
25 time.sleep_ms(20)RCWL-0516 project ideas
- Stair and corridor lighting: Hide the sensor in the plastic housing of a ceiling light and switch the lamp with a relay. If you have no experience with the 220 V side, always get help from an electrician.
- Hidden alarm: Put the radar behind a bookshelf or a cabinet door so a buzzer sounds when there's motion. The Arduino alarm system post is a good starting point for the design.
- Phone notification: With an ESP32, send a message through a Telegram bot when motion is detected.
- Smart home integration: Send the motion state to Home Assistant via MQTT and Home Assistant and automate other devices based on it.
- Dual-technology detector: Use a PIR and the RCWL-0516 together and sound the alarm only when both see motion.
- Smart night light: Add an LDR to an analog pin. The lamp lights only when it's dark and there's motion.
- Proximity trigger: Reduce the range to 1.5 metres with the R-GN resistor. That way you can build an automatic display or bin lid that detects only a person coming up next to it.
Common mistakes and how to fix them
| Problem | Likely cause | Fix |
|---|---|---|
| Doesn't detect anything | Power applied to the 3V3 pin, or the CDS pin is touching GND | Give 5 V to VIN and leave the CDS pin unconnected |
| Lamp never turns off | The sensor sees a fan, a curtain or movement behind the wall | Change the direction, shorten the range with R-GN |
| Turns on randomly every few minutes | Supply noise, a nearby Wi-Fi antenna or a second radar | Add 100 µF and 100 nF capacitors, leave some distance, use two-stage confirmation |
| Lamp comes on once at power-up | The sensor hasn't settled after being powered | Wait a few seconds in setup() |
| Uno sometimes doesn't read HIGH | 3.3 V output is close to the 5 V threshold; long or loose wire | Shorten the wire, add a 10 kΩ pull-down to the input |
| Arduino resets when the relay switches | Relay coil and sensor are powered from the same weak 5 V line | Power the relay from a separate, strong 5 V supply and join the GNDs |
Thanks to its low price, invisible mounting and immunity to heat, the RCWL-0516 is a strong alternative to a PIR in motion-activated lighting and alarm projects. Two things to watch out for: remember that it sees beyond walls, and plan for false triggers from the start. If you want to compare different sensing methods, take a look at the distance sensors comparison post. In the BlueGrays app you'll find a motion-sensing doorbell, ESP32 automatic lighting, smart stair lighting and motion alarm projects with step-by-step circuit diagrams and code. You can even build your own version of these projects using the RCWL-0516 instead of a PIR.
Frequently asked questions
Can the RCWL-0516 detect through walls?
Yes. The microwave signal passes through non-conductive materials such as plasterboard, wood, plastic and glass, so the sensor can detect motion behind a thin wall or door. Brick and concrete weaken the signal heavily, and metal reflects it completely. This makes the sensor easy to hide, but it also means motion in the next room can switch the lamp on.
Is the RCWL-0516 or a PIR sensor better?
They suit different jobs. A PIR sees only warm, moving objects, draws microamps and is ideal for battery-powered devices. The RCWL-0516 covers about 360 degrees, isn't affected by heat or sun and can be hidden in a box. In return, it false-triggers more often because of curtains, fans or vibration.
How do you reduce the RCWL-0516's range?
If you solder a resistor to the R-GN pad on the back of the board, the receiver gain drops and the range shortens. About 1 MΩ brings the range to around 5 metres and 270 kΩ to around 1.5 metres. Pointing the sensor only at the area you want to monitor and using two-stage confirmation in software also reduces the effect of weak distant triggers.
Does the RCWL-0516 work at 3.3 V?
The specified supply range for the sensor's VIN pin is 4–28 V. So even in ESP32 and Pico projects you need to power the sensor from 5 V. The 3V3 pin on the board is an output and shouldn't be used as an input. The OUT output is about 3.3 V, so it can be connected directly to the ESP32 and Pico without a level shifter.
Why does the RCWL-0516 keep triggering?
The most common causes are noise on the supply line, an ESP32 Wi-Fi antenna very close by, a fan, curtain or vibrating surface in the sensor's view, and movement behind the wall. Add 100 µF and 100 nF capacitors between VIN and GND and mount the sensor firmly. Shorten the range with the R-GN resistor and use two-stage confirmation in software.
Is the RCWL-0516 harmful to health?
It isn't considered harmful in normal use. The sensor's transmit power is at the milliwatt level and below that of an ordinary Wi-Fi router. The signal it emits is non-ionizing. Similar microwave motion sensors are widely used in household lighting and automatic door products.
Projects to build after reading this
See all projects
LED Blink
The very first hello of electronics: switching a single LED on and off. The Arduino turns the LED on and off at short intervals, so the light blinks quickly.

LED Blink with ESP32
Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

Motion Detector with Motion Sensor
A simple guard that tells you when someone walks into the room. The motion sensor picks up the warmth given off by the human body, and the Arduino keeps the LED on as long as there is movement and…

Doorbell and Light with Motion Sensor
When someone comes up to your door, you know before they even ring. As soon as the motion sensor spots someone, the LED lights up and the buzzer plays a three-note chime from high to low; when the…

Smart Stair and Corridor Lighting
Step onto the stairs or into the hallway and the lights come on one step at a time in the direction you are walking.

Automatic Lighting with the ESP32 PIR Motion Sensor
In this project an HC-SR501 PIR motion sensor detects someone entering the room and turns on an LED automatically. millis() tracks how long the LED stays on: each HIGH reading refreshes the last-motion time, and the LED turns off at least 10 seconds after the last HIGH. The code also waits 50 ms with delay(50) in every loop, so the loop is not fully non-blocking. Great for stairs, hallways, bathrooms or closet lighting.

ESP32 Smart Lighting (PIR + LDR + Relay + OLED)
With an ESP32, a PIR motion sensor, an LDR light sensor and a relay module, we turn your hallway, bathroom or pantry into smart lighting. If the room is already bright, the light stays off even when there is motion, so it never wastes energy during the day. The light stays on for 30 seconds, and the time extends automatically while motion continues.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32 and Pico projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

