Motion sensor with microwave radar for Arduino, ESP32, or Raspberry Pi projects.
SKU: OT701-D97 Article number: NA367 EAN: 8720618827913 Location: D09.07
Alternative
Microwave Doppler radar sensor HB100
€ 5,60
View this alternative
How to connect the Motion sensor with microwave radar RCWL-051 to an Arduino UNO or ESP32, with an example sketch you can upload straight away.
This circuit detects human motion using the RCWL-051 Doppler radar sensor. When motion is detected, the sensor's OUT pin goes HIGH, lighting up the Arduino's built-in LED and printing a detection message to the Serial Monitor. Microwave radar can detect movement through non-metallic obstacles such as plastic, wood, or glass.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : Microwave Radar Motion Detection with RCWL-051
* Board : Arduino UNO (arduino:avr:uno)
* Parts : Motion sensor with microwave radar RCWL-051
* Libraries : none (built-in)
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
// Microwave Radar Motion Detection with RCWL-051
// Connect RCWL-051 VIN to 5V, GND to GND, and OUT to D2.
const int sensorPin = 2;
const int ledPin = 13;
int lastState = LOW;
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
while (!Serial) {
; // Wait for serial port to connect
}
Serial.println(F("RCWL-051 Microwave Radar Sensor Ready"));
}
void loop() {
int motionDetected = digitalRead(sensorPin);
digitalWrite(ledPin, motionDetected);
if (motionDetected != lastState) {
if (motionDetected == HIGH) {
Serial.println(F("Motion detected!"));
} else {
Serial.println(F("Motion ended."));
}
lastState = motionDetected;
}
delay(100);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online
This project detects human motion through microwave Doppler radar using the RCWL-051 sensor. A resistor voltage divider steps down the sensor's 5V output to 3.3V logic to safely protect the ESP32. When motion is detected, the ESP32 turns on its onboard LED and prints a status update to the Serial Monitor.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : Microwave Motion Detection with RCWL-051 and ESP32
* Board : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
* Parts : Motion sensor with microwave radar RCWL-051
* Libraries : none (built-in)
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
// Microwave Radar Motion Detector with RCWL-051 and ESP32
const int RADAR_PIN = 4; // Connected via divider to OUT pin on RCWL-051
const int LED_PIN = 2; // Onboard LED on ESP32
int lastState = LOW;
void setup() {
Serial.begin(115200);
pinMode(RADAR_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Serial.println("RCWL-051 Radar Sensor Initialized");
Serial.println("Waiting for motion...");
}
void loop() {
int motionDetected = digitalRead(RADAR_PIN);
if (motionDetected != lastState) {
lastState = motionDetected;
if (motionDetected == HIGH) {
Serial.println("Motion detected!");
digitalWrite(LED_PIN, HIGH);
} else {
Serial.println("Motion ended.");
digitalWrite(LED_PIN, LOW);
}
}
delay(50);
}
Wiring diagram and example code generated by Codey.online — https://www.codey.online
This RCWL-0516 sensor detects every tiny movement. Unlike a PIR module, this sensor can sense through materials such as plastic. This means there is no visible sensor.
The range of this sensor module is approx. 7 meters with an angle of approx. 120 degrees.
The microwave radar motion sensor operates on a voltage of 4V to 28V. Ideal for an ESP32, Arduino or Raspberry Pi project.
The sensor outputs a high signal of 3.3V when motion is detected.
There is also a CDS connection for connecting an LDR so that the sensor only works in the dark.
This motion sensor can be used both independently and in combination with an Arduino or ESP board.
Dimensions
Length: 3.6cm
Width: 1.7cm
Height: 0.08cm
Wiring diagram
Otronic example code for Arduino IDE:
int radarPin = 2; // Pin to which the RCWL-051 output is connected
void setup() {
pinMode(radarPin, INPUT); // Set the radarPin as input
pinMode(LED_BUILTIN, OUTPUT); // Set the ledPin as output
Serial.begin(9600); // Start serial communication
}
void loop() {
int radarValue = digitalRead(radarPin); // Read the value of the radarPin
if (radarValue == HIGH) { // If motion is detected
digitalWrite(LED_BUILTIN, HIGH); // Turn on the ledPin
Serial.println("Motion detected!"); // Send a message via the serial monitor
}
else {
digitalWrite(LED_BUILTIN, LOW); // Turn off the ledPin
}
}
Explanation of how this code works
The setup() function sets the radarPin as input and the LED_BUILTIN pin as output.
Serial communication is also started with a baud rate of 9600.
In the loop() function, the value of the radarPin is read and stored in the radarValue variable.
If radarValue is equal to HIGH, which means that motion has been detected by the sensor, the built-in LED on the Arduino board is turned on and a message "Motion detected!" is sent via the serial monitor.
If no motion is detected, the LED is turned off.
The code is quite simple and can be adapted and expanded to use the sensor for various applications, such as controlling an alarm system or activating a motor.
Serial communication can be used to send messages to a computer or other devices to signal events or warnings.
The Vin pin is intended for the sensor's supply voltage. In some applications, it may be necessary to supply the sensor with a different voltage than the standard 5V provided via the VCC pin. In that case, the Vin pin can be used to power the sensor with a voltage between 4 and 28 volts.
The CDS pin is intended for connecting a CdS (cadmium sulfide) light-dependent resistor. This resistor can be used to adjust the sensitivity of the RCWL-051. If the CDS pin is not used, it can be connected to the GND pin.
Using the Vin and CDS pins is optional and depends on the specific application for which the RCWL-051 is used. In most applications, the VCC, GND and OUT pins are sufficient for the sensor to function correctly.
| Dimensions | 3,6 x 1,7 x 0,08 cm |
|---|---|
| Suitable for | Arduino, ESP32 or Raspberry Pi |
| Output voltage | 3.3 V |
| Detection angle | approx. 120 degrees |
I still need to test it. Nicely packaged and shipped by Otronic!
Does what it needs to do and is easy to adjust for the desired application
Very good product, like all microwave sensors it detects through walls and partitions, don't hesitate to reduce the range with the R-GN resistor, a 470 KΩ one is suitable for most uses
So far it seems to work, except that it only works for items less than 5 cm away. I have tried 4 so far, all give the same results. The specs indicate 7 meters by default. Not acceptable as such! I would like to have a refund on this.
Good product, meets the description.
Motion sensor with microwave radar RCWL-051