Language: EN

arduino-detector-movimiento-rcwl-0516

Motion Detector with Arduino and RCWL-0516 Microwave Radar

What is RCWL-0516?

The RCWL-0516 is a Doppler effect microwave radar sensor. We can use it alone, or combined with a processor like Arduino, to make a motion detector.

The RCWL-0516 is an alternative to the traditional PIR infrared motion detectors. In comparison to these, it has certain differences, which will be an advantage or disadvantage depending on the needs of our project.

First, PIR sensors require the moving object to have a temperature difference from the environment. For this reason, they are able to detect people, but not moving objects. In contrast, the RCWL-0516 detects any moving object, regardless of its temperature.

On the other hand, PIR sensors have sensitivity issues when the ambient temperature is high. The RCWL-0516, on the other hand, does not have this problem and works correctly between -20ºC to 80ºC.

In terms of detection range, the RCWL-0516 has a greater range than PIR sensors, easily reaching 5-7 meters.

Finally, the RCWL-0516 is omnidirectional, meaning that it detects movement in 360º. This is a difference compared to PIR sensors, which have a certain “field of view”. There are even PIR versions with a narrow beam, for example to control windows or doors.

This lack of directionality of the RCWL-0516 can be an advantage over PIR sensors if we want to detect movement in a room. Or a disadvantage, for example, if we want to detect only in a hallway, a door, or a window.

These differences make the RCWL-0516 a good complement or even a substitute for PIR sensors in systems such as alarms, lighting control, or presence detection.

For those concerned about “microwaves”, the emission power is very low and, of course, the RCWL-0516 is completely safe to operate for people and animals.

Price

The RCWL-0516 devices are very cheap. We can find them for 0.40€ from international sellers on Ebay and Aliexpress.

arduino-rcwl-0516-componente

How does RCWL-0516 work?

The RCWL-0516 bases its motion detection system on the Doppler effect. Basically, a high-frequency emitter emits a 3.2GHz wave.

Any electromagnetic wave with a frequency between 0.3GHz and 30 GHz is considered a microwave.

When the wave hits a moving object, the reflected wave changes its frequency. A receiver receives the wave reflected in the object, and combines it with the emitted wave.

arduino-rcwl-0516-efecto-doppler

The difference between both waves is filtered by a low-pass filter, and amplified by a transistor stage.

arduino-rcwl-0516-funcionamiento

The RCWL-0516 operates at 3.3V, but the module has an internal 3.3V 100mA regulator. The supply voltage is 4 to 28V. The normal power consumption is 3mA.

The module output is a 0 to 3.3V TTL signal. In case of detection, the output goes HIGH for a period of 2-3 seconds.

Assembly diagram

The electrical diagram we need is as follows.

arduino-rcwl-0516-conexion

Which, seen from Arduino, would look like this.

arduino-rcwl-0516-esquema

Additionally, the module incorporates a CDS pin, which is used to disable the output when the CDS pin is set to LOW.

There is also space on the board to add an LDR to the module, so that detection does not work when there is light (useful when using it for lighting control).

Code examples

The code needed to perform the reading is simple, and similar to what is necessary for a PIR sensor. We simply read the output of the RCWL-0516, and flash the LED while the signal is active.

const int LEDPin = 13;
const int RadarPin = 2;
 
void setup()
{
  pinMode(LEDPin, OUTPUT);
  pinMode(RadarPin, INPUT);
}
 
void loop()
{
  int value= digitalRead(RadarPin);
 
  if (value == HIGH)
  {
    digitalWrite(LEDPin, HIGH);
    delay(50);
    digitalWrite(LEDPin, LOW);
    delay(50);
  }
  else
  {
    digitalWrite(LEDPin, LOW);
  }
}

Download the code

All the code from this post is available for download on Github. github-full