# ClearGrow Probe nRF52840-based wireless sensor probe for indoor growing environments. Communicates with the ClearGrow Controller via Thread mesh networking. ## Features - **Thread MTD/SED**: Minimal Thread Device with Sleepy End Device support for battery optimization - **Multi-Sensor Support**: Climate, leaf temperature, substrate, CO2, and PAR sensors - **Code-Based Pairing**: Easy enrollment with controller via PSKd code - **Low Power**: Deep sleep modes for extended battery life - **CoAP Communication**: Efficient sensor data transmission via CoAP over Thread ## Hardware - **MCU**: nRF52840 (ARM Cortex-M4F, 64MHz) - **Radio**: IEEE 802.15.4 for Thread networking - **Power**: 3.0V LiPo battery with USB charging - **Sensors** (modular): - SHT4x: Temperature/humidity (climate) - MLX90614: IR leaf temperature - ADS1115: ADC for soil moisture/EC/pH - SCD4x: CO2 sensor - VEML7700: PAR/light sensor ## Project Structure ``` probe/ ├── src/ │ ├── main.c # Application entry point │ ├── thread_node.c # Thread networking and CoAP client │ ├── sensor_manager.c # Sensor polling and data aggregation │ ├── power_manager.c # Sleep modes and battery monitoring │ └── pairing_code.c # PSKd generation and storage ├── include/ │ └── probe_config.h # Configuration and type definitions ├── boards/ # Board-specific devicetree overlays ├── dts/ # Devicetree source files ├── prj.conf # Zephyr project configuration ├── Kconfig # Custom Kconfig options └── CMakeLists.txt # Build configuration ``` ## Building ### Prerequisites - Zephyr SDK 0.16.0 or later - West build tool - nRF Connect SDK (recommended) ### Setup ```bash # Initialize west workspace (if not already done) west init -m https://github.com/nrfconnect/sdk-nrf west update # Build for nRF52840 DK west build -b nrf52840dk_nrf52840 # Flash west flash ``` ### Configuration Key configuration options in `prj.conf`: - `CONFIG_OPENTHREAD_MTD=y` - Minimal Thread Device mode - `CONFIG_OPENTHREAD_JOINER=y` - Enable joiner for commissioning - `CONFIG_PM=y` - Power management enabled ## Protocol The probe sends sensor data to the controller using TLV (Type-Length-Value) format over CoAP: **Packet Format:** ``` Header (12 bytes): [0-7] Probe ID (EUI-64) [8] Protocol Version [9] Battery Percent [10-11] Sequence Number Measurements (TLV, repeating): [Type] Sensor type (1 byte) [ValueInfo] Type<<4 | Length (1 byte) [Value] Sensor reading (1-4 bytes) ``` **Measurement Types:** | Type | Sensor | |------|--------| | 0x01 | Temperature | | 0x02 | Humidity | | 0x03 | CO2 | | 0x04 | PPFD | | 0x05 | VPD | | 0x06 | Leaf Temperature | | 0x07 | Soil Moisture | | 0x08 | Soil Temperature | | 0x09 | EC | | 0x0A | pH | | 0x0B | DLI | | 0x0C | Dew Point | ## License Proprietary - ClearGrow Inc.