Op werkdagen vóór 14:00 uur besteld = dezelfde dag verzonden en in 98% van de gevallen de volgende dag in huis. Gratis retourneren 30 dagen bedenktijd 1 jaar garantie
← Tillbaka till översikten

Vid uppspelning laddas videon från YouTube.

Kopplingsschema och kodexempel

Så här kopplar du Rörelsesensor med mikrovågsradar RCWL-051 till en Arduino UNO eller ESP32, med ett exempel­sketch som du kan ladda upp direkt.

Microwave Radar Motion Detection with RCWL-051

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.

Kopplingsschema: Rörelsesensor med mikrovågsradar RCWL-051 på en Arduino UNO
Kopplingsschema · Klicka för att förstora
Kopplingstabell: Rörelsesensor med mikrovågsradar RCWL-051 på en Arduino UNO
Kopplingstabell · Klicka för att förstora
Microwave_Radar_Motion_Detection_with_RC.ino · kompilerad och testad
/*
 * ==================================================================
 *  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

Microwave Motion Detection with RCWL-051 and ESP32

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.

Kopplingsschema: Rörelsesensor med mikrovågsradar RCWL-051 på en ESP32 DevKit V1
Kopplingsschema · Klicka för att förstora
Kopplingstabell: Rörelsesensor med mikrovågsradar RCWL-051 på en ESP32 DevKit V1
Kopplingstabell · Klicka för att förstora
Microwave_Motion_Detection_with_RCWL_051.ino · kompilerad och testad
/*
 * ==================================================================
 *  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