Professional Documents
Culture Documents
using microwaves and doppler effect, and we’re using RCWL-0516 module.
Another popular motion sensor is the PIR HC-SR501, and as the name implies, it uses “Passive InfraRed”
light waves to detect a motion, this PIR is emitted by humans or animals mostly, and anything that’s
warm/hot.
Unlike the sensor above, the RCWL-0516 constantly sends microwaves around it, and they reflect back, if
ANYTHING moves within the range will cause a change in the waves wavelength or the frequency “Known
as Doppler effect“, and by anything I mean if it emits PIR/warm/hot or not, so it’s better at this point.
You can observe (hear) the Doppler effect while a police car is moving, you can hear a different siren sound
when the car is near you and when it’s driving away…
RCWL-0516 Specifications
Parts
Actually the Arduino is not needed much, but I’m just doing it in case you want to add it to your project,
and as you saw it’s better than the PIR sensor.
Direct wiring
Optional LED
Codes
The two codes are easy and simple
Code 1
The sensor output is on 2, there’s a message that constantly print on the serial monitor: clear and if there’s a
motion it tells you Motion detected, if you don’t like this constant printing you can add the flag method, it
will show the message only once
#define Sensor 2
void setup() {
pinMode(Sensor,INPUT);
Serial.begin(9600);
}
void loop() {
bool Detection = digitalRead(Sensor);
if(Detection == HIGH)
Serial.println("Motion detected !!");
if(Detection == LOW)
Serial.println("Clear");
}
Code 2
We add the LED and as long as the Output is HIGH the LED will light up for 2s
#define Sensor 2
#define LED 3
void setup() {
pinMode(Sensor,INPUT);
pinMode(LED,OUTPUT);
}
void loop() {
bool Detection = digitalRead(Sensor);
if(Detection == HIGH)
digitalWrite(LED,HIGH);
if(Detection == LOW)
digitalWrite(LED,LOW);
}
Test
The LED lights up if there’s a motion
Add-on
As you can see the module, is pretty much stand alone, so there are some modifications that you can apply
directly on the circuit
R-GN : here you can solder a 1 MOhm resistor to reduce the range from 9m to 5m only
C-TM : here you can solder a capacitor to increase the output trigger time, 2s is the default
CDS: here you can add a LDR (Light Dependent Resistor), and the module will be active only when
there’s *no enough light* for example of outdoor lighting, you don’t want lighting in the morning or
afternoon, but you want to wait until sunset or complete dark.
R-CDS: here you can solder a resistor to control the *enough light, if you want to activate the module
from the sunset or you want to wait until complete dark, the resistor value will define when it’s ok to start
the automatic lighting for example, the smaller the resistor value, the brighter it has to be to deactivate the
trigger