Monday, July 17, 2017

Microwave Radar Sensor RCWL-0516 with Arduino Uno

The Microwave Radar Sensor RCWL-0516 is an interesting cheap motion sensor.
At Aliexpress i found 5 pieces for  € 2,19 => € 0,44 / piece.

Info how to wire the device and a test program was found on

I soldered some wires with Dupont connectors to one of my RCWL-0516 modules and tested the program with an Arduino Uno (clone). Not yet with ESP8266, perhaps that will come in another RCWL-0516 post. It found some little errors that i needed to corrected. When changing the program i also did put the serial output on one line for each change with a millis() timestamp.

The program after my changes:

2017 July 17 by @JanJeronimus  / Correction 'bool sens;'& 115200 /  Output one line , added additional and spacesMillis() 
static bool value = -1;
bool sense;

const int8_t Output = 13;
#ifdef ESP8266
const int8_t sensor = D2;
const int8_t sensor = 2;

void setup(){
#ifdef ESP8266
Serial.println(" 14CORE | DOPPLER RADAR TEST CODE");
Serial.println("ESP8266 Started......");
Serial.println("Arduino MCU Started......");
pinMode(Output, OUTPUT);
pinMode(sensor, INPUT);

void loop(){  
sense = digitalRead(sensor);
if (sense != value){
  Serial.print( millis()); 
  Serial.print(" Raw Value : ");
  Serial.println(sense ? " +HIGH" : " -LOW");   
#ifdef ESP8266
  digitalWrite(Output, ! sense);
  digitalWrite(Output, sense);
  value = sense;

To use the program you need to connect 3 pins
OUT - connect this to an input pin (Arduino D2)
VIN 4 to 28 volt
It seems the CDS pin can be used to disable detection. You need not to connect it.
The 3V3 pin is for output not input!  (Interesting to try if it can be used to power an ESP8266!)

The sensor works fine and can detect motion even behind obstacles. It can detect motion at about 3 to 4 meter distance.

Some other references

Two videos about the RCWL-0516 by nenioc187 :

Specs & Pin info :

No comments: