Skip to main content
Version: FILS English

RustParking

An embedded project that simulates a real-life parking, using a barrier to allow cars to enter and exit a parking lot

info

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

System 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

DeviceUsagePrice
[STM32-NUCLEO-U545RE-Q]microcontrollerborrowed from politehnica
HC-SRO4 ultrasonic sensor x 2measuring distance from barrier36 Lei
SG90 servo motor x 4moving the barrier48 Lei
ESP32-CAMchecks vehicles for authorization67 Lei
Breadboard kitConnecting components124 Lei
female-male wiresconnecting components1 Leu
female-female wiresconnectign components2 Lei
4xAA battery holderholding batteries for power8 lei

Software

LibraryDescriptionUsage
embassy-stm32async HAL for STM32 microcontrollerscontrols PWM(servo, sensor), UART (ESP32), GPIO
embassy-timetiming and delay for embassy projectsused for delays, timing measurements, ultrasonic echo timing and servo contorl intervals
embassy-executorasync task executorruns synchronous tasks, currently servomotor control and readinf of ultrasonic sensor
embassy-embedded-halcompatibility between embassy and embedded-halembedded hardware abstraction suport
embassy-syncsyncronization for async embedded programsfor sharing data safely between async tasks
embedded-halhardware abstraction for embedded rustPWM traits like enablind PWM and setting duty cycle
defmtlogging for embedded rustprint debugging information like sensor state, distances from sensor, system status
defmt-rrtrrt backend for defmtsend debug logs from STM to laptop
panic-probepanic handlerused to report problems during debuggging
cortex-mlow level support for microcontrolleracces to STM32 features
cortex-m-rtruntime support for cortex-m microcontrollersprovides runtime support

coming soon