Skip to main content
Version: FILS English

Rust-Grow

An intelligent greenhouse automation system that monitors and controls the growing environment automatically.

info

Author: Yehor Zaplishnyi
GitHub Project: rust-grow

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.

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

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.

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

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.

Schematics

Rust-Grow Block Diagram

Bill of Materials

DeviceUsagePrice
STM32 Nucleo-64Core microcontroller
5V Power SupplySystem power
DHT22 / SHT31Air temperature & humidity sensor
MH-Z19BCO2 sensor (UART interface)
Capacitive Soil Moisture SensorSoil moisture (analog output)
DS18B20Waterproof soil temperature sensor (1-Wire)
Analog Soil pH SensorSoil pH measurement
HC-SR04Ultrasonic water level sensor
DS3231 RTC ModuleReal-time clock (I2C)
ThermistorOverheat protection for heater
OLED Display (I2C)Shows live sensor readings
FanCirculates air in the greenhouse
Heater elementWarms cold air
Relay moduleControls fan, heater, and irrigation pump
BuzzerLow water level alert
Green LEDNormal operation indicator
Yellow LEDTemperature/humidity warning
Red LEDCritical error indicator
Breadboard and jumper wiresPrototyping connections
ResistorsPull-up / current limiting

Software

LibraryDescriptionUsage
cortex-mARM Cortex-M processor supportCore embedded Rust runtime
cortex-m-rtRuntime for Cortex-MStartup and interrupt handling
stm32f4xx-halHAL for STM32F4 seriesHardware abstraction layer
panic-haltPanic handlerHalts on panic
embedded-halHardware abstraction traitsSensor/driver compatibility
dht-sensorDHT22 temperature & humidity driverAir sensor readings
sht3xSHT31 sensor driverAlternative air sensor
ds18b20DS18B20 soil temperature driver1-Wire soil temperature
ds323xDS3231 RTC driverReal-time clock via I2C
one-wire-bus1-Wire protocol implementationDS18B20 communication
ssd1306OLED display driver (I2C/SPI)Displaying sensor data
heaplessStatic data structuresNo-heap collections
nbNon-blocking abstractionsAsync-style I/O
defmtEfficient embedded loggingDebug output
defmt-rttRTT transport for defmtLogging over debug probe