กลับหน้าหลัก
views
Connect RCWL-0516 with ESP32 Read Microwave Radar Motion Sensor
Last updated on

Connect RCWL-0516 with ESP32 Read Microwave Radar Motion Sensor


Connect RCWL-0516 with ESP32 Read Microwave Radar Motion Sensor

This tutorial shows how to use RCWL-0516 microwave radar sensor with ESP32. Unlike PIR sensors that use infrared, RCWL-0516 detects motion by reading changes in reflected microwave signals. This makes it suitable for applications requiring longer detection range.

Circuit diagram showing ESP32 connected to RCWL-0516 and LED on breadboard

Required Components

  • ESP32 NodeMCU ESP-WROOM-32
  • RCWL-0516 Microwave Radar Sensor
  • 5mm Red LED x1
  • 220 Ohm Resistor
  • Breadboard 170 points
  • Jumper wires (M-M, M-F, F-F)
  • Micro USB cable for upload
  • Power Adapter 5V 2A

How RCWL-0516 Works

RCWL-0516 emits microwave signals. When an object moves within range, the reflected wave frequency changes due to Doppler Effect. The sensor detects this change and outputs a signal at the OUT pin.

Key advantages: detection range of 5-9 meters and can detect through thin materials without direct line of sight.

Wiring ESP32 with RCWL-0516

Pin mapping table showing ESP32 connections to RCWL-0516 and LED
ESP32DevicePin
D22LED (via R220)Anode
D23RCWL-0516OUT
VINRCWL-0516VIN
GNDRCWL-0516GND
GNDLEDCathode

Arduino Code for Reading RCWL-0516

// Pin definitions
const int sensorPin = 23;  // RCWL-0516 OUT connected to D23
const int ledPin = 22;     // LED connected to D22

void setup() {
  Serial.begin(115200);
  pinMode(sensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Serial.println("RCWL-0516 Motion Detection Ready");
}

void loop() {
  int motionValue = digitalRead(sensorPin);
  
  Serial.print("Sensor Value: ");
  Serial.println(motionValue);
  
  digitalWrite(ledPin, motionValue);
  
  delay(100);
}

Upload Steps

  1. Open Arduino IDE and paste the code above
  2. Go to Tools -> Port and select ESP32 port
  3. Go to Tools -> Board and select ESP32 board type
  4. Click Upload button
  5. If “Connecting…” appears during upload, hold BOOT button on the board
  6. Wait for “Hard resetting via RTS pin…” to confirm success
Serial Monitor window showing value 0 when no motion and value 1 when motion detected

Expected Results

Open Serial Monitor at Baud Rate 115200 and observe the values:

  • No motion → Sensor outputs 0, LED off
  • Motion detected → Sensor outputs 1, LED on
  • Motion stops → Sensor continues briefly before returning to 0

Customization Points

To make LED blink when motion is detected, add blinking logic in the loop section when motionValue equals 1 using short delay intervals.

Reference Video

อยากทำโปรเจคแบบนี้?

รับทำโปรเจค Arduino / IoT จบงานไว ส่งงานครบ พร้อมสอน

If you need Arduino project service or urgent IoT development, see full service details on the home page

จ้างทำโปรเจคเลย

ประเมินราคาอัตโนมัติ + Reference Code

ขอให้ AI ประเมินราคาโปรเจคนี้

กรอกข้อมูลให้ครบ ระบบจะสร้างรหัสอ้างอิงและประเมินราคา/ระยะเวลาคร่าว ๆ จากรายละเอียดงาน แล้วให้กด Add LINE พร้อมพิมพ์รหัสนี้เพื่อคุยต่อ

คำถามให้ AI ประเมินแม่นขึ้น

หลังส่งฟอร์ม ระบบจะโชว์ Reference Code ให้ copy แล้วกด Add LINE เพื่อคุยต่อ ข้อมูลส่วนตัวจะไม่ถูกส่งเข้า GA4

ความคิดเห็น

รีวิวจากคนใช้งานจริง

รีวิวจากลูกค้าและคนที่เคยใช้งาน

ถ้าเคยสั่งงาน เคยอ่านหน้านี้แล้วได้ประโยชน์ หรือมีข้อเสนอแนะ ฝากรีวิวไว้ได้เลย

กำลังโหลดรีวิว...