Building a Native Home Assistant MmWave Presence Sensor With ESPHome on ESP32-C6
by Jaychouu in Circuits > Sensors
31 Views, 0 Favorites, 0 Comments
Building a Native Home Assistant MmWave Presence Sensor With ESPHome on ESP32-C6
When I first tried to automate lighting in Home Assistant, I assumed a simple PIR motion sensor would be enough. In practice, it failed to detect stationary people — lights turned off the moment I stopped moving.
I switched to mmWave presence sensors, but that introduced new issues: false triggers from environmental movement, slow response due to heavy signal smoothing, and the need to tweak parameters on a PC.
That changed with the C4002 mmWave Motion and Static Presence Detection Module. Designed for Home Assistant, it clearly separates motion, stationary presence, and absence, actively reduces environmental interference, and offers a wide 120° detection angle that works far better than PIR sensors.
Most importantly, the C4002 integrates natively with ESPHome. Detection distance and sensitivity can be adjusted directly in the Home Assistant UI — no coding, no flashing tools, and no custom firmware required.
In this article, I’ll show how to build a reliable Home Assistant mmWave presence sensor using ESPHome, ESP32-C6, and the C4002 module.
Supplies
- C4002 Millimeter-Wave Motion and Static Presence Detection Module
- FireBeetle 2 ESP32-C6 IoT Development Board (Other ESP32 development boards with 5V power supply are also compatible,such as ESP32-S2-DevKitM-1)
- USB 3.0 to Type-C Cable
- 3×AA Battery Holder ( DC2.1 Jack;Example power source; any stable ~5V supply is acceptable.)
- Jumper Wires 9" F/F
- DC Barrel Jack Adapter - Female
- Home Assistant Host (Home Assistant OS / Supervised / Container)
Why I Chose the C4002 for Home Assistant
Compared to many low-cost mmWave modules, the C4002 mmWave motion and static presence detection module offers clearer separation between motion, static presence, and absence, helping reduce false triggers caused by airflow or moving objects. Its 120° detection angle also provides better room coverage than traditional PIR sensors.
Most importantly, the C4002 supports native ESPHome integration. Detection range and sensitivity can be configured directly in the Home Assistant UI, with no custom code, no firmware flashing tools, and no PC-based tuning. This makes it a practical and maintainable choice for building a reliable Home Assistant presence sensor.
Wiring Diagram and Power Requirements
Before connecting the ESP32 and the C4002 module, it is important to understand the power requirements.
According to the C4002 documentation, the operating voltage range of the module is 3.6V to 5.5V.
- If the ESP32 development board provides a regulated 5V output pin (for example, ESP32-S2-DevKitM-1), the C4002 module can be powered directly from the board.
- The FireBeetle 2 ESP32-C6 does not provide a dedicated 5V output pin suitable for powering external modules. Therefore, an external 5V power source is required.
ESP32-C6 and C4002 Power Supply Notes:
In this setup, the ESP32-C6 and the C4002 module must share the same external power source and a common ground. The external supply should provide a voltage around 5V, staying within the safe operating range of both devices.
When using battery power or other unregulated sources, ensure that the input voltage does not exceed the maximum rated voltage of either device, and be aware that low input voltage may cause unstable operation of the ESP32.
Power Distribution and Wiring
In this tutorial, power is supplied using a 3×AA battery holder with a DC 2.1mm plug and a DC barrel jack adapter (female, screw terminal type).
This allows the battery power to be easily split and connected to both the ESP32-C6 and the C4002 mmWave module.
First, prepare two jumper wires to split the positive power line.Then, prepare another two jumper wires to split the negative (ground) power line.
Take two jumper wires.Strip a small section of insulation from one end of each wire.Twist the exposed copper wires together and solder them into a single joint, keeping both female headers intact.This creates one power line with two female outputs.
Repeat the same steps with another two jumper wires to create the ground line.
After preparing the two positive wires and the two ground wires, twist the ends of the positive wires together and insert them into the + terminal of the DC barrel jack. Tighten the screw securely to make sure the wires are firmly fixed and will not come loose.
Then, twist the ends of the ground wires together and insert them into the – terminal of the DC barrel jack, tightening the screw to secure the connection. Make sure that the positive and ground wires are separated and that no bare copper is exposed that could cause a short circuit.
Once both positive and ground wires are properly secured in the DC barrel jack, take the assembled DC barrel jack and plug it into the DC input of the battery holder.
Make sure the plug is fully inserted so that the connection is stable and will reliably supply power from the 3×AA batteries to your circuit. At this stage, your battery power is ready to be distributed to the ESP32-C6 and the C4002 module through the DC barrel jack.
Now, use the two female jumper outputs on the positive wire to connect the VIN input of the ESP32-C6 and the VIN input of the C4002 module. Similarly, use the two female jumper outputs on the ground wire to connect the GND pin of the ESP32-C6 and the GND input of the C4002 module.
Take two female-to-female jumper wires. Connect the RX pin of the C4002 module to the TX pin (GPIO5) of the ESP32-C6. Then connect the TX pin of the C4002 module to the RX pin (GPIO4) of the ESP32-C6.
Installing Home Assistant on the Host Device
The first step to getting started with Home Assistant is to install it on a device. Home Assistant provides multiple deployment methods for different application scenarios and skill levels of makers. You can follow the official documentation to complete the installation according to your hardware configuration:Home Assistant Installation.
Installing the ESPHome Add-on in Home Assistant
Once installed, create an account and follow through the initial set up instuctions.
Once configured, you will see the main dashboard of Home Assistant as shown below.
Next, we will install the ESPHome add-on in Home Assistant.
Go to the Home Assistant main page and click Settings in the left sidebar; find and click Add-ons.
After entering the Add-ons page, click Add-on store in the bottom right corner;
Enter ESPHome in the store's search bar and search; Select 'Esphome Device Builder ', then click Install;
After the add-on is installed successfully, go to its configuration page, enable all functional options, and then click Start;
Wait for the add-on to start completely. If the ESPHome Builder option appears in the left sidebar, and you can enter the corresponding management page by clicking it, it means the ESPHome add-on has been installed and started successfully.
Adding the ESP32-C6 Device to ESPHome
STEP 1: On the ESPHome management page, click + NEW DEVICE.
STEP 2: On the device creation guide page, click CONTINUE directly.
STEP 3: Enter a custom device name (e.g., presence sensor), then click NEXT.
STEP 4: On the hardware model selection page, select the corresponding type ESP32-C6 for the FireBeetle 2 ESP32-C6 in use.
The page displays Configuration created, click 'SKIP' — because we will manually write the complete hardware and sensor configuration.
After the device is created successfully, go to the ESPHome device management list page, find the newly created presence-sensor device.
Click the 'SECRETS' button in the top right corner, and enter the Wi-Fi name and password.
Complete ESPHome YAML Configuration for C4002
STEP 1:Click 'EDIT' — this will open the YAML configuration file of the device, where all subsequent hardware and sensor configurations will be completed;
The full page after opening is shown above.
STEP2: Paste the configuration code for FireBeetle 2 ESP32-C6 and C4002 sensor to the end of the YAML file.
The complete YAML content is as follows.
STEP 3: Click SAVE in the upper right corner of the page to save the configuration.
STEP 4: Click INSTALL to trigger firmware compilation;
A pop-up window for installation method selection appears, select 'Plug into this computer', then click 'Download project' to start firmware compilation.
Compilation Completion Mark: The Download project button changes from gray to clickable (firmware compilation takes about 10-20 minutes, please wait and do not close the page);
After the firmware is compiled, click 'Download project', select the 'Factory format' mode in the flashing options, and download the firmware file (the file name is presence-sensor.factory.bin);
STEP 5: After the firmware is downloaded, click 'Open ESPHome Web'.
Ensure the FireBeetle 2 ESP32-C6 is connected to the computer via a USB cable.
Then click ' CONNECT 'on the flashing tool page.
In the pop-up serial port selection box, select the serial port corresponding to the FireBeetle 2 ESP32-C6, and click Connect to complete the device connection.
STEP 6: After the ESP32-C6 is successfully connected to the flashing tool, click INSTALL on the page.
Click 'Choose File', select the newly downloaded presence-sensor.factory.bin firmware file, and click INSTALL to start flashing.
Wait for the firmware flashing to complete,the page displays a flashing success.
STEP 7: Unplug the USB cable to disconnect the ESP32-C6 from the computer. Connect the battery pack, ESP32-C6, and C4002 motion and presence module according to the following wiring diagram.
Return to the Home Assistant page and you will see the presence sensor device go online.
If it shows offline, the board is most likely failing to connect to the WiFi. Please check if the WiFi SSID and password in the secrets.yaml file are correct.
STEP 8: After the presence sensor device is online, click Settings – a notification for new device discovery will pop up on the page, then click Add.
Locate the corresponding API key in the presence-sensor.yaml file.
Fill it in the designated input box of the pop-up.
Once completed, click 'Settings' and navigate to the 'Device & Services' page.
Click ESPHome and check that presence sensor appears on the page.
Click 'presence sensor' and you will see the following device information:
Sensor Data Items
- Motion Distance: Real-time distance between the target and the sensor when a moving object is detected
- Presence Distance: Real-time distance between the target and the sensor when a static human body is detected
- Motion Speed: Moving speed of the detected target
- Motion Direction (numeric): 0=Approaching, 1=No direction, 2=Moving away
- Target Status (numeric): 0=No target, 1=Static presence, 2=Motion detected
In addition to the sensor data, the following configurable options are available:
- Sensor OUT Indicator Light Switch: Controls the on/off state of the sensor's physical OUT LED
- Sensor RUN Indicator Light Switch: Controls the on/off state of the sensor's physical RUN LED
- Restore Factory Settings: Momentary trigger switch that auto-resets after activation and restores the sensor to factory default parameters
- Environmental Calibration: Momentary trigger switch that auto-resets after activation and calibrates the sensor to the current environment for improved detection accuracy
- Detection Distance Setting: Customize the sensor's effective detection range
- Light Sensing Threshold Setting: Configure the trigger threshold for the sensor's light-sensing detection
- Detection Exclusion Zone Setting: Customize up to 3 detection exclusion zones to avoid false detections caused by objects such as furniture
Visualizing MmWave Presence Data in the Home Assistant Dashboard
On the Overview page of Home Assistant, click the three-dot icon in the top right corner and select Edit Dashboard.
Then click '+ ADD CARD'.
If you want to display the C4002 sensor data via a card, select the the 'Entity card', then choose the relevant C4002 entities (e.g., Presence Distance).
You can customize the card name and icon, then click 'Save'. A dedicated data card will be created, allowing you to view the real-time human presence distance data detected by the C4002 Motion and Presence Detection Module.
Click 'Save'. You will see an entity card appear on the dashboard, displaying real-time human presence distance data detected by the C4002 Motion and Presence Detection Module.
In addition, you can select different card types to create various data visualization effects.
In addition, you can select different card types to create various data visualization effects. This is my practical project of a human presence sensor, which can detect human presence and motion status in the living room. Now it's your turn to make your own!