52 lines
3.1 KiB
Markdown
52 lines
3.1 KiB
Markdown
---
|
|
title: "Software"
|
|
date: 2025-01-24
|
|
draft: false
|
|
description: "Information about the PlantCtrl Firmware"
|
|
tags: ["software", "rust", "esp32-c6", "firmware"]
|
|
---
|
|
|
|
The PlantCtrl firmware is a modern, reliable, and efficient system designed specifically for the ESP32-C6 RISC-V microcontroller. It is written entirely in **Rust**, leveraging the power of asynchronous programming to ensure low power consumption and high responsiveness.
|
|
|
|
## Core Technology Stack
|
|
|
|
* **Language:** [Rust](https://www.rust-lang.org/) (no_std)
|
|
* **Async Runtime:** [Embassy](https://embassy.dev/)
|
|
* **Hardware Abstraction:** `esp-hal` for ESP32-C6
|
|
* **Filesystem:** [LittleFS2](https://github.com/littlefs-project/littlefs) for robust persistent storage
|
|
* **Web Framework:** `edge-http` for the integrated web server
|
|
|
|
## Key Features
|
|
|
|
### Intelligent Watering
|
|
The software manages up to 8 independent watering zones.
|
|
* **Moisture-Based Control:** Automatically triggers pumps when soil moisture drops below a configurable threshold.
|
|
* **Safety Limits:** Includes pump time limits, volume limits (requires flow sensor), and mandatory cooldown periods.
|
|
* **Scheduling:** Define specific hours during which watering is allowed to occur.
|
|
* **Pump Protection:** Monitors pump current to detect dry running or blockages (using INA219).
|
|
|
|
### Modular Sensor Integration
|
|
The firmware communicates with the new **CAN bus-based sensor modules**.
|
|
* **Digital Accuracy:** Receives precise moisture data over the robust CAN bus protocol.
|
|
* **Multi-Sensor Support:** Supports A and B sensor pairs for each plant to provide better averaging in large containers.
|
|
|
|
### Networking & IoT
|
|
* **WiFi:** Supports both Station mode (connecting to your home network) and Access Point mode (for initial setup).
|
|
* **MQTT & Home Assistant:** Full integration with Home Assistant via the `mcutie` crate. Reports battery status, moisture levels, tank levels, and allows remote configuration.
|
|
* **Time Sync:** Uses **SNTP** to keep the internal Real-Time Clock (RTC) accurate.
|
|
* **OTA Updates:** Firmware can be updated wirelessly via the web interface.
|
|
|
|
### Power Management
|
|
* **Solar Optimized:** Works in tandem with the MPPT module to maximize solar charging.
|
|
* **Battery Aware:** Monitors battery State of Charge (SoC). It can automatically disable non-essential features (like the nightlight) or enter a deep-sleep "rescue mode" if the battery is critically low.
|
|
* **Low Power:** Uses ESP32-C6 power-saving features to ensure long autonomous operation.
|
|
|
|
### Integrated Web Interface
|
|
The firmware hosts a comprehensive web dashboard built with **TypeScript** and **Webpack**.
|
|
* **Real-time Monitoring:** View current moisture, battery health, and solar production.
|
|
* **Easy Configuration:** Change all system settings (WiFi, MQTT, watering rules) directly from your browser.
|
|
* **Diagnostics:** Access system logs and hardware status information.
|
|
|
|
## Emergency Rescue Mode
|
|
If the system detects a missing configuration or an invalid system time, it automatically enters **Emergency Rescue Mode**. In this mode, it opens a WiFi Access Point ("PlantCtrl Init") allowing you to perform initial setup or recover the system.
|