ClearGrow Agent bbfe64ba51
Some checks are pending
ClearGrow Controller CI / Run Unit Tests (push) Waiting to run
ClearGrow Controller CI / Build Development Firmware (push) Blocked by required conditions
ClearGrow Controller CI / Build Production Firmware (push) Blocked by required conditions
ClearGrow Controller CI / CI Status Summary (push) Blocked by required conditions
ci/woodpecker/push/build Pipeline was successful
Merge issue/CG-67 to main
2025-12-11 08:21:42 -07:00
2025-12-10 09:31:10 -07:00
2025-12-11 06:53:10 -07:00
2025-12-10 09:31:10 -07:00

ClearGrow Controller

ESP32-S3 based environmental monitoring controller for indoor growing environments. Acts as a Thread Border Router to coordinate wireless sensor probes and provides a touchscreen interface for monitoring and control.

Features

  • Thread Border Router: Coordinates up to 16 wireless sensor probes via IEEE 802.15.4
  • WiFi Connectivity: 2.4GHz WiFi for cloud connectivity and local API
  • 4.3" Touchscreen: 800x480 RGB LCD with capacitive touch (GT1151)
  • NFC Pairing: Tap-to-pair probe enrollment using ST25R3916
  • SD Card Logging: Local data storage with CSV export
  • MQTT Integration: Real-time sensor data publishing
  • OTA Updates: Secure over-the-air firmware updates
  • TinyML Anomaly Detection: On-device environmental anomaly detection

Hardware

  • MCU: ESP32-S3 (dual-core Xtensa LX7, 240MHz)
  • Memory: 16MB Flash, 8MB PSRAM (Octal)
  • Display: Waveshare 4.3" RGB LCD (800x480)
  • Touch: GT1151 capacitive touch controller
  • NFC: ST25R3916 NFC reader
  • Radio: IEEE 802.15.4 for Thread networking

Project Structure

controller/
├── main/                   # Application entry point
│   ├── app_main.c         # Main initialization
│   ├── app_events.h       # System event definitions
│   ├── device_limits.h    # Device capacity constants
│   └── pin_config.h       # GPIO pin assignments
├── components/
│   ├── wifi_manager/      # WiFi connection management
│   ├── display/           # LVGL display and touch
│   ├── thread_manager/    # Thread Border Router
│   ├── sensor_hub/        # Sensor data aggregation
│   ├── spi_bus_manager/   # SPI bus management
│   ├── watchdog/          # System health monitoring
│   ├── data_logger/       # SD card CSV logging
│   ├── network_api/       # REST API and MQTT
│   ├── ota_manager/       # Firmware updates
│   ├── settings/          # NVS-backed configuration
│   ├── provisioning/      # Device setup flow
│   ├── controller_sync/   # Multi-controller sync
│   ├── automation/        # Rule-based automation
│   ├── security/          # Encryption and auth
│   └── tflite_runner/     # TensorFlow Lite Micro
├── models/                 # TinyML model files
├── certs/                  # TLS certificates
├── partitions.csv         # Flash partition table
├── sdkconfig.defaults     # Default SDK configuration
└── CMakeLists.txt         # Build configuration

Building

Prerequisites

  • ESP-IDF v5.2 or later
  • Python 3.8+

Setup

# Source ESP-IDF environment
source ~/esp/esp-idf/export.sh

# Configure (optional - uses sdkconfig.defaults)
idf.py menuconfig

# Build
idf.py build

# Flash
idf.py -p /dev/ttyUSB0 flash monitor

Configuration

Key configuration options in sdkconfig.defaults:

  • CONFIG_SPIRAM_MODE_OCT=y - Octal PSRAM mode
  • CONFIG_OPENTHREAD_BORDER_ROUTER=y - Thread BR enabled
  • CONFIG_LV_COLOR_DEPTH_16=y - 16-bit color display

Task Architecture

Task Core Priority Stack Description
ui_task 1 5 8KB LVGL rendering
sensor_hub_task 1 10 4KB Sensor aggregation
thread_br_task 0 12 8KB Thread Border Router
network_api_task 0 8 6KB REST API server
network_mqtt_task 0 7 6KB MQTT client
data_logger_task 0 3 4KB SD card logging
watchdog_task 0 20 2KB System health
tflite_task 1 2 16KB ML inference

Memory Budget

  • Internal SRAM: ~320KB available
    • FreeRTOS heaps, stacks, static allocations
  • PSRAM: 8MB available
    • Display frame buffers (1.5MB x2)
    • Sensor history buffers
    • TFLite arena

API Endpoints

Endpoint Method Description
/api/v1/status GET System status
/api/v1/sensors GET Current sensor readings
/api/v1/sensors/{id} GET Specific probe data
/api/v1/settings GET/PUT Configuration
/api/v1/automation GET/POST Automation rules
/api/v1/logs GET Data log export

License

Proprietary - ClearGrow Inc.

Description
No description provided
Readme 1.4 MiB
2025-12-11 04:10:22 +00:00
Languages
C 98.6%
Python 0.4%
CMake 0.4%
Shell 0.3%
C++ 0.3%