C4001 (sen0610) - can't get to function for presence detection
Aaron.Borgman 2026-11-14 03:24:27 24 Views0 Replies Attempting to use a C4001 (SEN0610) for human presence detection.
Can't seem to get any sort of reliable output no matter what settings I'm using.
Serial output is never finding a person present.
Output LED is lighting up all over the place.
So somehow it appears that the module is detecting presence and lighting the output light, but radar.motionDetection() is always returning 0.
Ideas?
Code:
#include "DFRobot_C4001.h"
DFRobot_C4001_I2C radar(&Wire, 0x2A);
#define MIN_RANGE 30
#define MAX_RANGE 300
#define TRIG_SENS 7
#define KEEP_SENS 8
#define TRIG_DELAY 100
#define KEEP_DELAY 4
const bool USE_FRETTING = true; // micro-motion detection
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while (!Serial)
;
while (!radar.begin()) {
Serial.println("No DFRobot C4001 device found!");
delay(1000);
}
Serial.println("C4001 Sensor connected!");
// Set sensor mode (eExitMode is commonly used for presence/motion tracking)
radar.setSensorMode(eExitMode);
// Configure detection range (min distance cm, max distance cm, trigger distance cm)
// Example: 30 cm to 1000 cm (10 meters)
radar.setDetectionRange(MIN_RANGE, MAX_RANGE, MAX_RANGE);
// Set trigger sensitivity (range: 0 to 9) and keep sensitivity
radar.setTrigSensitivity(TRIG_SENS);
radar.setKeepSensitivity(KEEP_SENS);
// Set delay and keep time parameters (trigger delay, keep time)
radar.setDelay(TRIG_DELAY, KEEP_DELAY);
//set fretting
radar.setFrettingDetection(USE_FRETTING ? eON : eOFF);
Serial.println("Presence detection initialized.");
}
void loop() {
int DELAY_TIME = ((KEEP_DELAY*1000)/2);
int total=0;
Serial.print("Pre-check total:");
Serial.println(total);
// put your main code here, to run repeatedly:
// Check if motion/presence is detected
for (int i = 0; i < 5; i++) {
if (radar.motionDetection()) {
total=total+1;
}
}
if (total>3){
Serial.print("Person Present - total:");
Serial.println(total);
}
else {
Serial.print("EMPTY - total:");
Serial.println(total);
}
// Fetch general status if needed
sSensorStatus_t status = radar.getStatus();
// status.workStatus: 0 = stop, 1 = start
// status.workMode: 0 = exist mode, 1 = speed mode
// status.initStatus: 0 = no init, 1 = init success
delay(DELAY_TIME);
}

