Skip to content

Commit c64dcf8

Browse files
authored
version bump: og3 version update (#36)
* version bump: og3 version update * Revised README (gemini) * Updated instructions (gemini) * Updated instructions with newer interface images
1 parent 0d6c308 commit c64dcf8

9 files changed

Lines changed: 150 additions & 80 deletions

README.md

Lines changed: 75 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,110 @@
11
# Plant133
22

3-
This is a full distribution of the Plant133 plant-watering device. This device can monitor and water up to 4 plants at a time. This repository hosts the firmware, PCBA design, and OpenSCAD code for the all components.
3+
This is a full distribution of the Plant133 plant-watering device. This device can monitor and water up to 4 plants at a time. This repository hosts the firmware, PCBA design, and OpenSCAD code for all components.
44

55
A writeup about this project is at "[Plant1337: "Water 4 plants](https://selectiveappeal.org/posts/plant1337/)."
66

77
![Plant133 device](images/plant1337_deployed_trim-1400x600.webp)
88

9+
## Features
910

10-
## Setup
11+
* **Multi-Plant Support**: Monitors and independently waters up to 4 plants.
12+
* **Sensors**:
13+
* Capacitive soil moisture sensing for each plant.
14+
* SHT3x temperature and humidity sensor for environmental monitoring.
15+
* Reservoir water level float switch detection.
16+
* **User Interface**:
17+
* **OLED Screen**: Rotates through status screens showing IP address, moisture levels, and environment data.
18+
* **Web Dashboard**: A modern Svelte-based responsive web interface for real-time monitoring and configuration.
19+
* **Integration**:
20+
* **MQTT**: Full support for Home Assistant auto-discovery and state reporting.
21+
* **Safety**:
22+
* **Watchdog Timer**: Hardware watchdog protects against system hangs.
23+
* **Dose Limiting**: Prevents over-watering by limiting the maximum number of pump cycles per day.
24+
* **Reservoir Check**: Prevents pump damage by detecting low water levels.
1125

12-
Please see the [instructions](instructions.md) for how to setup a Plant133 device if you are lucky enough to have one.
26+
## Usage
1327

28+
Please see the [instructions](instructions.md) for how to assemble and set up a Plant133 device hardware.
1429

15-
## Software
30+
## Development
1631

17-
This project is built using my C++ framework for ESP devices.
18-
- [og3](https://github.com/chl33/og3) My application framework.
19-
- [og3x-oled](https://github.com/chl33/og3x-oled) Support for the OLED screen I use with this project
20-
- [og3x-shtc3](https://github.com/chl33/og3x-shtc3) Support for the SHTC3 temperature/humidty sensor used by this project.
32+
### Prerequisites
33+
* [PlatformIO](https://platformio.org/) (Core or VSCode extension)
34+
* [Node.js](https://nodejs.org/) (for building the web interface)
2135

22-
The web interface for the project uses the Svelte framework, and was partially generated by Claude (Anthropic). Claude said it was OK to include the code in this MIT-licensed project. The web interface integration is performed using [svelteesp32](https://github.com/BCsabaEngine/svelteesp32).
36+
### Building the Web Interface
37+
The web interface is built with Svelte and must be compiled before uploading to the ESP32's filesystem.
2338

24-
![Plant133 web interface](images/plant133-svelte-interface-v091.jpg)
39+
```bash
40+
./build-svelte.sh
41+
```
2542

43+
This generates the static HTML/CSS/JS files in `data/static/`, then converts them into a header file (using [svelteesp32](https://github.com/BCsabaEngine/svelteesp32))to include them all in the firmware.
2644

45+
### Building and Flashing Firmware
2746

28-
## PCBA
47+
1. **Configure Secrets**: Copy `secrets.ini.example` to `secrets.ini` and set your WiFi credentials, OTA password, and MQTT details.
48+
2. **Build Firmware**:
49+
```bash
50+
pio run
51+
```
52+
3. **Upload Filesystem** (contains the web interface):
53+
```bash
54+
pio run -t uploadfs
55+
```
56+
4. **Upload Firmware**:
57+
```bash
58+
pio run -t upload
59+
```
2960

30-
The full [KiCAD](https://www.kicad.org/) project for the printed circuit board is in the [KiCAD](KiCAD/) subdirectory. KiCAD is a cross platform, open source electronics design system.
61+
## API Reference
3162

32-
![Plant1337 PCBA rendered by KiCAD](images/plant1337-board-kicad.png)
33-
34-
## Components which can be printed with a 3D printer
63+
The device exposes a JSON API for integration and control:
3564

36-
Several components for the Plant133 device are printed with a 3D printer. These are designed as 3D geometry descriptions in [OpenSCAD](https://openscad.org/). The code for these are in the [scad](scad/) subdirectory.
65+
* `GET /api/status`: Returns system status (temp, humidity, water level).
66+
* `GET /api/plants`: Returns configuration for all plants.
67+
* `GET /api/moisture`: Returns current moisture readings.
68+
* `PUT /api/plants/{id}`: Update configuration for a specific plant.
69+
* `POST /test/pump`: Run a pump for a specific duration (JSON body: `{ "pumpId": 1, "duration": 1000 }`).
70+
* `POST /api/restart`: Restart the device.
3771

38-
### Project box
72+
## Software Libraries
3973

40-
OpenSCAD code for the project box housing the PCBA is in the [scad/box/](scad/box/) subdirectory. It requires the library at https://github.com/chl33/ProjectBox.
74+
This project is built using a custom C++ framework for ESP devices:
75+
- [og3](https://github.com/chl33/og3): Application framework.
76+
- [og3x-oled](https://github.com/chl33/og3x-oled): OLED screen support.
77+
- [og3x-shtc3](https://github.com/chl33/og3x-shtc3): SHTC3 sensor support.
78+
- [svelteesp32](https://github.com/BCsabaEngine/svelteesp32): Web interface integration.
4179

42-
![EBox design in OpenSCAD](images/scad-plant133-ebox.png)
80+
## Hardware
4381

44-
### Project box reservoir hanger
82+
### PCBA
4583

46-
Code for a plate which allows you to hang the EBox on the side of a water reservoir is in [scad/ebox_hook](scad/ebox_hook). This is screwed to the bottom part of the EBox.
84+
The full [KiCAD](https://www.kicad.org/) project for the printed circuit board is in the [KiCAD](KiCAD/) subdirectory.
4785

48-
![Reservoir hanger](images/ebox-reservoir-hook.png)
86+
![Plant1337 PCBA rendered by KiCAD](images/plant1337-board-kicad.png)
4987

50-
### Reservoir insert
88+
### 3D Printed Components
5189

52-
Inside the water reservoir, an insert holds a float for detecting the water level and 1-4 aquarium pumps for watering the plants. The code for this insert is in [scad/reservoir_insert](scad/reservoir_insert).
90+
Components are designed in [OpenSCAD](https://openscad.org/). Source code is in the [scad](scad/) subdirectory.
5391

54-
![Reservoir insert with 2 pumps](images/scad-insert-2-pumps.png)
92+
#### Project box
93+
Housing for the PCBA ([scad/box/](scad/box/)).
94+
![EBox design in OpenSCAD](images/scad-plant133-ebox.png)
5595

56-
### Moisture sensor cap
96+
#### Reservoir Hanger
97+
Mounts the box to a water reservoir ([scad/ebox_hook](scad/ebox_hook)).
98+
![Reservoir hanger](images/ebox-reservoir-hook.png)
5799

58-
A cap for the moisture sensor can hold the end of the watering tube in place in the plant's pot, for when the watering spike is not used.
100+
#### Reservoir Insert
101+
Holds pumps and water level float ([scad/reservoir_insert](scad/reservoir_insert)).
102+
![Reservoir insert with 2 pumps](images/scad-insert-2-pumps.png)
59103

104+
#### Moisture Sensor Cap
105+
Holds the watering tube at the sensor location ([scad/moisture_sensor_cap](scad/moisture_sensor_cap)).
60106
![Moisture sensor cap top](images/scad-moisture-sensor-cap-4.png)
61-
![Moisture sensor cap bottom](images/scad-moisture-sensor-cap-bot.png)
62-
63-
### Watering spike
64-
65-
The end of the watering tube can be inserted into a 3D-printed spike with holes in it, which can be inserted into the soil in the plant pot to spread water through the pot.
66-
67-
The spike is printed in two halves which can be epoxied together.
68107

108+
#### Watering Spike
109+
Alternative watering method using a soil spike ([scad/spike](scad/spike)).
69110
![Watering spike half](images/scad-spike.png)
70-
71-
![Spike photo](images/spike.jpg)

images/plant133-svelte-mqtt.png

65 KB
Loading
81.3 KB
Loading

images/plant133-svelte-wifi.png

58.1 KB
Loading

images/web-mqtt-config.png

-18.7 KB
Binary file not shown.

images/web-wifi-config.png

-16.3 KB
Binary file not shown.

instructions.md

Lines changed: 73 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,99 @@
1-
# Instructions
1+
# Plant133 Setup Instructions
22

3-
First, hang the EBox on the reservoir and position the plant and reservoir where you want them and in a place where you can power the device with the USB cable.
3+
Follow this guide to assemble and configure your Plant133 watering system.
44

5-
![hang ebox](images/plant133-hang-ebox.jpg)
5+
## 1. Hardware Assembly
66

7-
Then, for each plant to be watered:
7+
### Mounting the Control Box
8+
Hang the EBox on the side of your water reservoir. Place your plant and reservoir in their final location, ensuring access to a USB power source.
89

9-
1. Install the float in the reservoir insert.
10+
![Hang EBox](images/plant133-hang-ebox.jpg)
1011

11-
![install float](images/install-float.jpg)
12+
### Reservoir Setup
1213

13-
Then wire the float to the ebox.
14+
1. **Install the Water Level Float**:
15+
Place the float into the reservoir insert.
16+
![Install Float](images/install-float.jpg)
1417

15-
![wire float](images/plant133-wire-float.jpg)
18+
Wire the float to the EBox.
19+
![Wire Float](images/plant133-wire-float.jpg)
1620

17-
2. Put a pump in the reservoir insert.
21+
2. **Install the Pump**:
22+
For each plant you intend to water, place a pump into the reservoir insert.
23+
![Install Motor](images/install-motor.jpg)
1824

19-
![install motor](images/install-motor.jpg)
25+
### Wiring and Tubing
2026

21-
3. Connect a soil moisture sensor and pump to the EBox. The connectors should be in a vertical line under 1, 2, 3, or 4 on the EBox. The soil moisture sensor uses a 3-conductor wire with JST connectors.
27+
For each plant,
2228

23-
![wire sensor and pump](images/plant133-wire-sensor-pump.jpg)
29+
3. **Connect Sensors and Pumps**:
30+
Connect the soil moisture sensor and the corresponding pump to the EBox. Ensure connectors are aligned vertically under the same number (1-4).
31+
* The soil moisture sensor uses a 3-conductor wire with JST connectors.
32+
![Wire Sensor and Pump](images/plant133-wire-sensor-pump.jpg)
2433

25-
4. Run a tube from the pump, through the hole in the insert, and then to the soil in the pot.
34+
4. **Run Tubing**:
35+
Run a tube from the pump, through the hole in the insert, towards the plant pot.
36+
![Install Motor Tube](images/install-motor-tube.jpg)
2637

27-
![install motor-tube](images/install-motor-tube.jpg)
38+
5. **Position Water Outlet**:
39+
Cut the tube to the appropriate length and choose one of the following methods:
40+
* **Method A (Cap)**: Push the tube end through the hole in the moisture sensor cap.
41+
![Tube Aimed at Soil](images/tube-aimed-at-soil.jpg)
42+
* **Method B (Spike)**: Insert the tube into a 3D-printed soil spike and insert the spike into the soil.
43+
![Spike with Tube](images/spike-with-tube.jpg)
44+
![Spike in Soil](images/spike-in-soil.jpg)
2845

29-
5. Cut the tube to the right length, and either:
30-
- Push the end through the hole in the moisture sensor cap to position it for watering the soil, or
46+
6. **Power Up**:
47+
Connect the EBox to power using a Micro-USB cable.
3148

32-
![tube aimed at soil](images/tube-aimed-at-soil.jpg)
49+
## 2. Network Configuration
3350

34-
- Insert the end of the tube into a soil spike and then insert the soil spike into the soil.
51+
1. **Connect to Device AP**:
52+
Look for a WiFi network named `plant133` (or similar) on your phone or computer. Connect to it.
53+
* *Note: The AP password (if set) and specific ESSID may be displayed on the device's OLED screen.*
3554

36-
![spike with tube](images/spike-with-tube.jpg)
37-
![spike in soil](images/spike-in-soil.jpg)
38-
6. Power the EBox with the USB micro cable.
39-
7. Look for the name of the device, and connect your phone or computer to a WiFi network with that name. The name of the ESSID may be shown on the device screen, along with the AP password (if set).
40-
8. Open a web browser to http://192.168.4.1, and accept the non-encrypted connection.
41-
9. Use the web interface to configure the device to connect to your home's WiFi network.
42-
- Press "WiFi Config" on the main page, and update the configuration. Press "Save", then "Back", the press "Restart" to reboot the device.
55+
2. **Access Configuration Page**:
56+
Open a web browser and navigate to `http://192.168.4.1`. You may need to accept a warning about a non-encrypted connection.
4357

44-
![web WiFi config](images/web-wifi-config.png)
58+
3. **Configure WiFi**:
59+
* Click **"WiFi Setup"** on the main page.
60+
* Enter your home WiFi credentials.
61+
* Click **"Save"**, then **"Back"**, and finally **"Restart"** to reboot the device.
62+
![Web WiFi Config](images/plant133-svelte-wifi.png)
4563

46-
10. Look for the IP address of the device on its screen to open its web interface again. If mDNS works in your home, you might be able to connect to it as "http://{device-name}.local" where "{device-name}" is replaced with the name of your device.
47-
11. If you have an MQTT broker in your house, use the web interface to configure the connection to the broker. If you are running Home Assistant and it works with your MQTT broker, the device will automatically show up in Home Assistant.
64+
4. **Reconnect**:
65+
Connect your phone/computer back to your home WiFi network. Look at the device's OLED screen to find its new IP address (e.g., `192.168.1.x`) or try accessing `http://plant133.local` (if mDNS is active).
4866

49-
![web MQTT config](images/web-mqtt-config.png)
67+
## 3. Device Configuration
5068

51-
12. In the device web interface, select the plant to be configured, then press "Configure".
69+
### MQTT Setup (Optional)
70+
If you use Home Assistant or another home automation system:
71+
1. Navigate to the **MQTT Setup** page via the web interface.
72+
2. Enter your Broker address, port, and credentials.
73+
3. Save. The device should automatically appear in Home Assistant if discovery is enabled.
74+
![Web MQTT Config](images/plant133-svelte-mqtt.png)
5275

53-
- Select the minimum and maximum soil moisture levels you want, and select the number of seconds you want the pump to run at each iteration of watering. Try 1 second for a small pot and 3 seconds for a medium-sized pot.
54-
- You can also calibrate the moisture sensor. Put the moisture sensor in a glass of water so that all except the cap is covered by water, and enter the ADC reading as the "max ADC reading". Remove the sensor out of the glass and dry it off, then enter the ADC reading as the "min ADC reading." Confusingly, the counts for the max reading should be less than the counts for the min reading, because max and min here refer to the moisture level not the counts.
55-
- You can set the time to wait between pump doses, which allows water to to spread through the soil and to the moisture sensor. The default is 15 minutes (900 seconds).
56-
- There is a safety feature to prevent over-watering if there is a problem with moisture sensing. After a maximum number of pump doses in a watering cycle, watering will pause for 12 hours before watering can continue. The default maximum number of doses is 5, but this can be changed.
57-
58-
![web watering config](images/web-water-config.png)
59-
60-
13. Enable watering, and enable reservoir water detection. Press "Save" and then "Back".
61-
14. Fill the reservoir with water.
62-
15. Monitor the plant-watering and tweak settings so it works the way you want it to.
63-
16. You get bonus points for setting up Grafana and creating a dashboard to show how well the watering is working.
64-
17. You can even more bonus points for using Home Assistant to send you a phone alert you when the reservoir is out of water.
76+
### Plant Configuration
77+
Select a plant from the main menu and click the settings icon.
6578

79+
* **Moisture Targets**: Set the **Minimum** (start watering) and **Maximum** (stop watering) soil moisture percentages.
80+
* **Dose Duration**: Set how long the pump runs per dose (in milliseconds).
81+
* *Recommendation:* Start with 1000ms (1s) for small pots, 3000ms (3s) for medium pots.
82+
* **Calibration**:
83+
* **Wet (100%)**: Submerge the sensor (excluding the electronic cap) in a glass of water. Note the "Raw Moisture" ADC value and enter it as `ADC Counts at 100%`.
84+
* **Dry (0%)**: Dry the sensor completely. Enter the reading as `ADC Counts at 0%`.
85+
* *Note: Lower ADC values usually mean higher moisture (more conductivity).*
86+
* **Dosing Logic**:
87+
* **Seconds between doses**: Time to wait for water to soak in before checking moisture again (Default: 900s / 15 min).
88+
* **Max doses per cycle**: Safety limit to prevent flooding if the sensor fails (Default: 5).
89+
![Web Watering Config](images/plant133-svelte-plant-cfg.png)
6690

91+
## 4. Final Steps
6792

93+
1. **Enable System**: In the configuration page, toggle **"Enable Automatic Watering"**.
94+
2. **Fill Reservoir**: Add water to your reservoir.
95+
3. **Monitor**: Watch the system for the first few cycles and adjust `Pump On Time` or moisture thresholds as needed.
6896

97+
### Advanced
98+
* **Grafana**: Set up a dashboard to visualize moisture trends over time.
99+
* **Home Assistant**: Create automations to alert you when the reservoir is low.

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ monitor_filters = esp32_exception_decoder
2525
build_type = release
2626
lib_deps =
2727
; watering
28-
og3@^0.3.96
28+
chl33/og3@^0.3.99
2929
og3x-oled@^0.3.1
3030
og3x-shtc3@^0.3.0
3131
adafruit/Adafruit BusIO

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "svelteesp32async.h"
2525
#include "watering.h"
2626

27-
#define SW_VERSION "0.9.3"
27+
#define SW_VERSION "0.9.4"
2828

2929
namespace {
3030

0 commit comments

Comments
 (0)