Files
mmWaveESP/platformio.ini
T
mattandClaude b9162db707 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>
2026-08-14 10:05:27 -07:00

29 lines
1005 B
INI

; XIAO ESP32-C6 + DFRobot C4001 24GHz mmWave presence sensor
;
; Board detected on this machine:
; ESP32-C6FH4 (QFN32) rev v0.1, 4MB embedded flash, USB-Serial/JTAG
; MAC e4:b3:23:b4:7b:c4 on /dev/ttyACM0
;
; NOTE: ESP32-C6 needs Arduino-ESP32 core 3.x. The installed platform
; (espressif32 @ 2026.02.30, the pioarduino fork) ships core 3.3.7 and has
; the XIAO_ESP32C6 variant, so this builds as-is. The old espressif32 6.x
; from PlatformIO's registry does NOT support C6 -- don't downgrade.
[env:seeed_xiao_esp32c6]
platform = espressif32
board = seeed_xiao_esp32c6
framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder, time
upload_port = /dev/ttyACM0
monitor_port = /dev/ttyACM0
; Pulled straight from DFRobot's repo. The registry copy lags behind.
lib_deps =
https://github.com/DFRobot/DFRobot_C4001.git
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1 ; Serial -> USB CDC, so the monitor works over the native port
-DCORE_DEBUG_LEVEL=1