Reference
The article serves as a detailed reference for users looking to install and configure the DFRobot Microwave Radar Module, covering API functions, installation methods, and essential precautions to optimize sensor performance.
Library
Download and install the DFRobot_Microwave_Radar_Module. (About how to install the library?)
API Description
/**
@brief Init function
@return true Success
@return false Error
*/
bool begin();
/**
@brief Read whether the sensor detects the target
@return true yes
@return false no
*/
bool readPresenceDetection();
/**
@brief Configure detection distance
@param distance detection distance, 0~11m, default to be 6m
*/
void detRangeCfg(int distance);
/**
@brief Configure detection sensitivity
@param sensitivity detection sensitivity, 0~9, the larger the value, the higher the sensitivity, default to be 7
*/
void setSensitivity(int sensitivity);
/**
@brief Configure output delay time
@param par1 delay acknowledgement; the target is detected, after lasting for par1 time, output valid signal of the target. Value range: 0~100, unit second, the default is 1 second
For scenarios that don't require high detection response speed, it is recommended to be not less than 1 second, which can largely reduce false positive rate
@param par2 delay disappearance; no target is detected, after lasting for par2 time, output invalid target signal, value range: 1~1500, unit second, the default is 15 seconds
*/
void outputLatency(int par1, int par2);
/**
@brief Configure output control signal interface polarity
@param voltage true Output high level when there is a target, and output low when no target (default status), false output low level when there is a target, and output high when no target
*/
void setGpioMode(bool voltage);
/**
@brief Restore factory settings
*/
void factoryReset ( void );
Installation Method & Detection Range
The sensor is strict on the installation method, improper installation will affect the performance and function of the sensor. Commonly-used installation methods for modules include top installation, bottom installation, horizontal installation and downward tilt installation
Top installation
Area A: detect stationary states like standing still, sleeping, sitting still, etc.
Area B: detect small movements (turning head sideways, waving hands, raising hands, slight body movement, turning pages of a book, slight tilting to the left, to the right, forward or backward, etc.)


Wall Installation
Area A: detect stationary states like standing still, sleeping, sitting still, etc.
Area B: detect small movements (turning head sideways, waving hands, raising hands, slight body movement, turning pages of a book, slight tilting to the left, to the right, forward or backward, etc.)
Area C: detect sports movements (walking, trotting, running, running in circles, high jump, etc.)

The test proved that the radius is related to many factors such as mounting environment, human body type, relative angle, the amplitude of the specific movements, etc. The parameters above are the test results using pure modules, and the descriptions like small movements and sports movements are all qualitative descriptions instead of quantitative ones, so they are for reference only, and subject to practice if any difference.
Precautions
- Avoid directly pointing the sensor at the air conditioner, curtain, fan, plant, etc., because the swing of these objects may cause false trigger.
- Pay attention to the multiple reflections similar to specular reflection when the module beam irradiates the ground, wall or door, so as to indirectly detect the above-mentioned interferences.
- Suitable configuration of parameters like maximum detection distance, sensitivity and delay time can exclude some object interference.
- When multiple modules are installed together, keep a distance of over 1.5m between any two and try to ensure that they are parallel to each other to avoid direct illumination between the modules.
Was this article helpful?
