Example Code for FireBeetle ESP8266-Human Presence Detection
Detect if there is object or human motion in measuring range; Allows for configuring sensing area, sensor output delay, and resetting sensor to factory settings. Experimental phenomenon: When the sensor is enabled, print 0 or 1 on the serial port: 0 for no motion detected in the sensing area, 1 for object/human movement detected.
Hardware Preparation
- FireBeetle ESP8266 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-ESP8266 |
|---|---|
| VCC | 3V3 |
| GND | GND |
| RX | D5 |
| TX | D2 |
Sample Code
/*!
@file DFRobot_mmWave_Radar.ino
@ Detect if there is object or human motion in measuring range; Allows for configuring sensing area, sensor output delay, and resetting sensor to factory settings.
@n Experimental phenomenon: When the sensor is enabled, print 0 or 1 on the serial port: 0 for no motion detected in the sensing area, 1 for object/human movement detected.
@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 <SoftwareSerial.h>
#include <DFRobot_mmWave_Radar.h>
int LED_BLINK = 2;
SoftwareSerial mySerial(D2, D5);
DFRobot_mmWave_Radar sensor(&mySerial);
void setup() {
Serial.begin(115200);
mySerial.begin(115200);
pinMode(LED_BLINK, OUTPUT);
sensor.factoryReset(); //Reset to factory settings
sensor.DetRangeCfg(0, 9); //Set sensing distance, up to 9m
sensor.OutputLatency(0, 0); //Set output delay
}
void loop() {
int val = sensor.readPresenceDetection();
digitalWrite(LED_BLINK, val);
Serial.println(val);
delay(1000);
}
Result
Print "1" if human presence is detected, otherwise, print "0".

Was this article helpful?
