-
Notifications
You must be signed in to change notification settings - Fork 527
Documentatie Proiect PM #977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
horatiuoprea
wants to merge
12
commits into
UPB-PMRust:main
Choose a base branch
from
horatiuoprea:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f651104
first_comm
horatiuoprea 2eaa23a
add deadline
github-classroom[bot] 5a0e03d
Asign Repo
horatiuoprea 9399e69
Merge branch 'UPB-PMRust:main' into project/horatiu.oprea
horatiuoprea d47c024
Merge branch 'main' of https://github.com/horatiuoprea/website
horatiuoprea f20e777
solved remote merge
horatiuoprea d0c5541
Merge branch 'main' into project/horatiu.oprea
horatiuoprea b2a9621
Project documentation starter
horatiuoprea ebeed65
Documentatie
horatiuoprea 5e33137
Merge branch 'main' into project/horatiu.oprea
irina-b-dev 64b0f5b
Final Documentation
horatiuoprea 990f2d3
Rezolvare Conflicte
horatiuoprea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| # MA Website | ||
|
|
||
| This is the website for the MA course delivered to ACS CC and FILS English. | ||
|
|
||
| [](https://classroom.github.com/a/yNS7YZsE) |
4 changes: 4 additions & 0 deletions
4
..._docs/version-acs_cc/project/2026/horatiu.oprea/Architecture_Diagram.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
...sioned_docs/version-acs_cc/project/2026/horatiu.oprea/Diagrama_Kicad.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
...ersioned_docs/version-acs_cc/project/2026/horatiu.oprea/Documentatie.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+72.1 KB
website/versioned_docs/version-acs_cc/project/2026/horatiu.oprea/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions
108
website/versioned_docs/version-acs_cc/project/2026/horatiu.oprea/index.md
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use the template for the project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| # Ping-Pong Ball Levitation — Wind Tube PID Controller | ||
|
|
||
| :::info | ||
|
|
||
| **Author**: Oprea Horatiu Alexandru \ | ||
| **Group**: 332CC \ | ||
| **GitHub Project Link**: https://github.com/horatiuoprea/website.git | ||
|
|
||
| ::: | ||
|
|
||
| ## Description | ||
|
|
||
| The project maintains a Ping-Pong ball at a desired height inside a vertical wind tube. A laser distance sensor mounted at the top of the tube continuously measures the position of the ball. This measurement is fed into a PID regulator running on an STM32 microcontroller, which adjusts the speed of a propeller fan at the base of the tube to keep the ball stable at the target height. | ||
|
|
||
| The system supports two interaction modes. In **Auto mode**, the user sets the desired height via a dedicated potentiometer, and the PID controller autonomously stabilizes the ball at that height. In **Manual mode**, the user can adjust the three PID constants (Kp, Ki, Kd) individually using separate potentiometers, observing in real time how each parameter affects the system's behavior. An LCD display shows the current height and, depending on the active mode, the target height or the current PID constant values. | ||
|
|
||
| ## Motivation | ||
|
|
||
| Embedded systems and control theory are two domains I wanted to explore simultaneously in a hands-on project. A wind tube ball levitation system is a classic control engineering problem that is visually intuitive, physically tangible, and technically rich. It requires real sensor integration, PWM motor control, I2C communication, and a properly tuned closed-loop PID controller — all implemented in Rust using the Embassy async framework on an STM32 microcontroller. The manual mode adds an educational dimension, allowing direct observation of how each PID term influences system stability, which reinforces the theoretical concepts from control systems courses. | ||
|
|
||
| ## Architecture | ||
|
|
||
| The system is structured around 4 main architectural components that form a closed control loop: | ||
|
|
||
| **Sensor** — The VL53L0X laser Time-of-Flight sensor is mounted at the top of the tube and measures the distance to the ball via I2C. This gives the current height y(t). | ||
|
|
||
| **Controller** — The STM32 Nucleo-U545RE-Q runs the PID algorithm in an Embassy async task at a fixed 20ms cycle. It reads the current height from the sensor, computes the error relative to the target, and produces a control output u(t) in the range 0–100%. | ||
|
|
||
| **Actuator** — The Delta PFB0412EN-E fan receives a PWM signal at 25kHz directly on its dedicated blue wire. The duty cycle of this signal determines the fan speed, which controls the airflow and thus the ball's position. | ||
|
|
||
| **User Interface** — Four potentiometers provide analog inputs via ADC: one sets the target height in Auto Mode, and three adjust Kp, Ki, Kd in Manual mode. A ST7920 LCD displays system state using SPI. A toggle switch selects between Auto and Manual mode. | ||
|
|
||
| ## Architecture Diagram | ||
|
|
||
|  | ||
|
|
||
| ## Log | ||
|
|
||
| ### Week 6 - 12 April | ||
| **Chose the project task** | ||
|
|
||
| ### Week 13 - 19 April | ||
| **Initial Documentation** | ||
|
|
||
| ### Week 20 - 26 April | ||
| **Final Documentation** | ||
|
|
||
| ### Week 4 - 10 May | ||
| **Tested HW Components** | ||
|
|
||
| ### Week 11 - 17 May | ||
| **Built HW Part and Startet the SW Part** | ||
|
|
||
| ### Week 18 - 24 May | ||
| **Finished the SW Part and Final Design** | ||
|
|
||
| ## Hardware | ||
|
|
||
| The project uses an STM32 Nucleo-U545RE-Q (Cortex-M33) as the main microcontroller, programmed in Rust with the Embassy async framework. The VL53L0X laser ToF sensor communicates over I2C and provides distance measurements with millimeter precision. The Delta PFB0412EN-E axial fan (40x40x28mm, 12V) features a native PWM control input, allowing direct speed control from the STM32 without a MOSFET driver stage. Four 10kΩ potentiometers provide analog inputs for height target and PID tuning. A 1602 LCD with I2C backpack shares the I2C bus with the sensor. A toggle switch selects the operating mode. The fan is powered by a dedicated 12V DC adapter; the STM32 and all logic components are powered via USB (5V), with the onboard regulator supplying 3.3V to the sensor and potentiometers. All grounds are tied to a common reference on the breadboard. | ||
|
|
||
| ### Schematics | ||
|
|
||
|  | ||
|
|
||
| ### Bill of Materials | ||
|
|
||
| | Device | Usage | Price | | ||
| |--------|--------|-------| | ||
| | [STM32 Nucleo-U545RE-Q](https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html) | Main microcontroller — runs PID algorithm in Rust/Embassy | already owned | | ||
| | [VL53L0X Laser ToF Sensor](https://www.optimusdigital.ro/ro/senzori-senzori-de-distanta/3309-modul-senzor-de-distanta-cu-laser-vl53l0x.html) | Measures ball height inside the tube via I2C | [25 RON](https://www.optimusdigital.ro) | | ||
| | [Delta PFB0412EN-E Fan 12V](https://www.digikey.com) | Propeller fan — controls airflow in the tube via PWM | already owned | | ||
| | [LCD ST7920](https://www.optimusdigital.ro/ro/optoelectronice-lcd-uri/2894-lcd-cu-interfata-i2c-si-backlight-albastru.html) | Displays current height and PID constants | [15 RON](https://www.optimusdigital.ro) | | ||
| | Potentiometer 10kΩ (x4) | Height target (x1) + Kp, Ki, Kd tuning (x3) | [5 RON x4](https://www.optimusdigital.ro) | | ||
| | Toggle Switch | Selects Auto / Manual operating mode | [3 RON](https://www.optimusdigital.ro) | | ||
| | Breadboard MB102 - 830 pins | Prototyping platform with integrated power supply | [20 RON](https://www.optimusdigital.ro) | | ||
| | DC Jack Module 5.5x2.1mm (breadboard) | Connects 12V adapter to breadboard for fan power | [7 RON](https://www.optimusdigital.ro) | | ||
| | Resistor 100Ω | Protects STM32 PWM pin from fan input impedance | [1 RON](https://www.optimusdigital.ro) | | ||
| | Jumper Wire Kit (120 pcs) | All signal and power connections on breadboard | [15 RON](https://www.optimusdigital.ro) | | ||
| | 12V 1A DC Adapter | Powers the fan independently from STM32 logic | [25 RON](https://www.optimusdigital.ro) | | ||
| | PVC Tube 40-45mm inner diameter, ~80cm | Wind tube housing for the ball | [12 RON](https://www.dedeman.ro) | | ||
| | Digital Multimeter | Verifying voltages and connections during assembly | [50 RON](https://www.optimusdigital.ro) | | ||
|
|
||
| ## Software | ||
|
|
||
| | Library | Description | Usage | | ||
| |---------|-------------|-------| | ||
| | [embassy-stm32](https://github.com/embassy-rs/embassy) | Async HAL for STM32 microcontrollers | Peripheral access: PWM, I2C, ADC, GPIO | | ||
| | [embassy-executor](https://github.com/embassy-rs/embassy) | Async task executor for embedded systems | Runs sensor, control and display tasks concurrently | | ||
| | [embassy-time](https://github.com/embassy-rs/embassy) | Timers and delays for Embassy | Fixed 20ms control loop timing | | ||
| | [embassy-spi](https://github.com/UPB-PMRust/lab-solutions/tree/main/lab05) | Driver for ST7920-based LCD displays | Renders height and PID values | | ||
| | [vl53l0x](https://crates.io/crates/vl53l0x) | Driver for VL53L0X ToF sensor | Reads ball distance over I2C | | ||
| | [defmt](https://github.com/knurling-rs/defmt) | Efficient logging framework for embedded Rust | Debug output during development via RTT | | ||
| | [defmt-rtt](https://github.com/knurling-rs/defmt) | RTT transport for defmt | Sends log messages to host over USB | | ||
| | [panic-probe](https://github.com/knurling-rs/panic-probe) | Panic handler for embedded Rust | Reports panics via defmt | | ||
|
|
||
| ## Closed Control Loop | ||
|
|
||
|  | ||
|
|
||
| ## Links | ||
|
|
||
| 1. [Embassy — Async framework for embedded Rust](https://embassy.dev) | ||
| 2. [VL53L0X — STMicroelectronics ToF sensor datasheet](https://www.st.com/resource/en/datasheet/vl53l0x.pdf) | ||
| 3. [Delta PFB0412EN-E — Fan datasheet](https://www.delta-fan.com) | ||
| 4. [PID Controller — Wikipedia](https://en.wikipedia.org/wiki/Proportional%E2%80%93integral%E2%80%93derivative_controller) | ||
| 5. [Ball in tube levitation — reference project](https://example.com) | ||
| 6. [STM32U5 Reference Manual](https://www.st.com/resource/en/reference_manual/rm0456-stm32u5-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf) | ||
| 7. [Source Code Repository](https://github.com/UPB-PMRust-Students/acs-project-2026-horatiuoprea.git) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this change from this PR