Showing posts with label RCWL-0516. Show all posts
Showing posts with label RCWL-0516. Show all posts

Wednesday, June 10, 2020

Microwave Radar Sensor RCWL-0516 -2- (led)


Motion detector with led 
This is the next post on this blog testing the RCWL-0516 sensor. This sensor uses a “microwave Doppler radar” technique to detect moving objects and has a sensitivity range of ~7 meters.
The sensor does NOT detect if someone is near , it can only detect movements!
A long time ago my first post was about using the Microwave Radar Sensor  RCWL-0516 with an Arduino Uno.
 
This cheap and interesting module has the following connections :
  • 3V3  - Output 3V3 Regulated DC (100 mA)  This is 3V3 Output NOT input !
  • GND - Ground 0 V
  • OUT - Microwave Radar sensor output ( HIGH (3.3 V) motion detected/LOW (0 V) idle)
  • VIN  - 4 to 28 volt input to power this module
  • CDS - This pin can be used to disable detection. You need not to connect it. (Low= Disabled)
A 9 Volt battery was used to power the module. Be aware that after powering the module there is a delay (10 seconds) before the sensor is active.
Besides the CDS pin it is also possible to solder a light detecting resistor ( LDR ) in to the two holes below the RCWL-0516 text/logo. (On the other side of the PCB it is in the top-left square). When there is light on the LDR the Microwave Radar Sensor will not give a signal on the OUT pin.

In this post i describe recent tests using this proximity sensor without a micro controller. The photo's with the Dupont wires on the sensor connectors where from the previous post. This time i soldered pins to a sensor.
\\
.




1) In the first test i connected a "standard led" between the OUT and GND with a 220 ohm resistor. This is a simple configuration to test the sensor

2) As i also wanted to check if the circuit is on i also added a (red) led between GND and 3V3 

3) The next idea was using a laser led. The advantage of using a the laser is the very far distance of the laser beam can travel before projecting a dot. The laser light can travel further than standard WiFi, Bluetooth or 433MHz radio signal. On a distance of more than 40 meter you should be able to see if there was movement near the sensor. 
The disadvantage is that you need a line of sight and you can not check if the sensor is functioning as the laser is default off. I tested drivign a cheap laser led directly on the output. However it seemed not possible to drive directly a laser (at least not the small lasers i have) with this module. So direct driving a laser led was a failure. The laser led does light when connected between ground and 3V3 an option could be driving the laser indirect e.g. using a transistor, opto-coupler or relay.

4) I also wanted to do some tests to know if it is better leaving the CDS 'floting' or connect the CDS pin to a logic level.

A prototype perf board was used to create a development/test board for a real test environment. Using wires only would reduce space however it also would lose some flexibility. I did not want to order a PCB or use a breadboard.
Bottom right is the power connection. The switch is used to turn the battery power on/of. Jumpers where used to enable or disable parts of the circuit. I did not want to use a (more expensive) breadboard.
Different colors for the jumpers are used.
The red jumper is used to enable the 'power on' led
The yellow jumper is used to enable the yellow 'signal out' led (using a resistor) 
The white jumper can be used to connect CDS to GND.
Also additional pins an connectors where added to play and do (lateron) more experiments with this sensor.

The sensor pins from left to right (extended over the full lenght of the perfboard) are   
01 - CDS
02 - VIN 
03 - OUT
04 - GND
05 - 3V3  
Results: 
It is possible to direct derive a led with a small resistor) between the output pin and ground without a micro controller.

A battery powered board with a circuit  to test the RCWL-0516 was created and could be used to test the sensor.

Direct driving a small laser led was not possible. Perhaps indirect using a relay, transistor opto-coupler this is possible.

First test showed that motion at about 3.5 meter could be detected using this circuit.

Currently i can not yet decide if it is better to leave the CDS pin floating or connecting it to a logic signal. Both options seem to work. More tests need to be done to decide what is better. 


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 https://www.14core.com/wiring-the-rcwl0516-auto-induction-doppler-microwave-radar-with-esp826632arduino/

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:


/* 14CORE | DOPPLER RADAR TEST CODE 
*************************************
From https://www.14core.com/wiring-the-rcwl0516-auto-induction-doppler-microwave-radar-with-esp826632arduino/
Modified
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;
#else
const int8_t sensor = 2;
#endif

void setup(){
Serial.begin(115200);
#ifdef ESP8266
Serial.println(" 14CORE | DOPPLER RADAR TEST CODE");
Serial.println("==================================");
Serial.println("ESP8266 Started......");
digitalWrite(Output,1);
#else
Serial.println("Arduino MCU Started......");
digitalWrite(Output,0);
#endif
pinMode(Output, OUTPUT);
pinMode(sensor, INPUT);
}

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

To use the program you need to connect 3 pins
GND
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 :
  https://www.elecrow.com/rcwl-0516-microwave-radar-sensor-switch-module-body-induction-module-4-28v-100ma.html

 https://github.com/jdesbonnet/RCWL-0516/