Skip to content

Commit 56694b0

Browse files
Project/sebastian.marcu (#1283)
* Add project documentation * Add project schematic * Add project schematic * Replace schematic with optimised webp * Fix schematic resolution * Add schematic to the documentation * Add schematic to documentation * Update schematic to documentation * Update final project documentation * Update architecture diagram * Validation push
1 parent c333ef5 commit 56694b0

3 files changed

Lines changed: 70 additions & 90 deletions

File tree

website/versioned_docs/version-acs_cc/project/2026/sebastian.marcu/images/parking_sensor_architecture.svg

Lines changed: 0 additions & 45 deletions
This file was deleted.
15.5 KB
Loading

website/versioned_docs/version-acs_cc/project/2026/sebastian.marcu/index.md

Lines changed: 70 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,90 +14,115 @@ An embedded parking assistance system that measures the distance to nearby obsta
1414

1515
## Description
1616

17-
This project implements a smart parking sensor using an STM32 development board and an ultrasonic distance sensor. The system periodically measures the distance between the sensor and a nearby obstacle. Based on this distance, the microcontroller controls multiple LEDs and a buzzer to warn the user. As the obstacle gets closer, the warning level increases through different LED states and faster or continuous buzzer signals.
17+
This project implements a smart parking assistance system using an STM32 Nucleo-U545RE-Q board and an HC-SR04 ultrasonic distance sensor. The system measures the distance between the sensor and an obstacle placed in front of it and provides real-time feedback through six LEDs, an active buzzer, and an OLED I2C display.
18+
19+
The warning level changes progressively as the obstacle gets closer. The LEDs indicate the current distance range using green, yellow, and red stages, while the buzzer increases its alert frequency and becomes continuous when the obstacle is very close. The OLED display shows the current warning state and the measured distance in centimeters.
1820

1921
---
2022

2123
## Motivation
2224

23-
Parking in tight spaces can be difficult without a clear estimation of the distance to obstacles. Modern cars often use parking sensors to help the driver avoid collisions. This project recreates a simplified version of such a system and provides a practical way to work with sensors, GPIO control, timing, distance computation, and real-time embedded feedback.
25+
Parking sensors are commonly used in modern vehicles to help drivers estimate the distance to nearby obstacles and avoid collisions. This project recreates a simplified but functional version of such a system using embedded hardware.
26+
27+
The main purpose of the project is to combine sensor acquisition, GPIO control, I2C communication, real-time timing, and user feedback into a complete embedded application. Compared to the initial version, the final implementation provides more detailed feedback by using six LEDs, a buzzer driver circuit, and an OLED display.
2428

2529
---
2630

2731
## Architecture
2832

29-
![Architecture](./images/parking_sensor_architecture.svg)
33+
The system is built around the STM32 Nucleo-U545RE-Q microcontroller board. The HC-SR04 ultrasonic sensor is used as the input module. The STM32 sends a trigger pulse to the sensor and measures the echo pulse duration in order to compute the distance.
3034

31-
The system is built around the STM32 microcontroller, which coordinates all modules.
35+
The measured distance is then classified into one of several warning states. Based on the selected state, the STM32 controls six LEDs, the buzzer output, and the OLED text display.
3236

33-
- **Input:** ultrasonic sensor used for distance measurement
34-
- **Processing:** STM32 microcontroller computes distance and decides the warning level
35-
- **Output:** LEDs and buzzer provide visual and audio feedback
37+
The system uses:
38+
- **GPIO output** for the trigger pin, LEDs, and buzzer control
39+
- **GPIO input** for the echo signal
40+
- **I2C communication** for the OLED display
41+
- **software timing** for ultrasonic measurement, LED blinking, and buzzer patterns
3642

37-
The ultrasonic sensor is triggered by the microcontroller. The echo response is measured using timing logic, then converted into distance. Depending on the result, the system selects one of several warning states: safe, attention, close, or stop.
43+
The HC-SR04 echo signal is connected through a voltage divider before reaching the STM32 input pin, because the sensor may output 5V while the STM32 uses 3.3V logic. The buzzer is controlled using a BC547 transistor, so the microcontroller pin does not drive it directly.
3844

3945
---
4046

4147
## Hardware
4248

43-
The hardware part of the project consists of an STM32 development board connected to an ultrasonic distance sensor, several LEDs, and a buzzer. The LEDs indicate the warning level visually, while the buzzer provides audio feedback. The system will be assembled on a breadboard using jumper wires and current-limiting resistors for the LEDs.
49+
![Schematic](./images/schematic.webp)
50+
51+
The hardware implementation uses an STM32 Nucleo-U545RE-Q board as the main controller. The HC-SR04 ultrasonic sensor is connected using one trigger pin and one echo pin. Since the echo signal can reach 5V, a voltage divider is used to adapt the signal to the 3.3V logic level accepted by the STM32.
52+
53+
The visual feedback system consists of six LEDs:
54+
- two green LEDs for safe distances
55+
- two yellow LEDs for warning distances
56+
- two red LEDs for danger and stop states
57+
58+
Each LED is connected through a current-limiting resistor. The buzzer is driven through a BC547 transistor, with a diode used for protection in the driver circuit. The OLED display is connected through the I2C interface and is used to display both the current state and the measured distance.
59+
60+
Main pin usage:
61+
- **PB3**: HC-SR04 trigger
62+
- **PC8**: HC-SR04 echo
63+
- **PC7, PB5**: green LEDs
64+
- **PC6, PB4**: yellow LEDs
65+
- **PC9, PA8**: red LEDs
66+
- **PB10**: buzzer driver
67+
- **PB6 / PB7**: I2C SCL / SDA for OLED
4468

4569
---
4670

4771
## Bill of Materials
4872

4973
| Device | Usage | Estimated Price |
5074
|---|---|---|
51-
| STM32 development board | Main microcontroller | Provided |
75+
| STM32 Nucleo-U545RE-Q | Main microcontroller board | Provided |
5276
| HC-SR04 ultrasonic sensor | Distance measurement | ~10 RON |
53-
| Green LED | Safe distance indicator | ~1 RON |
54-
| Yellow LED | Medium distance indicator | ~1 RON |
55-
| Red LED | Close obstacle indicator | ~1 RON |
77+
| OLED I2C display | Displays state and measured distance | ~30 RON |
78+
| Green LEDs (x2) | Safe distance visual feedback | ~2 RON |
79+
| Yellow LEDs (x2) | Warning distance visual feedback | ~2 RON |
80+
| Red LEDs (x2) | Danger / stop visual feedback | ~2 RON |
5681
| Active buzzer | Audio warning signal | ~5 RON |
57-
| Resistors 220Ω / 330Ω | LED current limiting | ~3 RON |
58-
| Breadboard | Circuit prototyping | ~10 RON |
59-
| Jumper wires | Electrical connections | ~5 RON |
60-
| USB cable | Programming and power | Already available |
61-
62-
Optional components, if time allows:
63-
64-
| Device | Usage | Estimated Price |
65-
|---|---|---|
66-
| LCD 16x2 with I2C module | Display exact distance | ~20 RON |
67-
| Potentiometer | Adjustable sensitivity threshold | ~5 RON |
82+
| BC547 transistor | Buzzer driver | ~2 RON |
83+
| Diode | Driver circuit protection | ~5 RON |
84+
| Resistors | LED current limiting and voltage divider | ~15 RON |
85+
| Breadboard | Circuit prototyping | ~15 RON |
86+
| Male-male jumper wires | Breadboard connections | ~30 RON |
87+
| Male-female jumper wires | Sensor/display/module connections | ~10 RON |
88+
| USB cable | Programming and powering the board | Already available |
6889

6990
---
7091

7192
## Software
7293

73-
The software periodically sends a trigger pulse to the ultrasonic sensor and measures the duration of the echo signal. This duration is converted into distance. The measured distance is then compared with predefined thresholds.
94+
The project is written in Rust and uses the Embassy framework. The application runs without a standard library and uses the STM32 hardware abstraction provided by `embassy-stm32`.
7495

75-
Possible states:
76-
- **Safe:** obstacle is far away, green LED active, buzzer off
77-
- **Attention:** obstacle is at medium distance, yellow LED active, slow buzzer beeps
78-
- **Close:** obstacle is near, red LED active, fast buzzer beeps
79-
- **Stop:** obstacle is very close, red LED active, continuous buzzer signal
96+
The software periodically triggers the HC-SR04 sensor and measures the echo pulse duration. The distance is computed using the standard ultrasonic approximation:
8097

81-
The implementation will use GPIO pins for LEDs and buzzer control, and timing mechanisms for measuring the ultrasonic echo signal.
98+
```text
99+
distance_cm = echo_time_us / 58
100+
```
82101

83-
---
84-
85-
## Log
102+
The measured value is then mapped to one of the following states:
86103

87-
**Week 1**
88-
- Project idea selected and approved
89-
- Initial documentation created
90-
- Basic architecture and component list defined
104+
| Distance range | State | LED behavior | Buzzer behavior |
105+
|---|---|---|---|
106+
| > 150 cm | Safe | Two green LEDs on | Rare beep |
107+
| 150 - 120 cm | Safe | One green LED on | Slow beep |
108+
| 120 - 90 cm | Caution | One green LED blinking | Medium beep |
109+
| 90 - 70 cm | Warning | One yellow LED on | Alert beep |
110+
| 70 - 50 cm | Close | Two yellow LEDs on | Fast beep |
111+
| 50 - 30 cm | Close | Two yellow LEDs blinking | Fast beep |
112+
| 30 - 20 cm | Danger | One red LED blinking | Very fast beep |
113+
| 20 - 10 cm | Danger | One red LED on | Very fast beep |
114+
| < 10 cm | Stop | Two red LEDs on | Continuous alarm |
91115

92-
---
116+
If no valid echo signal is received, the system enters a `NoSignal` state and blinks the yellow and red LEDs to indicate a sensor problem.
93117

94-
## Future Improvements
118+
The OLED display is controlled through I2C at address `0x3C`. It shows the current warning state, LED behavior, and measured distance. To reduce flicker, the display is not fully refreshed every cycle; the distance value is updated separately from the state header.
95119

96-
- Add LCD display for showing the measured distance
97-
- Add filtering to reduce unstable sensor readings
98-
- Add adjustable thresholds using a potentiometer
99-
- Design a small enclosure for a cleaner final prototype
100-
- Add serial logging for debugging and testing
120+
The main software modules are:
121+
- sensor triggering and echo measurement
122+
- distance-to-state classification
123+
- LED and buzzer output control
124+
- OLED initialization and text rendering
125+
- simple state-based UI updates
101126

102127
---
103128

0 commit comments

Comments
 (0)