Skip to main content
Version: FILS English

Precision Parking Simulator

A smart parking assistant that detects vehicles, controls access via a physical barrier, provides visual feedback through RGB leds, and plays contextual audio cues.

info

Author: Netoiu Oana-Mihaela
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-oanaNetoiu

Description

The Automated Parking Barrier System is built around an STM32 microcontroller that orchestrates multiple peripherals to simulate a smart parking gate. An HC-SR04 ultrasonic sensor monitors the distance of an approaching vehicle. The distance at which the vehicle is and at which it must be are displayed on a 0.96" OLED screen. Based on the distance, the system controls an SG90 servo motor to raise or lower a physical barrier. Visual alerts are provided via an RGB LED, while a DFPlayer Mini MP3 module plays specific audio files (e.g., successful parking, collision warning) through a 1W 8-Ohm speaker, if the 30 second timer runs out.

Motivation

I chose this project as a fun way to implement the core concepts learned during the labs, such as asynchronous task management with the Embassy framework, peripheral interfacing via I2C and UART, and hardware control through PWM and GPIO. Although my project is a simple simulation, it serves as a crucial exercise in peripheral orchestration and concurrency. I intended to better understand how sensors, actuators, and communication modules interact within a safety-first Rust environment in order to enhance the complexity of my future projects.

Architecture

The STM32 interfaces with the components using the following protocols:

  • I2C Bus: Drives the 0.96" OLED Display for rendering text and basic UI elements.
  • UART: Communicates with the DFPlayer Mini to trigger specific audio tracks from the microSD card.
  • PWM: Controls the angle of the SG90 servo motor to simulate the physical barrier movement.
  • GPIO:
    • HC-SR04 ultrasonic sensor (Trigger pin as output, Echo pin as input).
    • RGB LED pins for visual state indication.
    • Push buttons for manual override or interaction.

Component Connections:

ComponentInterfaceSTM32 Pins
0.96" OLED DisplayI2CSDA / SCL (TBD)
DFPlayer MiniUARTTX / RX (TBD)
SG90 Servo MotorPWMPWM Output (TBD)
HC-SR04 SensorGPIOTrig / Echo (TBD)
RGB LEDGPIO / PWMR, G, B pins (TBD)
Push ButtonsGPIODigital inputs (TBD)

Log

Week 1-4

I started doing research on potential project ideas and what software and hardware I would need for them. At last, I chose the final project idea and started focusing on it.

Week 5-8

Ordered all the hardware components from multiple suppliers. Set up the Rust development environment and initialized the project using the Embassy framework. Prepared the microSD card by formatting it to FAT32 and organizing the audio cues for the DFPlayer Mini. Designed the visual layout for the OLED display and the state machine logic for the 30-second timer while awaiting delivery.

Week 9

Received all the hardware components, including the STM32 Nucleo board. Unboxed and organized the components for assembly. Verified the pinout compatibility between the Nucleo-U545RE-Q and the peripheral modules. Started the initial hardware assembly on the breadboards and began the first connectivity tests for the power rails and basic GPIO.

Weeks 10-11

Finished the whole hardware assembly and the KiCad Schematic after receiving all the components. I will probably change the jumper wires to shorter ones or rigid ones for a more organized look.

Hardware

The core of the project is the STM32 Nucleo-U545RE-Q board. The visual interface is handled by a 0.96" I2C OLED display. Distance detection is measured by the HC-SR04 ultrasonic sensor, which dictates the state of the SG90 180-degree servo motor, controlling the barrier. Audio feedback is processed by a DFPlayer Mini MP3 module reading from a FAT32-formatted microSD card, outputting to a 1W 8-Ohm speaker. Visual feedback is provided by 3 common-cathode RGB LEDs, and manual inputs are handled by the 6x6x6 push button. The circuit is prototyped on 3 400-point breadboards using standard Dupont jumper wires.

hardware image 1

hardware image 2

hardware image 3

Schematics

Schematic

Bill of Materials

DeviceUsagePrice
STM32 Nucleo-U545RE-QThe microcontroller106.00 RON
HC-SR04 Ultrasonic SensorDistance measurement6.09 RON
RGB LED (Common Cathode)Visual feedback2.97 RON
220Ω Resistor 0.25WCurrent limiting for LEDs0.90 RON
0.96" SSD1306 OLED Display (I2C)Display output18.98 RON
DFPlayer Mini MP3 ModuleAudio playback12.42 RON
MicroSD Card 2GBAudio storage39.90 RON
USB Card ReaderWriting data to MicroSD12.10 RON
8Ω 1W SpeakerAudio output6.32 RON
SG90 Micro Servo MotorMechanical movement of barrier9.99 RON
Push ButtonUser input0.36 RON
Male-Male Jumper WiresConnections7.99 RON
Male-Female Jumper WiresConnections7.99 RON
Breadboard (400 points)Prototyping20.97
[Barrier]Mechanical structure[have_not_bought_yet]

Software

Library / InterfaceDescriptionUsage
embassy-stm32Embassy HAL for STM32I2C (OLED), UART (DFPlayer), PWM (Servo), GPIO (HC-SR04, Buttons, LED), RNG
embassy-executorAsync task executorConcurrently running the 30-second timer, sensor polling, and display updates
embassy-timeTimers and delaysHandling the 30-second logic, ultrasonic timeouts, and button debouncing
embedded-halHardware Abstraction Layer traitsStandardized interfaces for the peripheral drivers
ssd1306OLED display driverInitialization and framebuffer management for the 0.96" display
embedded-graphics2D graphics libraryDrawing text, shapes, and distance metrics on the OLED
Hardware RNGRandom Number Generator driverGenerating random values
UART / USARTSerial communication interfaceSending hexadecimal command packets to the DFPlayer Mini
TIM / PWMTimer / Pulse Width ModulationGenerating specific duty cycles to control the SG90 servo motor angle
  1. Embassy async framework
  2. Embedded Rust 101 course labs
  3. Nucleo-U545RE-Q user manual
  4. SSD1306 Crate Documentation
  5. Embedded Graphics Library
  6. DFPlayer Mini Technical Manual
  7. HC-SR04 Ultrasonic Sensor Datasheet
  8. SG90 Servo Motor Specifications
  9. Embassy STM32 RNG Documentation