RustParking
An embedded project that simulates a real-life parking, using a barrier to allow cars to enter and exit a parking lot
Author: Tzikas Alexandros \
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-AlexTzikas
Description
This project is designed to be a model of a real-life parking; it uses two ultrasonic sensor to detect cars approaching a barrier (operated by a SG90 servomotor), both entering and exiting the parking, opening the barrier for exiting cars and opening the barrier for entering cars if they are authorized to enter, witch is ascertained by an ESP32-CAM. If the parking is full, the barrier will not open for any cars attempting to enter. The computations and processing are all done by the microcontroller (STM32-NUCLEO-U545RE-Q).
Motivation
I chose this project because it is a real-life application witch can help me learn rust better, as it help me understand subjects such as real-time sensor integration; it was also suggested to me by a coleague as beeing a reliable project idea.
Architecture
Input:
HC-SRO4 ultrasonic sensor will receive signals to see the ditance of a car from the sensor and will send the signals through a GPIO pin
ESP32-CAM will detect authorized vehicles trying to enter and send a signal when one is seen
Processing:
STM32-NUCLEO-U545RE-Q will do computations and signal processing and send data to the laptop via USB.
Output:
SG90 servomotor will receive signals to open/close a barrier when a car enters/exits
LED will be used to see that the system works properly
Log
Week 13 April - 19 April
I got the components (except the ESP32-CAM) and set up the start of my project (memory.x,cargo.toml,Config.toml,build.rs) and also created the GitHub page for the project
Week 20 April - 26 April
I got the rest of the components (the ESP32-CAM, some wires and a battery holder) and started assembling the project, starting with the servomotor; I wired the servomotor and wrote some code to test it, worked mostly fine, but each time would stop working after a while; suspected it was because of insuficient power so I decided to get some batteries for power. Afterwards wired the first sensor and started testing; had errors, as sensor would get stuck on high - did a lot of debugging to narrow down the problem (this log unfinished)
Hardware
picture coming soon
STM32-NUCLEO-U545RE-Q will do computatiosn, signals processing and transmit data to the laptop
HC-SRO4 ultrasonic sensor – a sensor witch receives and transmis signals to measure distance
SG90 servo motor will open/close the barrier
ESP32-CAM will scan incoming vehicles and check for authorization
LED will provide visual feedback during testing
Schematics
coming soon
Bill of Materials
| Device | Usage | Price |
|---|---|---|
| [STM32-NUCLEO-U545RE-Q] | microcontroller | borrowed from politehnica |
| HC-SRO4 ultrasonic sensor x 2 | measuring distance from barrier | 36 Lei |
| SG90 servo motor x 4 | moving the barrier | 48 Lei |
| ESP32-CAM | checks vehicles for authorization | 67 Lei |
| Breadboard kit | Connecting components | 124 Lei |
| female-male wires | connecting components | 1 Leu |
| female-female wires | connectign components | 2 Lei |
| 4xAA battery holder | holding batteries for power | 8 lei |
Software
| Library | Description | Usage |
|---|---|---|
| embassy-stm32 | async HAL for STM32 microcontrollers | controls PWM(servo, sensor), UART (ESP32), GPIO |
| embassy-time | timing and delay for embassy projects | used for delays, timing measurements, ultrasonic echo timing and servo contorl intervals |
| embassy-executor | async task executor | runs synchronous tasks, currently servomotor control and readinf of ultrasonic sensor |
| embassy-embedded-hal | compatibility between embassy and embedded-hal | embedded hardware abstraction suport |
| embassy-sync | syncronization for async embedded programs | for sharing data safely between async tasks |
| embedded-hal | hardware abstraction for embedded rust | PWM traits like enablind PWM and setting duty cycle |
| defmt | logging for embedded rust | print debugging information like sensor state, distances from sensor, system status |
| defmt-rrt | rrt backend for defmt | send debug logs from STM to laptop |
| panic-probe | panic handler | used to report problems during debuggging |
| cortex-m | low level support for microcontroller | acces to STM32 features |
| cortex-m-rt | runtime support for cortex-m microcontrollers | provides runtime support |
Links
coming soon