Update hardware and firmware documentation for new modules and features

- Removed outdated TODOs and legacy references in hardware documentation.
- Added details on the new CH32V203-based Sensor Module for CAN bus soil moisture sensors.
- Documented updates to the Battery Management System (CH32V203-based) replacing the older bq34z100 design.
- Refined sensor, pump, and power module descriptions with updated specifications.
- Expanded firmware documentation to include Rust-based ESP32-C6 platform details, new OTA procedure, and MQTT telemetry topics.
- Simplified toolchain setup and compilation process with updated scripts and instructions.
This commit is contained in:
2026-05-04 21:30:32 +02:00
parent ef0ec47d92
commit 776db785c4
6 changed files with 92 additions and 84 deletions

View File

@@ -6,9 +6,12 @@ description: "a description"
tags: ["firmeware", "upload"]
---
# From Source
The PlantCtrl firmware is written in Rust for the ESP32-C6 RISC-V microcontroller.
## Preconditions
* **Rust:** Current version of `rustup`.
* **ESP32 Toolchain:** `espup` installed and configured.
* **ESP32 Toolchain:** `espup` installed and configured for ESP32-C6.
* **espflash:** Installed via `cargo install espflash`.
* **Node.js:** `npm` installed (for the web interface).
@@ -37,10 +40,8 @@ You can use the provided bash scripts to automate the build and flash process:
You can also update the firmware wirelessly if the system is already running and connected to your network.
1. Generate the OTA binary:
```bash
cargo build --release
```
2. The binary will be at `target/riscv32imac-unknown-none-elf/release/plant-ctrl2`.
**`./image.sh`**
2. The binary will be `image.bin`.
3. Open the PlantCtrl web interface in your browser.
4. Navigate to the **OTA** section.
5. Upload the `plant-ctrl2` file.

View File

@@ -6,23 +6,26 @@ description: "a description"
tags: ["mqtt", "esp"]
---
# MQTT
A configured MQTT server will receive statistical and status data from the controller.
The PlantCtrl firmware publishes comprehensive status and telemetry data via MQTT when configured. The system uses the **mcutie** crate for Home Assistant integration and standard MQTT topics.
### Topics
| Topic | Example | Description |
|-------|---------|-------------|
| `firmware/address` | `192.168.1.2` | IP address in station mode |
| `firmware/state` | `VersionInfo { ... }` | Debug information about the current firmware and OTA slots |
| `firmware/state` | `{...}` | Debug information about the current firmware and OTA slots |
| `firmware/last_online` | `2025-01-22T08:56:46.664+01:00` | Last time the board was online |
| `state` | `online` | Current state of the controller |
| `mppt` | `{"current_ma":1200,"voltage_ma":18500}` | MPPT charging metrics |
| `battery` | `{"Info":{"voltage_milli_volt":12860,"average_current_milli_ampere":-16,...}}` | Battery health and charge data |
| `water` | `{"enough_water":true,"warn_level":false,"left_ml":1337,...}` | Water tank status |
| `plant{1-8}` | `{"sensor_a":...,"sensor_b":...,"mode":"TargetMoisture",...}` | Detailed status for each plant slot |
| `pump{1-8}` | `{"enabled":true,"pump_ineffective":false,...}` | Metrics for the last pump activity |
| `mppt` | `{"current_ma":1200,"voltage_ma":18500}` | MPPT charging metrics (current and voltage from solar panel) |
| `battery` | `{"Info":{"voltage_milli_volt":12860,"state_of_charge":95,...}}` | Battery health and charge data from the BMS |
| `water` | `{"enough_water":true,"warn_level":false,"left_ml":1337,...}` | Water tank status (level, temperature, frozen detection) |
| `plant{1-8}` | `{"sensor_a":...,"sensor_b":...,"mode":"TargetMoisture",...}` | Detailed status for each plant slot including moisture sensors |
| `pump{1-8}` | `{"enabled":true,"median_current_ma":500,...}` | Metrics for each pump output |
| `light` | `{"enabled":true,"active":true,...}` | Night light status |
| `deepsleep` | `night 1h` | Why and how long the ESP will sleep |
| `deepsleep` | `night 1h` | Reason and duration of deep sleep |
Note: The batteries `average_current_milli_ampere` field uses a placeholder value (1337) and should be updated with actual current sensor readings when available.
### Data Structures
@@ -39,14 +42,15 @@ Contains a debug dump of the `VersionInfo` struct:
- `voltage_ma`: Solar panel voltage in mV
#### Battery (`battery`)
Can be `"Unknown"` or an `Info` object:
- `voltage_milli_volt`: Battery voltage
- `average_current_milli_ampere`: Current draw/charge
- `design_milli_ampere_hour`: Battery capacity
- `remaining_milli_ampere_hour`: Remaining capacity
Can be `"Unknown"` or an `Info` object. The battery data comes from a custom BMS (Battery Management System) board that uses the CH32V203 microcontroller with I2C communication.
- `voltage_milli_volt`: Battery voltage in millivolts
- `average_current_milli_ampere`: Current draw/charge in milliamperes (placeholder: 1337)
- `design_milli_ampere_hour`: Battery design capacity in milliampere-hours
- `remaining_milli_ampere_hour`: Remaining capacity in milliampere-hours
- `state_of_charge`: Charge percentage (0-100)
- `state_of_health`: Health percentage (0-100)
- `temperature`: Temperature in degrees Celsius
- `state_of_health`: Health percentage (0-100) based onLifetime capacity vs design capacity
- `temperature`: Battery temperature in degrees Celsius
#### Water (`water`)
- `enough_water`: Boolean, true if level is above empty threshold

View File

@@ -6,9 +6,9 @@ description: "How to compile the project"
tags: ["clone", "compile"]
---
# Preconditions:
* **Rust:** `rustup` installed.
* **ESP32 Toolchain:** `espup` installed.
* **Build Utilities:** `ldproxy` and `espflash` installed.
* **Rust:** `rustup` installed with the Rust toolchain.
* **ESP32 Toolchain:** `espup` installed for ESP32 support.
* **Build Utilities:** `ldproxy` and `espflash` installed via cargo.
* **Node.js:** `npm` installed (for the web interface).
# Cloning the Repository
@@ -19,24 +19,16 @@ cd PlantCtrl/Software/MainBoard/rust
```
# Toolchain Setup
1. **Install Rust:** If not already done, visit [rustup.rs](https://rustup.rs/).
2. **Install ldproxy:**
The project uses Rust with ESP32-C6 support. The toolchain setup involves installing the necessary components:
1. **Rust Toolchain:**
```bash
cargo install ldproxy
```
3. **Install espup:**
```bash
cargo install espup
```
4. **Install ESP toolchain:**
```bash
espup install
```
5. **Install espflash:**
```bash
cargo install espflash
rustup toolchain install stable
rustup default stable
```
# Building the Web Interface
The configuration website is built using TypeScript and Webpack, then embedded into the Rust binary.
```bash
@@ -46,14 +38,7 @@ npx webpack
cd ..
```
# Compiling the Firmware
Build the project using Cargo:
```bash
cargo build --release
```
The resulting binary will be located in `target/riscv32imac-unknown-none-elf/release/plant-ctrl2`.
# Using Build Scripts
# Compiling the Firmware using Build Scripts
To simplify the process, several bash scripts are provided in the `Software/MainBoard/rust` directory:
* **`image_build.sh`**: Automatically builds the web interface, compiles the Rust firmware in release mode, and creates a flashable `image.bin`.