PIR vs microwave vs radar comparison
Build it step by step
0 of 7 doneWire the three sensors
Check each alone first.
Run the OLED display
Check the live states.
Mount them side by side
Same direction.
Walk across the room
Note the counts.
Sit still for two minutes
Which one holds on.
Test through glass and with a fan
Which one false-triggers.
Write a results table
Pick the best for each job.
How do you build a PIR vs microwave vs radar comparison?
Test three motion sensors side by side with the same moves to see which is best for each job. You need ESP32 DevKit V1, PIR Motion Sensor HC-SR501, RCWL-0516 microwave radar motion sensor, LD2410 24 GHz human presence radar and SSD1306 OLED Display. It takes 7 steps and about 150 minutes.
- Level
- Intermediate
- Time
- About 150 min
- Parts
- 5
Parts list
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| PIR OUT | ESP32 GPIO32 | PIR signal (the PIR needs 5 V) |
| RCWL-0516 OUT | ESP32 GPIO33 | Microwave signal (3.3 V output) |
| LD2410 OUT | ESP32 GPIO25 | Radar presence signal (3.3 V output) |
| PIR, RCWL-0516 and LD2410 VCC and GND | ESP32 VIN (5 V) and GND | Power |
| OLED SDA and SCL | ESP32 GPIO21 and GPIO22 | I2C display |
| OLED VCC and GND | ESP32 3V3 and GND | Power |
Code
A PIR sees changes in heat as a warm body moves across its field, an RCWL-0516 sends out a microwave signal and notices any movement that changes the echo, and the LD2410 is a 24 GHz radar that can tell a still person from an empty room. Each behaves differently in practice: PIRs miss people sitting still and can be fooled by sun and heaters; the RCWL-0516 sees through thin walls and glass and may trigger on fans or nearby wires; the LD2410 is the most reliable for presence but needs 5 V and costs more. Mount all three side by side pointing the same way and run the same tests for each: walk across, walk towards, sit still for two minutes, wave a hand, stand behind a glass pane, and switch on a fan. Count how many triggers each gives and write the results in a table. The counts on the screen only grow, so power cycle between tests. The three sensors work at the same time, and the RCWL-0516 can interfere with the LD2410, so try a gap of several centimetres. Pick the sensor by the job: PIR for cheap battery use, radar when someone must be detected sitting still.
Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Motion sensor comparison: counts each sensor's triggers and shows the live state, so you can run the same tests on all three.
// Libraries: Adafruit SSD1306, Adafruit GFX. Board: ESP32. Also prints CSV lines to the serial monitor for a spreadsheet.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const uint8_t PINS[3] = { 32, 33, 25 };
const char* NAMES[3] = { "PIR ", "RCWL ", "LD2410" };
int counts[3] = { 0, 0, 0 };
bool last[3] = { false, false, false };
void setup() {
Serial.begin(115200);
for (int i = 0; i < 3; i++) pinMode(PINS[i], INPUT);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.setTextColor(SSD1306_WHITE);
Serial.println("ms,sensor,state");
}
void loop() {
for (int i = 0; i < 3; i++) {
bool now = digitalRead(PINS[i]) == HIGH;
if (now != last[i]) {
if (now) counts[i]++;
Serial.print(millis()); Serial.print(','); Serial.print(NAMES[i]); Serial.print(','); Serial.println(now);
last[i] = now;
}
}
oled.clearDisplay(); oled.setTextSize(1);
for (int i = 0; i < 3; i++) {
oled.setCursor(0, i * 16);
oled.print(NAMES[i]); oled.print(last[i] ? " ON " : " off "); oled.print(counts[i]);
}
oled.display();
delay(20);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual ESP32 Dev Module with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
ms,sensor,state
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Walk past | All three trigger |
| Sit still for 2 minutes | LD2410 stays on, PIR drops off |
| Thin glass pane in between | RCWL and radar still trigger, PIR does not |
| Fan switched on | RCWL may trigger often |
If it does not work
A sensor never triggers
Check its power (5 V) and the signal pin.
Everything triggers all the time
Move the sensors apart and away from the fan or router.
OLED blank
Check the I2C address.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the PIR vs microwave vs radar comparison?
ESP32 DevKit V1, PIR Motion Sensor HC-SR501, RCWL-0516 microwave radar motion sensor, LD2410 24 GHz human presence radar and SSD1306 OLED Display.
How long does the PIR vs microwave vs radar comparison take to build?
About 150 minutes for a intermediate maker, in 7 steps.
How do I know the PIR vs microwave vs radar comparison works?
Walk past: All three trigger. Sit still for 2 minutes: LD2410 stays on, PIR drops off. Thin glass pane in between: RCWL and radar still trigger, PIR does not.
A sensor never triggers: what should I check?
Check its power (5 V) and the signal pin.
Everything triggers all the time: what should I check?
Move the sensors apart and away from the fan or router.
OLED blank: what should I check?
Check the I2C address.
