XIAO ESP32-C6 + DFRobot C4001 mmWave presence sensor

Firmware for a Seeed XIAO ESP32-C6 driving a C4001 24GHz radar, with a
web UI for live data and calibration.

- Auto-detects whether the C4001 is on I2C (0x2A/0x2B) or UART, so the
  board's mode switch position doesn't matter. Serves the probe log over
  HTTP when nothing is found.
- Single-page UI inlined into flash (no CDN, so it works in AP mode):
  presence state, target count, range, speed, energy, rolling 60s chart,
  and mode-aware calibration controls.
- Joins WiFi from a gitignored include/secrets.h, falls back to a
  "xiao-mmwave" AP, registers mmwave.local.
- Poll rate adapts to the interface: UART at 9600 costs ~60ms per register
  round-trip, so polling it at the I2C rate starved the HTTP server.

Two hardware gotchas documented in the README:

- The sensor UART must not use D6/D7. Those are GPIO16/17, the C6's
  hard-wired U0TXD/U0RXD. Pointing Serial1 at them deadlocks the UART
  driver and trips the interrupt watchdog, boot-looping the board. UART1
  has no fixed pins, so it routes through the GPIO matrix to D10/D9.
- DFRobot's own wiring table pairs the sensor's RX with the MCU's RX, and
  their library swaps the rxpin/txpin parameter names between the header
  and the .cpp.

Verified on ESP32-C6FH4 rev v0.1, 4MB flash: builds at 57.6% flash /
11.9% RAM, flashes over the native USB Serial/JTAG port, and reads a live
C4001 on I2C @ 0x2A.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
mattandClaude committed 2026-08-14 10:05:27 -07:00
commit b9162db707
6 files changed
+993

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
// Copy to include/secrets.h and fill in your own network.
//
// cp include/secrets.h.example include/secrets.h
// $EDITOR include/secrets.h
//
// include/secrets.h is gitignored. Don't paste the password into a chat
// window or a terminal transcript -- edit the file directly.
//
// If you skip this entirely the firmware still works: it goes straight to
// Access Point mode and hosts its own "xiao-mmwave" hotspot.
#pragma once
#define WIFI_SSID "your-network-name"
#define WIFI_PASS "your-network-password"