update: improve documentation and restructure code for modular hardware integration, add CAN communication to HAL, and update KiCad layouts

This commit is contained in:
2026-01-23 22:02:14 +01:00
parent 1de40085fb
commit 0c0b62e2ed
18 changed files with 486 additions and 219 deletions

View File

@@ -5,11 +5,13 @@ draft: false
description: "a description"
tags: ["battery", "bq34z100"]
---
# BatteryManagment
The project contains an additional companion board, with a bq34z100 battery management ic.
# Battery Management Module
The project contains an additional companion board (Fuel Gauge), with a bq34z100 battery management IC.
It allows to track the health and charge for an external battery and is supposed to be soldered directly to the battery.
The main board contains a xt30 connector for power, and additionally a two pin I2C bus next/combined with it, to communicate with the BatteryManagement.
The MainBoard contains a connector for power, and additionally a two-pin I2C bus to communicate with the Battery Management module.
<!-- TODO: Add photo of the new modular Battery Management board -->
# Setup
{{< alert >}}
@@ -28,7 +30,7 @@ A protected Battery is required. There is only a very simplistic output voltage
2. Then the data/register for low voltage flash write protection should be set to 0V, as else with the voltage divider and no further configuration, the IC will refuse all write requests.
3. After this the supplied golden image can be used, it will setup the battery for 6Ah and a 4S lifepo. Different values can be adjusted after this to the users liking.
{{< alert >}}
The main board, does not care or process any of the charge discharge limits that can be set. Ensure that the battery can supply enough current as well as accept a 2A charging current from the MPPT system.
The main board, does not care or process any of the charge discharge limits that can be set. Ensure that the battery can supply enough current as well as accept a 2.4A charging current from the MPPT system.
{{< /alert >}}
The golden image sets the statups led up, to be in blinky mode. one very long interval means, that the battery is pretty much full. A few very short flashes mean that the battery is nearly empty. No light means, that the battery is in discharge protection and shut down.

View File

@@ -5,22 +5,39 @@ draft: false
description: "a description"
tags: ["MPPT", "solar"]
---
# MPPT
If the board is powered by solar, a on board MPPT converter tries to track the best current and voltage, so that the battery gets maximized charging current.
# MPPT Module
If the system is powered by solar, a dedicated MPPT (Maximum Power Point Tracking) module can be added. It tries to track the best current and voltage, so that the battery gets maximized charging current.
The currently used MPPT limits max current to 2A.
The currently used MPPT module is based on the CN3795 and limits max current to 2.4A.
There are two adjustable values for the MPPT, Input Power Point and Output Voltage.
<!-- TODO: Add photo of the new modular MPPT board -->
The module has two configurable values: **Input Power Point (MPPT)** and **Output Voltage (Battery Charge Voltage)**. These are set using fixed resistors rather than potentiometers to ensure stability and reduce costs.
### Configuration
The voltages are determined by voltage dividers. The default values are:
- **MPPT Voltage:** ~17.1V (set by R2 and R5)
- **Battery Voltage:** ~14.7V (set by R8 and R1)
#### Formulas
The reference voltage for the CN3795 is 1.205V.
- $V_{MPPT} = 1.205 \times (1 + \frac{R2}{R5})$
- $V_{BAT} = 1.205 \times (1 + \frac{R8}{R1})$
Default resistor values:
- $R1, R5 = 2.491k\Omega$
- $R2 = 33k\Omega$
- $R8 = 27k\Omega$
### Status LEDs
- **D4 (Red):** Charging
- **D5 (Green):** Done / Standby
#Setup
{{< alert >}}
Note: Only protected Batteries are supported!
{{< /alert >}}
1. Supply the Ext Charge connector with 20V and a limited current (suggested 100mA).
2. If the board does not startup, adjust the MPPT untill it supplies a output voltage. Note: The ESP should be able to startup at any settable output voltage, as it uses a converter to 3.3v anyways.
3. Adjust the Output Voltage to the correct charging voltage for your Chosen Battery.
4. Connect a sink (or the a non fully charged battery) to the Output, now adjust the MPPT so, that the Input Voltage drops to the optimal working Voltage of your Solar panel. The Converter will try to always keep the Panel at this Voltage by adjusting the Output Current accordingly.
Setting the MPPT slightly lower than the suggested Voltage will ensure more reliable operation, as the optimal voltage might drop a bit due to ageing and dust on the panel. Normally during summer there is more than enough power, so a slight inefficentcy won't be noticable.
However during winter in low light and bad weather conditions, that might be the difference between charging at all or no power. (If the panel does not reach the MPPT voltage, there is no charging current)
1. **Verify Resistors:** Before connecting, ensure that R2 and R8 match your solar panel's MPPT voltage and your battery's required charging voltage.
2. **Initial Test:** Supply the Ext Charge connector with a voltage higher than the MPPT setpoint (e.g., 20V) and a limited current (suggested 100mA).
3. **Check Output:** Measure the output voltage at the battery connector. It should match the calculated $V_{BAT}$.
4. **Connect Battery:** Once verified, you can connect the battery and the solar panel.

View File

@@ -5,11 +5,36 @@ draft: false
description: "a description"
tags: ["nightlight"]
---
# Nightlight
The board has a adjustable light output, which can be used to power a small led strip.
In the configuration, the working hours can be set, as well as if the light is allowed to be turned on, even if the solar panel still supplies power.
The supply should theoretically be able to supply up to 2A with a voltage lower than the battery.
# Nightlight Module
The system supports a dedicated light output module, which can be used to power a small LED strip for night lighting or growth support.
The module is based on the **AP63200** synchronous buck converter. It provides an adjustable output voltage, allowing it to drive various types of LED strips or other low-voltage DC loads.
### Configuration
The output voltage is adjustable via a potentiometer (**RV1**). This allows you to set the brightness or the correct operating voltage for your LED strip.
#### Formula
The reference voltage for the AP63200 is 0.8V. The output voltage is determined by the feedback divider:
- $V_{OUT} = 0.8 \times (1 + \frac{R_{high}}{R5})$
- $R_{high} = R1 + RV1 + R3$
Default values:
- $R1 = 10k\Omega$
- $R3 = 1k\Omega$
- $R5 = 5k\Omega$
- $RV1 = 0\Omega$ to $50k\Omega$ (Potentiometer)
With these values, the output voltage is adjustable from approximately **1.76V** to **9.76V**.
### Status LED
- **I1 (White):** Indicates that the light output is enabled.
# Setup
{{< alert >}}
Ensure the voltage is correctly set, before connecting a load the first time!
{{< /alert >}}
Ensure the voltage is correctly set using **RV1** before connecting a load for the first time! High voltages can damage LED strips.
{{< /alert >}}
1. **Power On:** Enable the light output through the software interface.
2. **Measure Voltage:** Use a multimeter to measure the voltage at the output connector (**LIGHT1**).
3. **Adjust RV1:** Turn the potentiometer until you reach the desired voltage or brightness.
4. **Connect Load:** Once the voltage is set correctly, you can connect your LED strip.

View File

@@ -5,21 +5,38 @@ draft: false
description: "a description"
tags: ["sensor"]
---
# Sensors & Pumps Module
This functionality is now provided by dedicated modules that can be connected to the MainBoard.
# Sensors
The board can address up to 16 sensors, with an A und B sensor per plant.
The A sensor is always used, the B sensor is optional and use is suggested for larger planters.
The moisture sensing functionality is handled by a dedicated **CAN bus-based Sensor Module**. This modular approach allows for better scalability and reduces electrical interference by moving the measurement logic closer to the sensors and using digital communication.
The sensor itself are just two spikes with a defined distance. They can be bought readymade or simply be done DIY with two long nails (use galvanized or non rusting ones)
## Sensor Module (CAN bus)
The standard sensor module features its own **CH32V203 RISC-V microcontroller**, which handles the measurement of soil moisture and communicates the results back to the MainBoard via the CAN bus.
The Sensor is switched via multiplexer chips to a 555 oscilator circuit that uses he the earths resistance for charging and discharging a small capacitor. The ESP simply counts how often the charge pulse was seen.
While this sensor can be easily influenced since it runs in lower uA - mA range, due to the frequencys of several khz for normal moist plants, it is still very resistant, eg a 50hz failure signal from a nearbly power circuit would barely be registered.
Since the Sensor is changing polarity between charging and discharging, corrosion due to organic battery effects is minimized, also it prevents errors due having build a battery (You can easily charge a planter to several V if you do not change polarity).
* **Capacity:** Supports up to 16 sensors (typically 8 plants with an A and B sensor each).
* **Reliability:** Digital communication via CAN bus ensures data integrity even over longer cable runs and in electrically noisy environments.
* **Addressing:** The A sensor is always used; the B sensor is optional and suggested for larger planters to provide a better average of the soil moisture.
## Sensor Hardware
The sensors themselves remain simple and cost-effective:
* **Design:** Two spikes with a defined distance.
* **DIY Friendly:** Can be bought readymade or easily made with two long nails (galvanized or stainless steel suggested to prevent rusting).
## Measurement Principle
The new CAN-based sensor module uses a sophisticated measurement technique that replaces the outdated 555-oscillator and multiplexer design. By using a dedicated MCU for measurement:
* **Minimized Corrosion:** The system changes polarity between measurements, minimizing corrosion due to organic battery effects (electrolysis) and preventing errors caused by building up a DC voltage in the soil.
* **Interference Resistance:** The measurement is resistant to common failure signals, such as 50Hz hum from nearby power circuits.
* **Digital Accuracy:** The local MCU processes the analog signals and sends precise digital values to the MainBoard.
# Pumps
The board contains 8 low side switched pump outputs. The pumps are running directly from the battery without further voltage conversion, so ensure that the can survive the full voltage range of the battery.
The Pump module contains low side switched pump outputs. The pumps are running directly from the battery without further voltage conversion, so ensure that they can survive the full voltage range of the battery.
Each output can supply up to 3A continously.
The board will never switch more than one output concurrently, so there is no need to size the battery for higher maximum load.
An additinal extra out exists, that is switched, when any of the pump outputs is supposed to run.
An additinal extra output exists, that is switched when any of the pump outputs is supposed to run.
<!-- TODO: Add photo of the new modular Pump and Sensor boards -->
This allows for multiple possible setups
## Layout Central Pump

View File

@@ -11,18 +11,35 @@ tags: ["esp32", "hardware"]
<img src="pcb_back.png" class="grid-w50" />
{{< /gallery >}}
<!-- TODO: Add new screenshots of the modular PCB setup -->
{{< gitea server="https://git.mannheim.ccc.de/" repo="C3MA/PlantCtrl" >}}
## ESP32-C6
* RiscV
* Fully done in Kicad (#schematics here link)
* Supports 16 Moisture Sensors (two per plant)
* Support for 8 Pumps/Valves
* Support for main Pump/Valve
* All Pump/Valve outputs are 7-24V based on supplied Voltage
* Use of efficient DC-DC Converters for 3.3V and for Led-Nightlight
* Embedded Solar MPPT Charger
* Can also be used with a power supply
## Modular Design
The PlantCtrl hardware has been redesigned from a single large PCB into a more flexible, modular system. This allows users to only build or use the components they actually need for their specific setup.
The system now consists of a **MainBoard** which acts as the controller and several pluggable or connectable modules.
## MainBoard (ESP32-C6)
* **Processor:** ESP32-C6 (RiscV)
* **Connectivity:** WiFi, Bluetooth, Zigbee/Thread support
* **Form Factor:** Compact main board with headers for modules
* **Fully Open Source:** Designed in KiCad
## Available Modules
* **MPPT Charger:** Efficient solar charging for batteries.
* **Pump Driver:** High-current outputs for pumps and valves.
* **Sensor Interface:** Support for multiple moisture sensors.
* **Light Controller:** For LED nightlights or growth lights.
## Capabilities
* **Moisture Sensors:** Supports multiple capacitive or resistive sensors via expansion modules.
* **Pumps/Valves:** Support for multiple independent watering zones.
* **Power:**
* Solar powered with MPPT
* Battery powered with optional Battery Management (Fuel Gauge)
* Can also be used with a standard power supply (7-24V)
* **Efficient Power:** Use of high-efficiency DC-DC converters for 3.3V and peripherals.
## Made with:
<a href="https://www.kicad.org/">