Example Code for FireBeetle ESP32-C3-Human Presence Detection
This article guides you through setting up the FireBeetle ESP32-C3 with mmWave Radar for human presence detection, including hardware and software preparation, wiring instructions, and sample code for effective detection.
Hardware Preparation
- Beetle ESP32 - C3 (RISC-V Core Development Board) (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);
int LED_BLINK = 10;
void setup() {
Serial.begin(115200);
mySerial.begin(115200, SERIAL_8N1, 5, 7); //RX,TX
pinMode(LED_BLINK, 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_BLINK, val);
Serial.println(val);
}
Result
Print "1" if human presence is detected, otherwise, print "0".

Was this article helpful?
