Skip to main content
Version: ACS CC

Mini Vending Machine

A vending machine that releases products after validating user payments and selections.

info

Author: Rizescu Delia Maria
GitHub Project Link: https://github.com/UPB-PMRust-Students/acs-project-2026-Xdelia11

Description

The system receives user input through push buttons, each corresponding to a specific product selection. An STM32 microcontroller acts as the central processing unit, responsible for validating the inserted credit and checking product availability. If the selected item is out of stock or the transaction cannot be completed, the system rejects the inserted coin. When all conditions are met, the microcontroller controls a stepper motor that drives a spiral mechanism to dispense the chosen product. Additionally, the system features an LCD display that provides real-time messages to the user, including payment confirmation, product selection prompts, and error notifications.

Motivation

I chose this project because it brings together multiple important concepts from both hardware and software in a practical context. I find it particularly interesting to work on a product that is already part of everyday life and explore ways to improve it. This project also gives me the opportunity to expand my understanding of Rust in a real-world scenario while designing a system that is both useful and engaging.

Architecture

The project is divided into a few main parts that work together.

Main Architectural Components:

  1. Payment Processing Unit (Input)
  • Role: Handles credit validation.
  • Components: RFID RC522 (digital payment) and Limit Switch (physical coin detection)
  1. User Interface (I/O)
  • Role: Responsible for user selections and provides feedback.
  • Components: 4x Push Buttons, LCD and Passive Buzzer.
  1. Dispensing and Change System (Output)
  • Logic: Manages the mechanical release of products and the return of change.
  • Components: 4x Stepper Motors and SG90 Servo (coin release).

Architecture Diagram

Log

Week 20 - 26 April

  • Researche suitable motors for the project, as well as how to implement the coin detection system and the change mechanism.
  • Order hardware components.

Week 27 April - 3 May

  • Designed and built the vending machine structure, featuring four product compartments, with two compartments on each row.

Week 4 - 10 May

  • Assembled the hardware components inside the vending machine structure and completed the breadboard wiring.

Hardware

The vending machine is controlled by an STM32U5 microcontroller that manages all system operations. It integrates an MFRC522 RFID reader and push buttons for inputs, while using an I2C LCD 1602 for the display. The physical dispensing is handled by four stepper motors and the coin-return mechanism is driven by a servo motor.

  • STM32U545 Nucleo: The central microcontroller that executes the Rust firmware to process the system logic and coordinate all other parts.

  • MFRC522 RFID Reader: An SPI-based card scanner used to authorize admin transactions.

  • 28BYJ-48 Stepper Motors & ULN2003 Drivers: Used to rotate the dispensing spirals inside the compartments.

  • LCD 1602 Display with PCF8574 I2C Adapter: Provides real-time instructions, credit status, and feedback using only two I2C wires.

  • SG90 Servo Motor: A micro servo used to operate the physical change coin mechanism.

  • Push Buttons & Limit Switch: Act as the physical user interface for product selection and mechanical coin detection.

circuit circuit circuit

Schematics

Schematics

Bill of Materials

DeviceUsagePrice
STM32The microcontrollerProvided by faculty
Endstop limit switchUsed as a coin detector5.23 RON
Motor StepperUsed to rotate the dispensing spirals inside the vending machine4 X 10.29 RON
Driver motor stepperA stepper motor driver boosts STM32 signals to power the motor3 X 4.53 RON
RFIDUsed to scan admin cards to grant free product9.53 RON
WiresUsed to create all electrical connections31.96 RON
I2C LCD InterfaceAn I2C LCD interface changes a parallel connection into a 2-wire serial connection, saving STM32 pins5.11 RON
LCD 1602 DisplayUsed to show user instructions, current credit, product selection11.18 RON
Breadoard 400Used to distribute power and connect components2 X 6.62 RON
Servomotor SG90Used for the change mechanism that dispenses coins back to the user9.49 RON
Push Buttons, 12x12x7.3mmUsed as product selection buttons4 X 1.33 RON
Buzzer pasivUsed to generate acoustic feedback5.03 RON
Total155.37 RON

Software

LibraryDescriptionUsage
embassy-stm32STM32 driver libraryConfigures GPIO, I2C, SPI, and PWM.
embassy-executorAsync executorUsed for running the async main loop.
embassy-timeAsync time utilitiesUsed for non-blocking delays.
defmtEmbedded debugging toolUsed for debug and info.
defmt-rttRTT transport for defmtUsed to transmit defmt logs over the debug probe.
heaplessStatic data structuresAllocates text buffers for the LCD display.
panic-probePanic handler for debuggingPrints error info.
  1. Hardware Ideas and Design
  2. Lab Support
  3. DIY Coin Dispenser
  4. Vending Machine Mechanism