Example Code for FireBeetle ESP32-Human Presence Detection
The article offers a comprehensive guide on implementing human presence detection using FireBeetle ESP32 and mmWave Radar, detailing hardware and software preparation, wiring diagrams, and sample code for effective motion detection.
Hardware Preparation
- FireBeetle ESP32 IoT Microcontroller (or similar) x 1
- mmWave Radar x1
Software Preparation
- Arduino IDE
- Download and install the DFRobot_mmWave Radar Library. (About how to install the library?)
Wiring Diagram

| mmWAVE Radar Sensor | FireBeetle Board-ESP32 |
|---|---|
| VCC | 3V3 |
| GND | GND |
| RX | D3 |
| TX | D2 |
Sample Code
/*!
@file DFRobot_mmWave_Radar.ino
@ Read whether there is people or object moving in the detection range of the sensor.
@ The sensor detection range and output delay time can be configured. Also you can restore the sensor to factory default settings.
@n Experimental phenomenon: When the sensor starts successfully, 0 or 1 will be printed on the serial monitor.
@ 0 means that there is no human or object moving in sensing area, 1 means the oppposite.
@copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
@licence The MIT License (MIT)
@version V1.0
@date 2023-3-13
@https://github.com/DFRobot
*/
#include <DFRobot_mmWave_Radar.h>
HardwareSerial mySerial(1);
DFRobot_mmWave_Radar sensor(&mySerial);
void setup() {
Serial.begin(115200);
mySerial.begin(115200, SERIAL_8N1, D2, D3); //RX,TX
pinMode(LED_BUILTIN, OUTPUT);
sensor.factoryReset(); //Restore to the factory settings
sensor.DetRangeCfg(0, 9); //The detection range is as far as 9m
sensor.OutputLatency(0, 0);
}
void loop() {
int val = sensor.readPresenceDetection();
digitalWrite(LED_BUILTIN, val);
Serial.println(val);
}
Result
When the sensor detects someone printing a "1", it prints a "0"; when the sensor detects no one printing, it prints a "0".

Was this article helpful?
