github francescopace/espectre 1.3.0
v1.3.0 - ESP32-C6 Platform Support

latest releases: 2.3.0, 2.2.0, 2.1.0...
one month ago

Complete multi-platform support with ESP32-C6 and WiFi 6

Added comprehensive support for ESP32-C6 alongside ESP32-S3, enabling WiFi 6 (802.11ax):

ESP32-C6 Implementation:

  • CSI Configuration: Implemented wifi_csi_acquire_config_t structure

    • .acquire_csi_legacy = 1 - Captures CSI from 802.11a/g packets (L-LTF)
    • .acquire_csi_ht20 = 1 - Captures CSI from 802.11n HT20 packets (64 subcarriers)
    • .acquire_csi_ht40 = 0 - Captures CSI from 802.11n HT40 packets (128 subcarriers) - to be tested
    • .acquire_csi_su = 1 - Captures CSI from WiFi 6 Single-User packets
    • Critical: Both acquire_csi_legacy and acquire_csi_ht20 required for callback invocation
  • WiFi 6 Support: Enabled 802.11ax protocol for ESP32-C6

    • Automatic negotiation with WiFi 6 routers
    • Backward compatible with WiFi 4/5 routers
    • Improved packet scheduling and efficiency

Configuration Files:

  • sdkconfig.defaults.esp32c6: ESP32-C6 specific configuration
    • DIO flash mode (more stable than QIO)
    • USB stability improvements (PM disabled)
    • Simplified CSI API configuration

Critical Fix - CSI Callback Issue:

  • Root cause: Incomplete CSI configuration (only .enable = 1 was insufficient)
  • Solution: Added all required acquire_csi_* fields
  • Result: CSI callback now working, 50-100+ packets/second

Testing Infrastructure:

  • Added real_csi_data_esp32_c6.h: 2015 lines of real CSI test data
  • Renamed real_csi_data.hreal_csi_data_eps32_s3.h for clarity
  • Added segmentation_analysis_c6.png: Visual analysis of C6 performance
  • Rewrote test_segmentation_local.py: Complete rewrite for better parameter analysis
    • Grid search optimization
    • Visual segmentation analysis
    • Platform-specific parameter validation

Documentation:

  • Removed ESP32-S3 specific references from user-facing documentation
  • Updated platform badges and hardware requirements
  • Added platform comparison tables
  • Clarified platform-specific features and limitations
  • Updated ESP32-PLATFORM-SUPPORT.md with platform-specific defaults

Reference: ESP-IDF Issue #14271 - espressif/esp-idf#14271

🔧 Runtime-Configurable Parameters

Major system configurability improvements

Transformed hardcoded parameters into runtime-configurable settings, enabling fine-tuning without recompilation:

Segmentation Parameters (MQTT-configurable):

  • Threshold: Direct value setting (0.5-10.0)
  • K factor: Threshold sensitivity multiplier (0.5-5.0)
    • Higher values = less sensitive (fewer false positives)
    • Lower values = more sensitive (better detection of subtle movements)
  • Window size: Moving variance window (3-50 packets)
    • Smaller = more reactive, larger = more stable
  • Min segment length: Minimum motion duration (5-100 packets)
  • Max segment length: Maximum motion duration (10-200 packets)
  • Platform-specific defaults: Optimized separately for ESP32-S3 and ESP32-C6

Subcarrier Selection (runtime-configurable):

  • Dynamic subcarrier selection for feature extraction
  • New API: csi_set_subcarrier_selection()
  • Configurable via MQTT with array of indices (0-63)
  • Allows optimization for different environments and interference patterns

New MQTT Commands:

  • segmentation_threshold <value> - Set detection threshold
  • segmentation_k_factor <value> - Set threshold sensitivity
  • segmentation_window_size <value> - Set moving variance window
  • segmentation_min_length <value> - Set minimum segment length
  • segmentation_max_length <value> - Set maximum segment length

Enhanced Stats Command:

  • Now displays all configurable parameters
  • Shows current subcarrier selection
  • Provides real-time configuration overview

Benefits:

  • ✅ No recompilation needed for parameter tuning
  • ✅ Easy optimization for different environments
  • ✅ Platform-specific defaults (ESP32-S3 vs ESP32-C6)
  • ✅ All parameters saved to NVS automatically
  • ✅ Simplified testing and validation workflow

✨ Added - System Resource Monitoring

Real-time CPU and RAM usage in stats command

  • Added cpu_usage_percent and heap_usage_percent fields to stats command response
  • Calculated using FreeRTOS runtime statistics and ESP-IDF heap APIs
  • Minimal overhead (< 0.1% CPU, ~150 bytes RAM)
  • Requires FreeRTOS runtime stats enabled in sdkconfig (added to all platform configs)
  • Web UI updated to display CPU and RAM in statistics modal

Real-world performance (ESP32-C6 with all filters + features):

  • CPU: 5.4%, Heap: 22.3% - confirms excellent resource efficiency

🌐 Web-Based Real-Time Monitor

Modern web interface for ESPectre monitoring and configuration

New espectre-monitor.html provides a comprehensive web-based alternative to the CLI shell:

Features:

  • Real-time visualization: Live chart of movement and threshold values
  • Interactive metrics: State, movement, threshold, and segment counters
  • Complete configuration: All detection parameters and filters controllable via web UI
    • Segmentation threshold (0.5-10.0)
    • Traffic generator rate (0-50 pps)
    • Features extraction toggle
    • Smart publishing toggle
    • All filters (Hampel, Savitzky-Golay, Butterworth, Wavelet) with parameters
  • Device information: Displays ESP32 IP address
  • Statistics viewer: Runtime statistics in modal popup
  • Auto-sync: Automatically loads current configuration on connection
  • Factory reset: Web-based factory reset with confirmation

Technical details:

  • Single HTML file (no dependencies except CDN libraries)
  • MQTT.js for WebSocket communication
  • Chart.js for real-time data visualization
  • Responsive design with collapsible sections
  • Toast notifications for command feedback

Benefits:

  • ✅ No terminal required - works in any modern browser
  • ✅ Visual feedback and easier parameter tuning
  • ✅ Multi-device support (can monitor multiple ESPectre nodes)
  • ✅ Cross-platform (works on desktop, tablet, mobile)
  • ✅ Can replace espectre-cli.sh for most use cases

🔧 MQTT Data Structure Optimization

Simplified and standardized MQTT message format

Optimized MQTT data structure for consistency and reduced bandwidth:

Periodic Data (published during detection):

  • ❌ Removed segments_total (not needed for motion detection)
  • ✅ Kept essential fields: movement, threshold, state, features (optional), timestamp

Stats Command Response:

  • ❌ Removed entire segments object (total, active, last_completed)
  • ✅ Renamed moving_variancemovement (consistent with periodic data)
  • ✅ Renamed adaptive_thresholdthreshold (consistent with periodic data)
  • ✅ Kept turbulence for diagnostics
  • ✅ Simplified to essential runtime metrics only

Code Cleanup:

  • ❌ Removed segment_t structure from segmentation.h
  • ❌ Removed segment array and tracking logic from segmentation.c (~150 lines)
  • ❌ Removed functions: segmentation_get_num_segments(), segmentation_get_segment(), segmentation_clear_segments(), segmentation_get_active_segments_count(), segmentation_get_last_completed_segment()
  • ✅ Simplified state machine to focus only on IDLE ↔ MOTION transitions

MQTT Handler Simplification:

  • Removed mqtt_publish_calibration_status() function
  • Removed mqtt_publish_calibration_complete() function
  • Added mqtt_publish_binary() for CSI raw data collection
  • Simplified API focused on segmentation-only approach

Benefits:

  • 📉 Reduced message size and memory usage
  • 🔄 Consistent field naming between periodic data and stats
  • 🎯 Cleaner API focused on motion detection
  • 🧹 Simpler codebase (~200 lines removed)
  • 🐛 Fixed bug where last_completed_segment showed stale data after 10 segments

🛠️ Enhanced Tools

Web Monitor:

  • Added controls for all new segmentation parameters
  • Real-time parameter adjustment with visual feedback
  • Improved configuration synchronization

CLI (espectre-cli.sh):

  • Added commands for segmentation parameter configuration
  • Improved interactive menu with new options
  • Better parameter validation and feedback

📚 Documentation & Cleanup

Documentation Updates:

  • CALIBRATION.md: Added runtime parameter configuration section
  • SETUP.md: Updated with new MQTT commands and examples
  • ESP32-PLATFORM-SUPPORT.md: Clarified platform-specific defaults

Code Cleanup:

  • Removed .DS_Store file
  • Updated .gitignore with better patterns
  • Removed obsolete convert_csi_to_header.py script

Don't miss a new espectre release

NewReleases is sending notifications on new releases.