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.
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:
| Component | Interface | STM32 Pins |
|---|---|---|
| 0.96" OLED Display | I2C | SDA / SCL (TBD) |
| DFPlayer Mini | UART | TX / RX (TBD) |
| SG90 Servo Motor | PWM | PWM Output (TBD) |
| HC-SR04 Sensor | GPIO | Trig / Echo (TBD) |
| RGB LED | GPIO / PWM | R, G, B pins (TBD) |
| Push Buttons | GPIO | Digital 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.



Schematics
Bill of Materials
| Device | Usage | Price |
|---|---|---|
| STM32 Nucleo-U545RE-Q | The microcontroller | 106.00 RON |
| HC-SR04 Ultrasonic Sensor | Distance measurement | 6.09 RON |
| RGB LED (Common Cathode) | Visual feedback | 2.97 RON |
| 220Ω Resistor 0.25W | Current limiting for LEDs | 0.90 RON |
| 0.96" SSD1306 OLED Display (I2C) | Display output | 18.98 RON |
| DFPlayer Mini MP3 Module | Audio playback | 12.42 RON |
| MicroSD Card 2GB | Audio storage | 39.90 RON |
| USB Card Reader | Writing data to MicroSD | 12.10 RON |
| 8Ω 1W Speaker | Audio output | 6.32 RON |
| SG90 Micro Servo Motor | Mechanical movement of barrier | 9.99 RON |
| Push Button | User input | 0.36 RON |
| Male-Male Jumper Wires | Connections | 7.99 RON |
| Male-Female Jumper Wires | Connections | 7.99 RON |
| Breadboard (400 points) | Prototyping | 20.97 |
| [Barrier] | Mechanical structure | [have_not_bought_yet] |
Software
| Library / Interface | Description | Usage |
|---|---|---|
| embassy-stm32 | Embassy HAL for STM32 | I2C (OLED), UART (DFPlayer), PWM (Servo), GPIO (HC-SR04, Buttons, LED), RNG |
| embassy-executor | Async task executor | Concurrently running the 30-second timer, sensor polling, and display updates |
| embassy-time | Timers and delays | Handling the 30-second logic, ultrasonic timeouts, and button debouncing |
| embedded-hal | Hardware Abstraction Layer traits | Standardized interfaces for the peripheral drivers |
| ssd1306 | OLED display driver | Initialization and framebuffer management for the 0.96" display |
| embedded-graphics | 2D graphics library | Drawing text, shapes, and distance metrics on the OLED |
| Hardware RNG | Random Number Generator driver | Generating random values |
| UART / USART | Serial communication interface | Sending hexadecimal command packets to the DFPlayer Mini |
| TIM / PWM | Timer / Pulse Width Modulation | Generating specific duty cycles to control the SG90 servo motor angle |