Interfacing RCWL-0516 Doppler Radar Sensor with Arduino
Motion detection is very useful for monitoring system, Switches for Electronic appliances, Home automation, intruder alarms and industrial automation applications. normally we used PIR Sensors for these applications, it senses the change in ambient infrared energy caused when a warm body enters the monitored area. The RCWL-0516 is a motion detection sensor. Using this sensor we can detect motion through doppler microwave technology through walls or other materials. In this tutorial we learn how to interface RCWL-0516 Doppler Radar Sensor with Arduino Nano. RCWL-0516 sensor will get triggered not only by people but also by other moving objects.
What we need
- Arduino Nano board
- RCWL-0516 Doppler Radar Sensor
- LED
- 220Ω Resistor
What is RCWL-0516 Sensor ?
The RCWL0516 Microwave distance sensor uses microwave frequencies in a simple implementation of a Doppler radar. The circuitry inside the chip processes the signal and outputs an analog voltage that is proportional to the distance between the object and sensor. The RCWL-0516 sensor uses the Microwave Doppler radar technology to detect moving objects. The Doppler radar works by transmitting a microwave signal to a target and then analyzing the change in the frequency of the returned signal. The variation in the received signal frequency can also help measure the target’s velocity with respect to the radar.
This sensor module uses an RCWL-9196 chip that supports repeat trigger and a 360-degree detection area with no blind spot. It can detect motion through walls and other materials and have a sensitivity range of 7 meters.
RCWL0516 Module Pin Description
Pin Number | Pin Name | Description |
1. | 3V3 | Regulated 3.3V output |
2. | GND | Ground reference for module |
3. | OUT | Analog output from the sensor |
4. | VIN | Voltage input for the module |
5. | CDS | Sensor Disable |
RCWL0516 Module Specifications
- Input Voltage – 4V to 28V
- Operating current – 3mA (max.)
- Operating frequency – 3.2GHz
- Transmission power – 30mW (max.)
- Regulated output voltage – 3.3V, max. 100mA
- Sensing distance – 5 to 7 meters
Circuit Diagram for interfacing RCWL-0516 with Arduino
The schematic for interfacing RCWL-0516 with Arduino is given below:
The LED is connected to the D3 pin of Nano. The VIN and GND pin of RCWL-0516 is connected to the 5V and GND pin of Arduino Nano while the OUT pin of the sensor is connected to D12 of Nano.
Programming Arduino for Motion Detection using RCWL-0516 Sensor
The explanation of the code is as follows:
Start the code by defining all the necessary pins that are required to read the sensor data and control the LED.
int Sensor = 12; int LED = 3;
Then inside the setup() function initialize the serial monitor at 9600 for debugging purposes. Also, set the sensor pin as input and the LED pin as output.
void setup() { Serial.begin(9600); pinMode (Sensor, INPUT); pinMode (LED, OUTPUT); Serial.println("Waiting for motion"); }
Then inside the loop() function, read the sensor pin using digitalRead() and the pin is valued greater than 0, then turn on the LED else turn off the LED.
void loop() { int val = digitalRead(Sensor); //Read Pin as input if((val > 0) && (flg==0)) { digitalWrite(LED, HIGH); Serial.println("Motion Detected"); flg = 1; } if(val == 0) { digitalWrite(LED, LOW); Serial.println("NO Motion"); flg = 0; }
Test
After flashing the code, open the serial monitor at a baud rate of 9600, and make some motion in front of the sensor. Observe LED and Serial monitor.