Doppler radar module RCWL-0516 with Arduino

FunduinoPublished on

Bewegungen mit dem Doppler-Radar erkennen und einen Alarm auslösen

Das RCWL-0516 erkennt Bewegungen per Radar – über den Doppler-Effekt. Es ist sehr empfindlich und deckt einen Bereich von rund 5 bis 7 Metern ab.

In dieser Anleitung schließt du das Modul an, liest seinen Bewegungsstatus am seriellen Monitor mit und lässt anschließend einen Piezo-Lautsprecher Alarm schlagen, sobald sich etwas bewegt.

Doppler radar module RCWL-0516 at the edge of a breadboard
The antenna must extend beyond the edge of the breadboard.

You need this

RCWL-0516 motion detector - Doppler radar, up to 7 m, 4-28 V RCWL-0516 motion detector - Doppler radar, up to 7 m, 4-28 V 1,87 € *Item no. F23106645About the product — RCWL-0516 motion detector - Doppler radar, up to 7 m, 4-28 V
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino 11,12 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
830-point Breadboard - solderless breadboard for Arduino 830-point Breadboard - solderless breadboard for Arduino 2,90 € *Item no. FUN-1010553About the product — 830-point Breadboard - solderless breadboard for Arduino
Breadboard Cables Male-to-Male - 40 Pieces, 20 cm Breadboard Cables Male-to-Male - 40 Pieces, 20 cm 1,74 € *Item no. FUN-1010558About the product — Breadboard Cables Male-to-Male - 40 Pieces, 20 cm

All 4 parts together 17,63 € *Ready to ship immediately · Delivery time: 1-3 business days

* All prices include statutory VAT, plus shipping costs.

How the RCWL-0516 works

The RCWL-0516 is a highly sensitive radar sensor with a detection range of approximately 5 to 7 meters. According to the manufacturer's datasheet, its operating angle is about 120°. In our own tests, the module even detected and processed movement within a radius of up to 200°.

The module gets its name from the Doppler effect, on which its radar technology is based. Put simply, the radar measures the frequency shift between the transmitted and reflected signals to detect whether an object is moving closer or farther away, and how fast. The same technology is used, for example, in speed cameras. You can find out more in the article about the Doppler effect on Wikipedia.

The module is easy to use because its internal electronics already process the detected movement. When it detects movement, it outputs a HIGH signal on pin OUT for about 2 seconds. The signal then returns to LOW, and the module can be triggered again. You can process this signal with the microcontroller.

Warning: If the antenna is on or near a metal surface, the range drops to about 10 centimeters. So don't place the module in the middle of the breadboard - the antenna must extend beyond the edge, as shown in the photo.

Doppler radar module RCWL-0516 at the edge of a breadboard
The antenna must extend beyond the edge of the breadboard.

Pinout

The module has five pins. You need three of them:

  • VIN – to the microcontroller’s 5V pin
  • GND – to the microcontroller’s GND pin
  • OUT – to a digital pin on the microcontroller, pin 8 in the sketches
  • 3V3 – left unconnected
  • CDS – left unconnected

Exercise 1: Motion status on the serial monitor

First, simply read the motion status in the Serial Monitor.

If a 0 appears there, no motion was detected. If it shows a 1, the module detected motion. With this short sketch, you can immediately see whether your setup is correct and how the module responds.

Exercise 1: Read the motion status
int Radar module = 8;
int VALUE;

void setup()
{
  Serial.begin(9600);
  pinMode(Radar module, INPUT);
}

void loop()
{
  VALUE = digitalRead(Radar module);
  Serial.println(VALUE);
  delay(100);
}

Exercise 2: Trigger an alarm sound

Now use the radar sensor's data to trigger an “alarm” in the form of an audio signal. To do this, expand the circuit by adding a piezo speaker to pin 7.

When the module detects movement, the speaker beeps for one second. It then stays silent for five seconds before the sketch starts again from the beginning.

Schematic: RCWL-0516 and piezo speaker with Arduino UNO
Circuit diagram for exercise 2: radar module on pin 8, piezo speaker on pin 7
Exercise 2: Alarm sound when motion is detected
int Radarmodul = 8;   // OUT of the radar module connected to pin 8 of the microcontroller
int Piepser = 7;      // "+" of the piezo speaker connected to pin 7
int WERT;             // Variable for the measured value

void setup()
{
  Serial.begin(9600);
  pinMode(Radarmodul, INPUT);
  pinMode(Piepser, OUTPUT);
}

void loop()
{
  WERT = digitalRead(Radarmodul);
  Serial.println(WERT);

  if (WERT > 0)
  {
    digitalWrite(Piepser, HIGH);  // Turn on the piezo speaker.
    delay(1000);                  // Wait 1000 milliseconds. (It beeps)
    digitalWrite(Piepser, LOW);   // Turn off the piezo speaker.
    delay(5000);                  // Wait 5000 milliseconds. The loop then starts again.
  }
}
Rate the instructions

Comments

Ask a question or share an experience

Contact us if something doesn’t work. Please include your board and the error message.

We review every comment before publication. Your email address remains with us.