Skip to main content
Version: FILS English

Automated Drink Mixer

An automated drink mixer that precisely measures and dispenses custom juice recipes.

info

Author: Mario Emancipatu
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-2026-marioemancipatu

Description

The Automated Drink Mixer is an embedded project designed to automate the process of mixing beverages. The system uses an STM32 microcontroller to coordinate three mini submersible DC pumps.

The user interface consists of an OLED display and a rotary encoder, allowing the user to select from a variety of predefined recipes. Once a drink is selected, the STM32 activates the corresponding pumps via a 4-channel relay module for a precise duration, ensuring the correct proportions for every glass. The entire system is built with a focus on asynchronous execution using the Rust Embassy framework to ensure a responsive UI while the hardware operations are in progress.

Motivation

I chose this project because I wanted to build something that is not only fun to use but also serves a real-world purpose. It is a great way to explore how embedded systems can control physical hardware (pumps) based on digital user input. Also, I wanted to challenge myself by learning the Embassy framework in Rust, as it's a modern and safe way to handle multiple tasks at once, like managing a display while running timers for the pumps.

Architecture

The project's architecture is built around the STM32 NUCLEO-U545RE-Q as the central brain. The workflow is as follows:

  • Input: The Rotary Encoder sends signals to the STM32 to navigate the beverage menu.
  • Display: The OLED Display provides visual feedback, showing the selected recipe and progress via the I2C protocol.
  • Control: The STM32 processes the selection and triggers the 4-Channel Relay Module.
  • Power & Output: The relays act as electronic switches, closing the circuit between the external battery pack and the Mini Submersible Pumps.
  • Flow: Each pump draws liquid from a container through Silicone Tubing and dispenses it into a common cup.

The workflow is as follows:

Rotary Encoder
|
| Digital (GPIO)
v
Input Acquisition Module
|
v
Processing Pipeline (STM32U545)
|
+--[ GPIO ]-----------> 4-Channel Relay Module
| |
| +--[ Power ]<-- External Battery Pack
| |
| v
| Mini Submersible Pumps
v
Rendering Engine -> [ I2C ] -> 0.96" OLED Screen

Log

Week 5 - 6

  • Researched the required hardware components and placed orders.
  • Analyzed the electrical requirements for the pumps and relay isolation.

Week 7

  • Tested each water pump individually using an external power source to ensure they are functional.
  • Verified the relay switching logic to ensure safe operation with the microcontroller.

Week 8 - 9

  • Soldered the components.
  • Built the initial physical circuit, wiring the STM32, relay module, and OLED screen.
  • Tested all the components on their own.

Hardware

The system is centered around an STM32 NUCLEO-U545RE-Q microcontroller. For user interaction, I am using a 0.96" OLED display (SSD1306 controller) communicating via I2C, and a KY-040 rotary encoder connected through digital GPIOs with hardware interrupts for precise tracking.

The fluid control system consists of three 5V DC mini submersible pumps, each driven by a channel of a 4-channel relay module. The relays provide galvanic isolation between the MCU's logic and the inductive load of the pumps. Power is split into two domains: the STM32 is powered via USB, while the pumps are driven by an external 6V battery pack (4x AA). All connections are made using Dupont wires on a standard 830-point breadboard, with additional current-limiting resistors where necessary.

Schematics

Rotary Encoder(CLK, DT, SW - GPIO)STM32 NUCLEO-U545RE-QMain Controller0.96" OLED Screen(I2C - SDA, SCL)Relay Module(Digital / GPIO)Water Pumps(Ext. Battery Powered)

Bill of Materials

DeviceUsagePrice
STM32 NUCLEO-U545RE-QThe main microcontroller~160 RON
3x Mini Submersible Pumps 5VPumping liquid from jars~30 RON
1x 4-Channel Relay 5VIsolating and switching the pumps~15 RON
OLED Display 0.96" I2CUser interface screen~17 RON
KY-040 Rotary EncoderMenu navigation knob~6 RON
4x AA Battery HolderPowering the pumps~7 RON
Silicone Tubing 3x5mmTransporting the liquid~5 RON
40x Dupont wires (male-male)Circuit connections~8 RON

Software

LibraryDescriptionUsage
embassy-stm32Hardware Abstraction LayerCore hardware control
embassy-executorAsync ExecutorRunning non-blocking tasks
ssd1306Display driverControlling the OLED screen
embedded-graphics2D graphics libraryDrawing text and shapes
rotary-encoder-halHardware driverDecoding knob turns
  1. Embassy-rs Documentation - The official book for the async framework used.
  2. STM32U545 Datasheet - Technical details for our specific MCU.
  3. SSD1306 Rust Driver - Documentation for the OLED screen library.
  4. Embedded Rust Book - General guide for Rust on microcontrollers.