Skip to main content
Version: FILS English

AquaRust

An autonomous fish feeder that dispenses food on a programmed schedule, monitors aquarium water conditions in real time and has alerts when needed.

info

Author: Niță Iulia-Ștefania
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-nitaiulia1905-png

Description

This project focuses on building an automated fish feeding and environmental monitoring system using the Rust programming language for high reliability. The system uses an STM32 microcontroller for precise hardware controly. It is designed to dispense food at scheduled intervals using a servo motor while simultaneously monitoring water temperature and water level to ensure a safe environment for the fish. The device displays live sensor data on a small OLED screen and allows the user to trigger an instant feeding remotely from their phone, offering a simple and hands-free way to care for aquatic life.

Motivation

The motivation is my desire to create a more sustainable way to manage home ecosystems. Traditional fish care often involves low-quality electronics that eventually end up in a landfill, and inconsistent feeding habits that negatively affect water quality. By using a regulated battery power supply and high-durability components, I am building a device designed for longevity. Furthermore, by using a real-time clock to enforce precise feeding schedules and sensors to continuously monitor water temperature and level, I am reducing the risk of overfeeding and organic waste buildup in the water. This helps maintain a cleaner tank environment and reduces the frequency of water changes, ultimately saving water and resources. Beyond the environmental aspect, this project also represents a personal challenge to work with embedded systems and the Rust programming language.

Architecture

The microcontroller unit, built around the STM32 NUCLEO-U545RE-Q, serves as the central brain of the device. It runs all firmware logic using asynchronous embedded Rust via the Embassy framework, coordinating every peripheral and task concurrently without a traditional operating system. It processes sensor readings, updates the display, enforces feeding schedules, and handles incoming remote commands.

The sensing subsystem consists of the DS18B20 waterproof temperature sensor, the water level sensor, and the infrared obstacle sensor. These components continuously provide the microcontroller with real-time data about the aquarium environment and the state of the food hopper. The DS3231 RTC module complements this subsystem by maintaining precise time tracking, ensuring that scheduled feedings remain accurate even after a power cut or battery swap.

The actuation system is centered on the SG90 micro servo motor, which physically controls the food hopper gate to dispense portions of fish food. The STM32 drives the servo using a PWM signal.

The power management system supplies the entire device from a 4×AA battery pack, a CR2032 coin cell on the DS3231 module keeps the real-time clock running independently whenever the main power supply is disconnected.

img

Log

Week 8 - 13 April

Most of the components started to arrive, among the STM32 NUCLEO-U545RE-Q. Still waiting on other components.

Week 9 - 20 April

Waiting on the left components to arrive.

Week 10 - 27 April

All components arrived, started working on Kicad.

Week 11 - 4 May

Finished the Kicad schematic and started working on hardware.

Week 12 - 11 May

Tested sensors and started connecting them to my breadboard and STM32 NUCLEO-U545RE-Q.

Week 13 - 18 May

After trying to configure the waterproof sensor of water temperature, I changed my idea to a room temperature sensor and a light sensor (8 to 12-hour day-night cycle).

Week 14 - 28

Ready to test the project for the first time, all components connected.

img img img

Week 11 - 4 May

Finished the Kicad schematic and started working on hardware.

Hardware

The primary processing unit is built around the STM32 NUCLEO-U545RE-Q, interfacing with all peripherals through its GPIO, I2C, ADC, and PWM pins. The sensing subsystem includes the LM35dz analog temperature sensor on ADC for room temperature monitoring, the BH1750FVI light sensor over I2C for ambient light detection, the DS3231 RTC module over I2C backed by a CR2032 coin cell to maintain accurate time during power cuts, the infrared digital obstacle sensor on GPIO to detect whether food is still present in the hopper, and the water level sensor to monitor if the water drops below a safe level. The SG90 9G micro servo physically dispenses food from the hopper, controlled via PWM. System status and live sensor data are displayed on the 0.91" 128×32 OLED over I2C. The entire system is prototyped on a breadboard and supplied by a 4×AA battery pack.

Schematics

img

Bill of Materials

DeviceUsagePrice
STM32 NUCLEO-U545RE-QThe microcontroller~107 RON
DS3231 RTC Module keeps accurate time for scheduled feedings~24 RON
Infrared Digital Obstacle Sensordetects if food is still present in the hopper20 RON
Water Level Sensormonitors if the water drops below a safe level2 RON
Modul OLED Albastru de 0.91'' (128x32 px) shows live sensor data and system status21 RON
Lm35dz Temperature Sensor monitors the temperature of the room5 RON
Light Sensor BH1750FVImonitors the light in the room14.50 RON
SG90 9G Micro Servo physically dispenses food from the hopper22 RON
4×AA Batteries & Battery Holdermain power supply for the entire system26 RON
CR2032 Coin Cell Batterym keeps the DS3231 clock running during power cuts10 RON
Breadboardmain prototyping surface for connecting all components13 RON
Male-to-Male Jumper Wireswires for connecting components6 RON
USB Data Cableconnects the STM32 to a PC for flashing firmware0 RON (BORROWED)

Software

Software

LibraryDescriptionUsage
embassy-executorasync task executorUsed to run all concurrent firmware tasks
embassy-timeasync timers and delaysUsed for polling intervals and servo timing
embassy-stm32drivers for STM32 peripheralsUsed to control GPIO, ADC, I2C, UART, PWM
embedded-halstandard hardware interface traitsUsed by all peripheral drivers
embedded-hal-020.2.x hardware interface traitsUsed for PWM and serial compatibility traits
ssd1306SSD1306 OLED display driverUsed to initialize and render to the 128×32 OLED
embedded-graphics2D embedded graphics libraryUsed for drawing text and shapes on the OLED
heaplessfixed-size collections without heapUsed for string buffers in display and serial output
defmtlightweight embedded loggingUsed to print debug messages over RTT
defmt-rttRTT log transportUsed to view logs on PC
panic-probeembedded panic handlerUsed to report firmware crashes
  1. Reference Manual STSTM32U5
  2. Fish Feeder Machine Architecture Idea
  3. Embassy framework ...