Interfacing RCWL-0516 Microwave Radar Sensor with Arduino (original) (raw)

In this user guide we will learn to interface RCWL-0516 microwave radar sensor module with Arduino and program it for motion detection. We will discuss the components of RCWL-0516 sensor module, pinout, configuration, features, specifications, interfacing, 2D model, and applications.

We have similar guide with ESP32 and ESP8266 NodeMCU:

RCWL-0516 Microwave Distance Sensor Module

RCWL-0516 is a microwave radar sensor created to replace passive infrared motion sensors that utilize infrared light emitted by a moving person. RCWL-0516 uses a doppler effect technique to sense moving objects. Distance sensors are employed to measure the distance of the target by sending high frequencies. Microwaves are electromagnetic waves with VHF/UHF bands used for communication purposes. Short microwaves serve in sensing applications, especially in radars, alarm systems, and human body detection.

RCWL-0516 Components

The following figure shows the components of an RCWL-0516 module :

RCWL0516 Microwave Distance Sensor Module components

The module consists of an Input/Output block, an RCWL-0516 IC and RF Antenna, and an Amplifier block with some optional connections.

RCWL-0516 Pinout

Following is the pinout of the RCWL-0516 Microwave Distance Sensor Detector Module :

RCWL0516 pinout diagram Microwave Distance Sensor Module

Pin Configuration

The pin configuration detail in tabular is mentioned below:

Number Pin Name Function
1 3V3 3.3V output pin
2 GND Ground pin
3 OUT Analog sensor output pin
4 VIN Power Supply pin
5 CDS Sensor disable pin

Features and Specifications

Internal Circuitry

RCWL0516 internal circuit diagram

Input/output Block: This block contains power supply pins and I/O pins connections to microcontrollers and other electronic components.

RCLW0516 IC: The IC is a system responsible for performing the doppler effect technique and is prone to fewer errors than PIR.

RF Amplifier and Antenna: An inbuilt antenna to capture the incoming waves with an amplifier to boost the module’s radio waves.

Capacitors and NPN Transistor: An NPN transistor alongside capacitors and an inductor produces oscillations at a particular high frequency. In simple words, it works as a Colpitts oscillator. The capacitors are also responsible for the decoupling and filtering of signals.

CDS: A pin to add up a light resistor to the module to make the module work only in darkness. It also functions as an enable/disable control.

C-TM, R-CDS, R-GN are used to alter the module according to the requirement. C-TM is used to elongate the trigger time of the pin by the addition of a capacitor.

To change the limit value of the photoresistor, R-CDS should be connected to a suitable resistor. Lastly, R-GN can help us to adjust the measuring distance of the sensor. Attaching it to a resistor can reduce the range of the sensor.

How does RCWL-0516 work?

The integrated antenna captures and generates the microwave signals. When the antenna receives a reflected signal, it sends it to the mixer/amplifier. It mixes the transmitted and reflected signal, and the difference between them is then passed to the IC for processing. The IC sends an output voltage signal, which showcases the distance between the body and the sensor.

Interfacing RCWL-0516 Module with Arduino for Motion Detection

In this section, let us show you how to connect the RCWL-0516 sensor module with Arduino for our motion detection project.

You will need the following components

The connections between the RCWL-0516 Module and Arduino can be seen in the table below.

RCWL-0516 Module Arduino UNO
GND GND
VIN 5V
OUT D10

We are using 5V Arduino pin to connect with the Vin pin of the sensor module. The OUT pin of the sensor module is connected with analog pin 10 of Arduino. Moreover, we will connect an LED with the Arduino as well. Whenever, motion will be detected, the LED will turn on for a few seconds. The LED is connected with analog pin 7 of Arduino through a 220 ohm current limiting resistor. All the components have a common ground.

Follow the schematic diagram below for the Arduino, sensor module and LED and connect them accordingly.

RCWL-0516 with Arduino schematic diagram

Arduino Code: Motion Detection with RCWL-0516 Sensor Module

Open Arduino IDE and copy the following sketch in a new file and save it.

int detectPin = 10;
bool detect = false;
int led = 7;

void setup() {
 Serial.begin(115200);
 Serial.println("Starting...\n");
 pinMode (detectPin, INPUT);
 pinMode (led, OUTPUT);
 digitalWrite(led, LOW);
}

void loop() {

 detect = digitalRead(detectPin);
 if(detect == true) {
 digitalWrite(led, HIGH);
 Serial.println("Movement detected");
 }
 else {
 digitalWrite(led, LOW);
 }
 delay(1000);
}

Working of Code

When this motion detector sensor senses a motion, it triggers its output pin to active high state for 2-3 seconds and after that it goes to active low state again. As soon as a motion is sensed, the serial monitor will display motion detected message and the LED turns ON.

The digitalRead() function of Arduino is used to measure the active high state. If you don’t know how to use Arduino digital pins, you should refer to this article

Demonstration

In Arduino IDE, click Tools > Board and select Arduino.

select ESP8266 NodeMCU board

Now, click Tools > Port and choose the port which you are using. Now, upload the code by clicking on the upload button.

After you have uploaded the following code on your Arduino development board, press the RESET button as follows:

ESP8266 NodeMCU reset button

In your Arduino IDE, open up the serial monitor and set the baud rate to 115200. Now whenever there is a motion in front of the RCWL-0516 microwave sensor, it will detect the sensor and display the “Movement detected” message on the Arduino serial monitor. Moreover, the LED which is connected with D7 pin of Arduino also turns on.

RCWL-0516 with Arduino Motion Detection serial monitor

RCWL-0516 with Arduino Motion Detection

RCWL-0516 Alternative Options

Applications

2D Diagram

The following figure shows the 2d model of the RCWL-0516 Microwave Distance Sensor Module. It shows us the physical dimensions of the components needed when a PCB card is designed.

RCWL0516 2D diagram

Related Articles:

Arduino Components Amazon Links
Arduino Starter Kit Buy Now
Arduino Development Kit Buy Now
Arduino Smart Robot Car Kit V4 Buy Now
Arduino Sensors Kit Buy Now