Rusty Coffee
An automated coffee machine in which you can schedule your coffee and customize it to your heart's desire.
Author: Lucian-Stefan Lesu
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-Lluke18
Description
This smart coffee machine has lots of additional features and options when it comes to brewing your favorite refreshing hot drink - coffee. It also has a pulse sensor that, if your pulse is too high, won’t let you drink any coffee!
Motivation
Because I love coffee. Of course, I'm not addicted.
Architecture
Rusty Coffee is a smart, real-time espresso machine powered by an STM32 microcontroller running the Embassy async RTOS. By utilizing concurrent background tasks, the system seamlessly manages a custom touchscreen interface, wireless Bluetooth overrides, and a precision thermal controller simultaneously, ensuring the UI never lags or freezes.
The machine features a unique dual-sensor safety interlock. Before dispensing, an ultrasonic sensor physically verifies that a mug is present, while a medical-grade pulse oximeter acts as a biometric gatekeeper—calculating a real-time rolling average of the user's heart rate to ensure it is at a safe level. Once cleared, a software-defined PID algorithm dynamically pulses a high-voltage Solid State Relay, locking the espresso boiler precisely at 98.0°C for the perfect extraction.
Some photos of the project:
Log
13 - 19 April
The main Stm32 arrived from mouser. Tested it, and everything works fine. I disassembled the coffee machine that I bought for the heating element. At the lab, I'll desolder the wires connected to the relay module so that I can connect it to a way cooler one.
20 - 26 April
The rest of the components arrived. Aside from the pulse sensor, which doesn't work, apparently, everything seems to be good. Also, I started connecting the display. The LCD looks good, I started with basic shapes from the embedded graphics library. In the future, I'll also have to implement the touch component.
27 - 3 May
I finally managed to connect the touch as well. I had to be careful, because apparently the max freq of the touch chip is only 5Mhz, while the screen can go up to much higher. I also implemented the ultrasonic sensor, which was easy work.
4 - 10 May
Ok so I connected the thermocouple as near as I could get it to the heating element. I was lucky, as the coffee machine I bought ( the cheapest one I found, obviously...) had a little knob in which I fitted the screw. On the other end, I connected it to the max31855 module (it's basically a special ADC and amplifier for the signal)
11 - 17 May
Focused more on code, and also connected the newly arrived max30102 SPO2 sensor (thx Roy for the recommendation).
18 - 24 May
I managed to connect the bluetooth module as well (thx Mircea for the trade!). I also connected the lower voltage part of the SSR. Other than that, I wrote more code...
25 - 31 May
Time to bring it all together. I did the final connections of the heating element, using Lexman(basically Wago knockoffs) connectors. I also connected the 230V part to the heating element. I made extra sure everything is safe by isolating it with special tape. Finally, I Screwed the coffee machine back together. Well, let's hope it works at the Pm fair.
Hardware
- STM32U545 microcontroller
- max30102 sensor
- TFT LCD Touchscreen
- heating element + case from a pre-existing coffee machine
- HC-SR04 ultrasonic sensor
- HC-05 bluetooth module
- type K thermocouple
- max31855 thermocouple module
- DA solid state relay
Schematics
Bill of Materials
Software
| Library | Description | Usage |
|---|---|---|
| mipidsi | Display driver for ST7789 | Used for the custom display of the coffee machine |
| embedded-graphics | 2D graphics library | Used for drawing to the display |
| max3010x | pulse sensor library | The strictly typed I2C driver configured for 18-bit Pw411 resolution and FIFO rollover to read the optical pulse data. |
| pid | PID library | The mathematical controller calculating the exact PWM duty cycle needed to hold the boiler at 90.0°C |
| heapless | heapless library | Providing statically allocated String and Vec buffers so the system never panics from dynamic memory allocation failures. |
| pid | PID library | The mathematical controller calculating the exact PWM duty cycle needed to hold the boiler at 90.0°C |
| defmt | Deferred formatting logging framework | Providing ultra-fast, low-overhead logging for the pulse sensor diagnostics, touch interactions, and Bluetooth commands over your hardware debug probe. |
| embassy | Async embedded framework for Rust | Providing the real-time task scheduler (embassy-executor), timers (embassy-time), and hardware drivers (embassy-stm32) for the I2C, SPI, and UART peripherals. |
| embassy-sync | Async synchronization primitives | Managing the Watch variables (ALARM_TIME, LATEST_BPM, BREW_ACTIVE) to safely share state between the Bluetooth, Pulse, and Main UI tasks without locking up the CPU. |