Zonnestroompanelen in Nederland

duurzaamheid achter de meter

(20) RCWL-0561 Doppler radar motion sensor

The RCWL-0516 Doppler radar motion sensor, an Arduino Nano and an ‘event-LED’

by Floris Wouterlood – The Netherlands – September 30, 2020

Motion detection, or more precise: sensing a change in the environment caused by an object whose position alters, is widely available in commercial systems that switch lights on at night at the front door of your home when somebody approaches, in cupboard- and staircase lighting, security systems and car protection. One very popular area is wildlife photography. Most of the popular motion detection devices use infrared detection. However, not all moving things emit infrared radiation.
The disturbance that a moving object causes when it enters a radiowave field can be detected by the Doppler principle. An intriguing proximity sensor available for the Arduino community based on Doppler radar technology is the RCWL-0516.

Figure 1. Front and rear of a RCWL-0516 breakout board. The upper surface with the electronic components is the ‘active’ side that is supposed to face the area to be monitored. The CDS header on the front (arrow) accommodates a photoresistor to enable night operation. Extra jumpers are available on the rear. They are indicated here with an asterisk: C-TM supports a capacitor to increase output signal duration, R-GN supports range selectivity: a 1MΩ resistor soldered here decreases detection distance to 5 meters. R-CDS supports a resistor whose value (50-100 kΩ) regulates how dark it should be to activate ‘night operation mode’.

The RCWL-0516 is a mini radar motion detector module (figure 1, dimensions (35 x 15 mm) that carries a transmitter that uses a radio frequency of 3,182 MHz with power output rated at 20-30 mW. Detection distance is claimed to be 5 to 9 meters. Default output trigger time is two seconds (that is: OUT pin at 3.3V HIGH during two seconds) when a change in the radiowave field has been detected. The board supports night-day detection if a light dependent resistor (LDR; e.g., a 10 kΩ photoresistor) has been soldered to the CDS header on the board and CDS has been enabled by soldering an extra resistor on jumper R-CDS (or by software via pin CDS). The higher the resistance of the photoresistor at CDS in conjunction with the resistor at R-CDS the darker the environment needs to be to trigger the sensor to start working. Input voltage is between 4V and 28V DC. Power consumption is reported to be >3 mA (2.8 mA typical).
An on board antenna produces the microwave field. Once a movement has been detected a signal is fired by the device: the pin marked ‘OUT’ is set HIGH at 3.3V during 2 seconds. This is an autonomous event that can easily be detected by an Arduino. The microprocessor can then follow up, for instance by recording the event or by triggering appropriate action. In this basic sketch the action of the Arduino is very simple: activate a led during five seconds.

Electronic components needed
1x Arduino Nano microcontroller board, 1x RCWL-0516 breakout board, prototyping breadboard, 1x 220 Ω resistor, 1 led, jumper wires.


Figure 2. Wiring diagram: Arduino Nano and RCWL-0516. A LED connected to pin D5 of the Nano lights up during a fixed period when motion is detected by the RCWL-0516.

Wiring the RCWL-0516 miniboard to an Arduino
The wiring of the RCWL-0516 is very straightforward (figure 2). The miniboard is equipped with five pins, labeled 3.3V, GND, OUT, VIN and CDS. Note that the 3.3V pin is a power output pin that continuously carries 3.3V at a rated 100 mA. This pin is therefore NOT a pin supplying power to the miniboard. Regular 5V operating power to the miniboard is in this example supplied from the Arduino’s 5V pin connected to pin VIN of the RCWL-0516.
The pin ‘OUT’ will carry 3.3V HIGH during two seconds when the detector monitors some disturbance of its radio frequency field. The pin can be connected to any input pin of the Arduino (in this example pin D2). The CDS pin is to control the day/night switch function in conjunction with software instructions on pin CDS or a 10 kΩ photosensitive resistor soldered to the jumper marked ‘R-CDS’ located on the rear of the miniboard (asterisk, figure 1).

Active side
Note that a RCWL-0516 board is shipped ‘as is’, without documentation that indicates which side of the board is ‘front’ or ‘rear’. There are some surface mounted chips and a number of contacts, and that is all. As it appears the board has a ‘field of view’ which means that the best movement detection is achieved when an object is moved in front of the side marked ‘FRONT’ in figure 1. This can be tested by placing the motion detector on the edge of a table and moving an object above and below the table edge. Even better is to position the miniboard upright on a table in the center of a room and walk around it and to and from it during testing. This makes me consider FRONT in figure 1 as the ‘active’ side, this in spite of the apparent circular antenna visible on the rear of the print. Documentation found on the internet claims ‘360 degrees radio wave field’ but omits whether that field is in 3D or just planar.

Figure 3. Prototype of a RCWL-0516 based motion detection system that reports ‘events’: moving things trigger the detector and cause the red LED to light up for a few seconds (‘event LED’).

After assembling a test detector on a prototyping board and uploading the sketch (see section at the end of this article) the board exactly performed as it was supposed to: let the Arduino light up a LED when an object is moved over or near the front side of the RCWL-0516. Placed upright in a room movement was detected at a range of up to about 5 meters.

Standalone operation
As the RCWL-0516 acts as an autonomous device it is interesting to test it without an Arduino. This can be achieved by connecting the miniboard with a 5V power source. In Figure 4 such a construction is visible: a standard breadboard power supply and a RCWL-0516 are placed on a breadboard, with a LED attached to the OUT pin of the miniboard. In figure 4 the power supply receives power via an usb smart phone charger. The breadboard power supply has a 3V-5V switch. If this switch is in the 5V position the RCWL-0516 works fine. If however the switch is set in the 3.3V position the RCWL-0516 goes into ‘error signaling mode’, that is it generates a continuous 2 seconds-ON, 1-second OFF pulse at its OUT pin. This leaves the impression that 5V is minimum operating voltage for the device. This 5V can be supplied by a breadboard power supply as good as by an Arduino. The 5V pin of an Arduino is capable of supplying 200 mA. This is more than sufficient for an RCWL-0516 to operate (20-30 mW output radiofrequency power).


Figure 4. Standalone operation of a RCWL-0516. A breadboard power supply replaces an Arduino and the ‘event’ LED is directly connected to the RCWLs OUT pin – note the 220 Ω resistor in series with the LED.

The RCWL-0516 Doppler radar motion detector does what reports on the internet claim: it generates a signal at pin OUT when a moving object is in its vicinity. In contrast to a PIR motion detector the moving object does not necessarily has to be at [human] body temperature.
The RCWL appears to be an amazing detector. Moving a hand or an object fast right in front of the detector does not trigger much response. However, moving a hand slowly some distance away produces a much better response. The greater the distance the more reliable the response seems to be. After mounting the device upright in the center of a room, walking in and out of that room through the door opening (5 meters away from the setup) gave immediate response. In the latter setup an arrangement in which the rear of the RCWL-0516 faced the entrance produced more often a correct response than when the front of the device was facing the door opening. Thus the device seems to be designed for silent surveillance work or flipping light switches in rooms at the moment when somebody enters the premise. This makes the RCW-0516 an interesting sensor to consider further experimentation with lighting closets, basements and attic spaces.
The question remains whether a fast moving object, say a tin can thrown across the room or towards a Doppler radar motion detector, would trigger that device. A PIR detector would certainly not be triggered.
It might be interesting in terms of burglar alarms to combine a PIR and a Doppler radar detection system in one anti-intruder detection kit. Both ‘hot’ (e.g, cats or raccoons) and ‘cold’ (e.g., snakes) intruders then might not go undetected.
A major field of application of the RCWL-0516 may be that of home automation and energy saving. For instance, lights may switch on when a person enters a room, stay on while the person moves around in that room, and switch off some time after the person has left. The same hold for fans/ventilation. In an application featuring an Arduino, a power switch relay and a RCWL-0516 all this might be possible.

Arduino Doppler radar motion detector – sketch
The sketch below performs the basics of motion detection: it issues a response when the sensor signals activity. There is no need for a particular library as the miniboard acts as an independent device with firmware instructions.
There are two variables to define: ‘sensorVal’ and ‘led_fire_duration’. The OUT pin of the RCWL-0516 is connected here with pin D2 of the Nano, and the ‘event signaling’ LED is wired to pin D5.

// RCWL0516_nano_led_bare.ino

#define sensorPin 2 // RCWL-0516 connected to this pin
#define ledPin 5 // LED connected to this pin
int sensorVal = 0; // initial RCWL-0516 output value as seen by Nano
int led_fire_duration = 5000;

void setup() {

Serial.begin (9600); // initialize serial communication:
Serial.print (“let’s start”);
Serial.println ();

pinMode (sensorPin, INPUT);                            // RCWL-0516 output is input for Nano
pinMode (ledPin, OUTPUT);                               // LED as OUTPUT
digitalWrite (ledPin, LOW);                                // LED off at start

void loop(){

sensorVal = digitalRead (sensorPin);                  // Read Sensor value

if (sensorVal == LOW)
digitalWrite(ledPin, LOW);
Serial.println (“led OFF “);

digitalWrite(ledPin, HIGH);
Serial.println (“led ON “);
delay (led_fire_duration);                                 // during this period the led will be ON

Note that the trigger signal provided by the OUT pin of the RCWL-0516 always has a duration of 2 seconds. Thus the LED is always on for at least two seconds: a ‘latency time’.
Note here that if the voltage powering the RCWL-0516 is too low the sensor will give a sort of error signal at its OUT pin consisting of two seconds ON alternating with one second of OFF.

In void setup I have placed some Serial.print instructions to keep track of the behavior of the RCWL-0516 during running. Only the three ‘pinMode’ instructions are essential here.

In void loop the microprocessor is instructed to keep track of the state of the OUT signal of the motion detector. This state is registered in the variable ‘sensorVal’. A HIGH state of pin OUT of the miniboard is conditional for passing voltage to the LED for the period specified in the variable ‘led_fire_duration’.

Downloadable sketch: RCWL0516_nano_led_bare.ino

Recommended websites: