diff --git a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/index.md b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/index.md index 2caad012aef..2bc0ee98e14 100644 --- a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/index.md +++ b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/index.md @@ -1,112 +1,514 @@ -# Rust-Grow -An intelligent greenhouse automation system that monitors and controls the growing environment automatically. +\# 🌱 # Rust-Grow + + + +An automated greenhouse project featuring Rust firmware + a Python web interface. + + :::info -**Author:** Yehor Zaplishnyi \ +\*\*Author:\*\* Yehor Zaplishnyi \\ + +\*\*GitHub Project:\*\* \[rust-grow](https://github.com/UPB-PMRust-Students/fils-project-2026-yehor.zaplishnyi) + -**GitHub Project:** [rust-grow](https://github.com/UPB-PMRust-Students/fils-project-2026-yehorzaplishnyi) ::: -## Description -This project focuses on building an intelligent greenhouse automation system using an STM32 Nucleo-64 microcontroller as the central controller. The goal is to design a comprehensive environmental monitoring and control solution that maintains optimal growing conditions through real-time sensor data collection, processing, and automated actuator control. -The system monitors critical environmental parameters including air temperature, humidity, CO2 levels, soil moisture, soil temperature, soil pH, and water reservoir levels. A Real-Time Clock (RTC) module enables precise day/night cycle automation. All sensor data is processed in Rust on the STM32's ARM Cortex-M core, providing low-power, memory-safe, and reliable operation. An OLED display shows live readings of all key parameters. A fan and heater pair maintain optimal air temperature, with a thermistor providing overheat protection. The controller also monitors the difference between air and soil temperature to avoid thermal stress on plants. -## Motivation +\--- -I want to start growing plants at home, but I know that I cannot always be around to monitor them. Watering at the wrong time, forgetting to check the temperature on a cold night, or not noticing that the soil has become too acidic — all of these things can easily kill a plant. I wanted to build a system that watches over the greenhouse for me, reacts automatically to changes in the environment, and alerts me when something needs attention. This project gave me the opportunity to combine my interest in embedded systems with something practical and useful in everyday life. +\## Description -## Architecture -The STM32 Nucleo-64 acts as the central controller, continuously polling all sensors and making decisions based on programmable thresholds. Sensor data is displayed in real time on the OLED screen. The fan and heater work together as a heating unit — when the air temperature drops below the threshold, both activate to blow warm air through the greenhouse. The thermistor monitors the heater directly and triggers an emergency cutoff if overheating is detected. The controller also compares air temperature (DHT22/SHT31) with soil temperature (DS18B20) and throttles the heater if the gap becomes too large, preventing thermal stress on plant roots. The DS3231 RTC enables scheduled lighting and irrigation based on time of day. When the water reservoir runs low, the HC-SR04 triggers the buzzer. Status LEDs give a visual overview of system health at a glance. -- **STM32 Nucleo-64** — central controller running all logic in Rust -- **Sensors** — DHT22/SHT31, MH-Z19B, DS18B20, soil moisture, pH, HC-SR04, thermistor, DS3231 RTC -- **Heating unit** — fan + heater element controlled together via relay -- **OLED display** — shows live sensor readings (I2C) -- **Feedback** — green/yellow/red LEDs and buzzer for alerts -- **5V power supply** — powers all modules +This project focuses on building an automated greenhouse system using an STM32F401RE microcontroller as the central controller. The goal is to design a practical environmental monitoring and control solution that maintains optimal growing conditions through real-time sensor data collection, processing, and automated actuator control. -## Log -### Week 7 - Project idea defined -Came up with the concept of Rust-Grow — an automated greenhouse system. Decided on the STM32 Nucleo-64 as the main controller and Rust as the programming language. Outlined the list of sensors and actuators needed. +The system monitors key environmental parameters including air temperature, humidity, soil moisture, soil temperature, and light intensity. All sensor data is processed in Rust on the STM32's ARM Cortex-M core, providing low-power, memory-safe, and reliable operation. An LCD 1602 display shows live readings cycling through all parameters. A fan relay maintains air circulation on an automated duty cycle, while a pump relay handles irrigation automatically based on soil moisture levels. A Python web interface allows remote monitoring and manual control over UART. -### Week 8 - Documentation complete -Wrote the full project documentation including architecture description, hardware list, software libraries, and block diagram. Defined the control logic for the fan/heater pair and the thermistor overheat protection. -### Week 9 - Hardware ordered +\## Motivation -Ordered all hardware components. Currently waiting for delivery. -## Hardware -The system is built around the STM32 Nucleo-64 board powered by a 5V supply. Sensors cover air quality, soil conditions, water level, and time scheduling. A fan and heater element are controlled together as a heating unit via a relay module. +I want to start growing plants at home, but I know that I cannot always be around to monitor them. Watering at the wrong time, forgetting to check the temperature on a cold night, or not noticing that the soil has become too dry — all of these things can easily kill a plant. I wanted to build a system that watches over the greenhouse for me, reacts automatically to changes in the environment, and alerts me when something needs attention. This project gave me the opportunity to combine my interest in embedded systems with something practical and useful in everyday life. + + + +\## Architecture Overview + + + +This project is split into separate technical layers to ensure a clean separation of concerns: + + + +1\. \*\*The Firmware Layer (`src/`):\*\* Bare-metal Rust code compiled for the STM32F401RE microcontroller. It handles direct sensor readings and physical relay/hardware control. + +2\. \*\*The Web Layer (`web/`):\*\* A host-side Python FastAPI server providing a user-friendly browser interface. + +3\. \*\*The Communication Layer (UART API):\*\* The bridge contract linking the two environments together. Because the backend environment is completely separated from the embedded environment, this dedicated hardware-agnostic text protocol is used to relay cross-system commands. + + + +\--- + + + +\## Hardware Configuration + +\--- + +| Component | Pin | Description | + +|-----------|-----|-------------| + +| DHT11 (air temperature/humidity) | D8 (PA9) | Environment monitoring | + +| NTC thermistor (soil temperature) | D12 (PA6) | Root environment tracking | + +| Soil sensor (soil moisture) | D13 (PA5) | Custom analog mapping | + +| APDS9930 SCL (light intensity) | D15 (PB8) | I2C Clock | + +| APDS9930 SDA | D14 (PB9) | I2C Data | + +| LCD 1602 RS | D2 (PA10) | Display Control | + +| LCD 1602 EN | D3 (PB3) | Display Enable | + +| LCD D4/D5/D6/D7 | D4/D5/D6/D7 | 4-bit Data Bus | -### Diagram +| Fan Relay IN1 | A1 (PA1) | Actuator for air-cooling | -![Rust-Grow Block Diagram](rust_grow_schema.svg) +| Pump Relay IN2 | A3 (PB0) | Actuator for hydration | -### Schematics +| Buzzer | D10 (PB6) | Audio feedback \& safety alarms | -![Rust-Grow KiCad](ma.svg) +| Float switch (water level) | A5 (PC0) | Main reservoir dry-run protection | -### Schematics +| Screen button | D11 (PA7) | Manual LCD view toggling | -![Rust-Grow Block Diagram](rust_grow_schema.svg) +| Reset button | B1 (PC13) | System hardware reset | -### Bill of Materials + +\*\*Resistors:\*\* 10kΩ between 3.3V and PA6 (NTC), 10kΩ between 3.3V and PA5 (Soil) + +\--- + +\### Diagram + +\--- + +!\[Rust-Grow Block Diagram](rust\_grow\_schema.svg) + +\--- + +\### Schematics + +\--- + +!\[Rust-Grow KiCad](ma.svg) + +\--- + +\### Bill of Materials + +\--- | Device | Usage | Price | + | ------ | ----- | ----- | -| [STM32 Nucleo-64](https://www.st.com/en/evaluation-tools/nucleo-f401re.html) | Core microcontroller | -| 5V Power Supply | System power | -| [DHT22 / SHT31](https://www.adafruit.com/product/385) | Air temperature & humidity sensor | -| [MH-Z19B](https://www.winsen-sensor.com/sensors/co2-sensor/mh-z19b.html) | CO2 sensor (UART interface) | -| Capacitive Soil Moisture Sensor | Soil moisture (analog output) | -| [DS18B20](https://www.adafruit.com/product/381) | Waterproof soil temperature sensor (1-Wire) | -| Analog Soil pH Sensor | Soil pH measurement | -| [HC-SR04](https://www.sparkfun.com/products/15569) | Ultrasonic water level sensor | -| [DS3231 RTC Module](https://www.adafruit.com/product/3013) | Real-time clock (I2C) | -| Thermistor | Overheat protection for heater | -| OLED Display (I2C) | Shows live sensor readings | -| Fan | Circulates air in the greenhouse | -| Heater element | Warms cold air | -| Relay module | Controls fan, heater, and irrigation pump | -| Buzzer | Low water level alert | -| Green LED | Normal operation indicator | -| Yellow LED | Temperature/humidity warning | -| Red LED | Critical error indicator | -| Breadboard and jumper wires | Prototyping connections | -| Resistors | Pull-up / current limiting | - -## Software + +| \[STM32 Nucleo-64](https://www.st.com/en/evaluation-tools/nucleo-f401re.html) | Core microcontroller | 120 | + +| 5V Power Supply | System power | 0 | + +| DHT11 | Air temperature \& humidity sensor | 4.64 lei | + +| NTC Thermistor | Soil temperature (ADC) | 6.49 lei| + +| Capacitive Soil Moisture Sensor | Soil moisture (analog output) | 20 lei | + +| \[APDS9930](https://docs.broadcom.com/doc/AV02-3191EN) | Light intensity sensor (I2C) | 15 lei | + +| \[LCD 1602](https://www.sparkfun.com/datasheets/LCD/ADM1602K-NSW-FBS-3.3v.pdf) | 4-bit display for sensor readouts | 9.82 lei | + +| Fan | Air-cooling actuator | 0 | + +| Water pump | Irrigation actuator | 10 lei | + +| Relay module | automation | 7.84 lei | + +| Buzzer | Audio feedback \& safety alarms | 0 | + +| Float switch | Reservoir dry-run protection | 20 | + +| Breadboard and jumper wires | Prototyping connections | 0 | + +| Resistors (10kΩ x2) | Pull-up for NTC and soil sensor | 0 | + +| Cable 30 cm USB AM-B Mini | debugging | 4.37 lei | + +| Total | | 218.16| + + + + + +\--- + + + +\## System Features \& Automation + +\--- + +\*\*Automation Logic:\*\* + +\- \*\*Fan Control:\*\* Runs on an automated duty cycle: 5 minutes ON followed by 10 minutes OFF. + +\- \*\*Irrigation:\*\* Triggers dynamically when soil moisture drops below 30%. Runs the water pump for exactly 5 seconds. + +\- \*\*Hardware Failure Protection:\*\* If 2 consecutive watering cycles occur without any detected change in soil moisture, the system halts operation, sounds the buzzer continuously, and prints a failure warning to the LCD screen to prevent flooding. + + + +\*\*LCD Screens\*\* (Cycle through views sequentially by pressing button D11): + +\- \*\*Screen 0:\*\* Air Temperature + Air Humidity + +\- \*\*Screen 1:\*\* Soil Moisture + Soil Temperature + +\- \*\*Screen 2:\*\* Reservoir Water Level Status + +\- \*\*Screen 3:\*\* Light Intensity (Lux) + + + +\*\*Web Control Functions:\*\* + +\- \*\*Fan Mode:\*\* Remotely toggle between hard ON, hard OFF, or back to AUTO cycle. + +\- \*\*Pump Burst:\*\* Request a one-time manual 5-second watering burst. + +\- \*\*Buzzer:\*\* Force an audible beep or clear active system errors. + + + +\--- + + + +\## UART API Commands + +\--- + +The Python application and the STM32 board pass text-based instructions over a Serial (UART) data connection at \*\*9600 Baud\*\*. + + + +| Command Code | System Action | + +|--------------|---------------| + +| `F1` | Fan ON | + +| `F0` | Fan OFF | + +| `FA` | Fan AUTO (Resumes timed cycle) | + +| `P1` | Run pump manual 5 sec sequence | + +| `P0` | Force Pump OFF | + +| `B1` | Turn Buzzer ON | + +| `B0` | Turn Buzzer OFF / Acknowledge and Reset Errors | + + + +\--- + + + +\## Setup \& Installation + +\--- + +\### STM32 Firmware + + + +```bash + +\# Install the embedded ARM target architecture support + +rustup target add thumbv7em-none-eabihf + + + +\# Install flashing and debugging utilities + +cargo install probe-rs-tools --locked + + + +\# Direct compilation and hardware execution + +cargo run + + + +\# Alternative: Manual compilation and Mass Storage (D:) drag-and-drop flash + +cargo build + +copy target\\thumbv7em-none-eabihf\\debug\\rust-grow D:\\ + +``` + +\--- + +\### Python Web Server + +\--- + +```bash + +\# Install server framework dependencies and communication drivers + +pip install fastapi uvicorn pyserial + + + +\# Navigate to application runtime directory + +cd web + + + +\# Initialize local platform hosting + +py server.py + +``` + + + +\--- + + + +\## Project Structure + +\--- + +``` + +src/ + +├── main.rs Application initialization and real-time execution loop + +├── dht11.rs Bit-banging driver for ambient temperature/humidity + +├── ntc.rs ADC calculation algorithms for thermistor values + +├── soil.rs Moisture scale percentage conversion driver + +├── apds9930.rs I2C protocol interpreter for ambient lux tracking + +├── lcd1602.rs 4-bit architecture driver for peripheral UI text displays + +├── relay.rs GPIO state controllers managing external fan relays + +├── pump.rs GPIO state controllers managing external pump relays + +├── buzzer.rs Sound output toggle frequencies + +├── float.rs High/Low state register readers tracking physical float switches + +└── bin/ + + └── test.rs Debug configuration test environment for isolated sensors + + + +web/ + +├── server.py Python FastAPI routing application managing web calls to UART translation + +└── index.html Client browser management dashboard visual interface + +``` + + + +\--- + + + +\## Software + +\--- | Library | Description | Usage | + | ------- | ----------- | ----- | -| [cortex-m](https://crates.io/crates/cortex-m) | ARM Cortex-M processor support | Core embedded Rust runtime | -| [cortex-m-rt](https://crates.io/crates/cortex-m-rt) | Runtime for Cortex-M | Startup and interrupt handling | -| [stm32f4xx-hal](https://crates.io/crates/stm32f4xx-hal) | HAL for STM32F4 series | Hardware abstraction layer | -| [panic-halt](https://crates.io/crates/panic-halt) | Panic handler | Halts on panic | -| [embedded-hal](https://crates.io/crates/embedded-hal) | Hardware abstraction traits | Sensor/driver compatibility | -| [dht-sensor](https://crates.io/crates/dht-sensor) | DHT22 temperature & humidity driver | Air sensor readings | -| [sht3x](https://crates.io/crates/sht3x) | SHT31 sensor driver | Alternative air sensor | -| [ds18b20](https://crates.io/crates/ds18b20) | DS18B20 soil temperature driver | 1-Wire soil temperature | -| [ds323x](https://crates.io/crates/ds323x) | DS3231 RTC driver | Real-time clock via I2C | -| [one-wire-bus](https://crates.io/crates/one-wire-bus) | 1-Wire protocol implementation | DS18B20 communication | -| [ssd1306](https://crates.io/crates/ssd1306) | OLED display driver (I2C/SPI) | Displaying sensor data | -| [heapless](https://crates.io/crates/heapless) | Static data structures | No-heap collections | -| [nb](https://crates.io/crates/nb) | Non-blocking abstractions | Async-style I/O | -| [defmt](https://crates.io/crates/defmt) | Efficient embedded logging | Debug output | -| [defmt-rtt](https://crates.io/crates/defmt-rtt) | RTT transport for defmt | Logging over debug probe | - -## Links - - + +| \[cortex-m](https://crates.io/crates/cortex-m) | ARM Cortex-M processor support | Core embedded Rust runtime | + +| \[cortex-m-rt](https://crates.io/crates/cortex-m-rt) | Runtime for Cortex-M | Startup and interrupt handling | + +| \[stm32f4xx-hal](https://crates.io/crates/stm32f4xx-hal) | HAL for STM32F4 series | Hardware abstraction layer | + +| \[panic-halt](https://crates.io/crates/panic-halt) | Panic handler | Halts on panic | + +| \[embedded-hal](https://crates.io/crates/embedded-hal) | Hardware abstraction traits | Sensor/driver compatibility | + +| \[dht-sensor](https://crates.io/crates/dht-sensor) | DHT11 temperature \& humidity driver | Air sensor readings | + +| \[apds9930](https://crates.io/crates/apds9930) | APDS9930 light sensor driver | Ambient lux via I2C | + +| \[heapless](https://crates.io/crates/heapless) | Static data structures | No-heap collections | + +| \[nb](https://crates.io/crates/nb) | Non-blocking abstractions | Async-style I/O | + +| \[defmt](https://crates.io/crates/defmt) | Efficient embedded logging | Debug output | + +| \[defmt-rtt](https://crates.io/crates/defmt-rtt) | RTT transport for defmt | Logging over debug probe | + + + +\--- + + + +\## Log + +\--- + +\### Week 7 - Project idea defined + + + +Came up with the concept of Rust-Grow — an automated greenhouse system. Decided on the STM32F401RE as the main controller and Rust as the programming language. Outlined the list of sensors and actuators needed. + + + +\### Week 8 - Documentation complete + + + +Wrote the full project documentation including architecture description, hardware pin table, UART API, and software library list. Defined the automation logic for fan duty cycle, soil moisture irrigation, and hardware failure protection. + + + +\### Week 9 - Hardware ordered + + + +Ordered all hardware components. Currently waiting for delivery. + + + +\### Week 12 - Hardware Arrived + + + +All ordered components were delivered. Started wiring and assembling the hardware setup. + + + +\### Week 14 - Project Completed + + + +Finished development — firmware, web server, and hardware all tested and working together. + + + +!\[Project photo 1](photo1.webp) + +!\[Project photo 2](photo2.webp) + + + +\--- + + + +\## Links + +\--- + +\### Hardware References + +\- \[STM32F401RE Datasheet](https://www.st.com/resource/en/datasheet/stm32f401re.pdf) + +\- \[STM32 Nucleo-64 User Manual](https://www.st.com/resource/en/user\_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf) + +\- \[DHT11 Datasheet](https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf) + +\- \[APDS9930 Datasheet](https://docs.broadcom.com/doc/AV02-3191EN) + +\- \[LCD 1602 Datasheet](https://www.sparkfun.com/datasheets/LCD/ADM1602K-NSW-FBS-3.3v.pdf) + + + +\### Rust Embedded Libraries + +\- \[cortex-m](https://crates.io/crates/cortex-m) + +\- \[cortex-m-rt](https://crates.io/crates/cortex-m-rt) + +\- \[stm32f4xx-hal](https://crates.io/crates/stm32f4xx-hal) + +\- \[embedded-hal](https://crates.io/crates/embedded-hal) + +\- \[panic-halt](https://crates.io/crates/panic-halt) + +\- \[dht-sensor](https://crates.io/crates/dht-sensor) + +\- \[apds9930](https://crates.io/crates/apds9930) + +\- \[heapless](https://crates.io/crates/heapless) + +\- \[nb](https://crates.io/crates/nb) + +\- \[defmt](https://crates.io/crates/defmt) + +\- \[defmt-rtt](https://crates.io/crates/defmt-rtt) + + + +\### Python Web Stack + +\- \[FastAPI Documentation](https://fastapi.tiangolo.com/) + +\- \[Uvicorn](https://www.uvicorn.org/) + +\- \[pyserial](https://pyserial.readthedocs.io/en/latest/) + + + +\### Inspiration \& Related Projects + +\- \[The Embedded Rust Book](https://docs.rust-embedded.org/book/) + +\- \[probe-rs](https://probe.rs/) + +\- \[Awesome Embedded Rust](https://github.com/rust-embedded/awesome-embedded-rust) + +\--- + + + diff --git a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/ma.svg b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/ma.svg index 856b1df42ea..e66d6a52b7d 100644 --- a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/ma.svg +++ b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/ma.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/photo1.webp b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/photo1.webp new file mode 100644 index 00000000000..4c93f5fe92f Binary files /dev/null and b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/photo1.webp differ diff --git a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/photo2.webp b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/photo2.webp new file mode 100644 index 00000000000..00c089f88fa Binary files /dev/null and b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/photo2.webp differ diff --git a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/rust_grow_schema.svg b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/rust_grow_schema.svg index 7a4d34f7c02..b7db1bf09c2 100644 --- a/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/rust_grow_schema.svg +++ b/website/versioned_docs/version-fils_en/project/2026/yehor.zaplishnyi/rust_grow_schema.svg @@ -1,174 +1,138 @@ - - Rust-Grow greenhouse automation block diagram - STM32 Nucleo-64 central controller with all sensors, OLED display, fan+heater pair and thermistor overheat protection. - - - - - - - - Rust-Grow - - - - - STM32 Nucleo-64 - Central controller (Rust) - - - - - - OLED display - Temp, humidity, CO2, pH - - - - - - - Buzzer - Low water alert - - - - - - Green LED - Normal operation - - - - - - Yellow LED - Temp/humidity warning - - - - - - Red LED - Critical error - - - - - Heating unit - - - - - Fan - Circulates air - - - - - - Heater element - Warms cold air - - - - - - - - - - - - - - DHT22 / SHT31 - Air temp & humidity - - - - - - MH-Z19B - CO2 sensor (UART) - - - - - - Thermistor - Overheat protection - - - - - - Soil moisture sensor - Capacitive, analog - - - - - - DS18B20 - Soil temp (1-Wire) - - - - - - Soil pH sensor - Analog output - - - - - - HC-SR04 - Water level (ultrasonic) - - - - - - DS3231 RTC - Day/night scheduling (I2C) - - - - - - 5V power supply - Powers all modules - - - - - - - - - - - - - - - - - - - - - Data / control - - Safety feedback - - Sensors - - Alerts - - Actuators - - Display - + + Rust-Grow greenhouse automation block diagram + STM32F401RE central controller with sensors, LCD, relay actuators, buzzer, float switch, and Python web interface. + + + + + + + + Rust-Grow — STM32F401RE Block Diagram + + + + + STM32F401RE + Central controller (Rust) + + + + + + Python Web Server + FastAPI + pyserial (UART) + + + + + + + + + + + Buzzer + D10 (PB6) — alerts + + + + + + LCD 1602 + 4-bit bus, D2–D7 + + + + + + Fan Relay + A1 (PA1) — cooling + + + + + + Pump Relay + A3 (PB0) — irrigation + + + + + + Screen Button + D11 (PA7) — LCD cycle + + + + + + Float Switch + A5 (PC0) — water level + + + + + + + + + + + + + + + + DHT11 + D8 (PA9) — air temp/humidity + + + + + + NTC Thermistor + D12 (PA6) — soil temp + + + + + + Soil Moisture + D13 (PA5) — analog % + + + + + + APDS9930 + D14/D15 (I2C) — lux + + + + + + + + + + + + + 5V Power Supply + Powers all modules + + + + + + Data / control + + Sensors + + Inputs / Alerts + + Actuators + + Display / Web +