Skip to content

Commit 1bb1584

Browse files
Project/cristina.ion0109 (#1271)
* initial * initial2 * doc * varianta_schemablock * cu_schema_block * var4 * doc * add_schematics * schimbare_dim * +software * var
1 parent 428005e commit 1bb1584

1 file changed

Lines changed: 44 additions & 13 deletions

File tree

  • website/versioned_docs/version-acs_cc/project/2026/cristina.ion0109

website/versioned_docs/version-acs_cc/project/2026/cristina.ion0109/index.md

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,16 @@ I connected all hardware components. I verified all electrical connections.
4242

4343
I tested every module individually. I configured the Rust development environment and I started writing the initial firmware.
4444

45-
### Week 5 - 11 May
46-
4745
### Week 12 - 18 May
46+
I implemented the core game firmware using the Rust Embassy async framework.
47+
48+
I integrated all hardware components into asynchronous tasks. This includes LEDs, buttons, photoresistors, the potentiometer, the servo, and the buzzer.
49+
50+
I added the scoring logic and life tracking system. I implemented precise reaction time measurement for each round. I also configured the display to show real-time stats, rounds and game-over screens.
51+
52+
I implemented a comprehensive False Start detection system. It monitors all inputs simultaneously during the random waiting phase.
53+
54+
I have integrated audio feedback using the buzzer. The system now plays distinct sounds for correct and incorrect actions.
4855

4956
### Week 19 - 25 May
5057

@@ -56,13 +63,15 @@ Main parts:
5663
- STM32 Nucleo Board - This is the main controller of the device. It generates stimuli, reads inputs from buttons and sensors, measures reaction time, and manages the game logic, including scoring, error detection and game mode selection
5764
- LEDs - These are used as visual stimuli. When a specific LED lights up, the user must press the corresponding button as quickly as possible. They provide a simple and fast way to test reaction to visual signals
5865
- Buttons - These are the main input devices for the user. Each button corresponds to a specific action or stimulus. The system detects button presses and checks whether the response is correct and within the allowed time
59-
- Buzzer - This component generates audio stimuli. When a sound is played, the user must respond by rotating the potentiometer
66+
- Active Buzzer - This component generates audio stimuli. When a sound is played, the user must respond by rotating the potentiometer
67+
- Passive Buzzer - This component generates audio feedback based on game outcomes
6068
- Potentiometer - This component is used to detect user input. In response to certain stimuli (sound), the user must rotate the potentiometer. The STM32 reads its value and determines whether the action was performed correctly
6169
- Photoresistors - These sensors detect changes in light intensity. The system can display instructions such as covering a specific sensor, and the user must react
6270
- Servo Motor: The servo is used to create a mechanical stimulus by raising a small flag. When the flag is lifted, the user must press a specific button
6371
- Display (LCD): The display is used to show instructions, reaction times and game statistics. It also provides a menu for selecting the game mode and guides the user throughout the session
6472

6573

74+
6675
### Schematics
6776

6877
![Schematics](./pm_schema.svg)
@@ -87,35 +96,57 @@ The format is
8796
| [LED](https://www.drot.ro/platforma-arduino/1035-led-dioda-albastra-5-mm.html) | Stimulus | 0,44 RON |
8897
| [Potentiometer](https://www.drot.ro/platforma-arduino/7597-potentiometru-liniar-10k-ohm.html) | Analog input | 3,92 RON |
8998
| [Servomotor sg90](https://www.bitmi.ro/electronica/servomotor-sg90-180-grade-9g-10496.html#resp-tab2) | Stimulus | 9,99 RON |
90-
| [3 x Photoresistor](https://www.bitmi.ro/electronica/modul-senzor-cu-fotorezistor-ldr-compatibil-arduino-10394.html) | Light-dependent input | 2,43 RON |
99+
| [3 x Photoresistor](https://www.bitmi.ro/electronica/modul-senzor-cu-fotorezistor-ldr-compatibil-arduino-10394.html) | Light-dependent input | 3 x 2,43 RON |
100+
| [Passive buzzer](https://www.bitmi.ro/electronica/modul-buzzer-pasiv-ky-006-10678.html#resp-tab2) | Audio feedback | 2,99 RON |
91101
| [Active buzzer](https://www.bitmi.ro/electronica/modul-buzzer-activ-compatibil-arduino-10397.html) | Stimulus | 3,24 RON |
92-
| [Breadboard](https://www.bitmi.ro/electronica/breadboard-830-puncte-mb-102-10500.html) | - | 13,99 RON |
102+
| [Breadboard](https://www.bitmi.ro/electronica/breadboard-830-puncte-mb-102-10500.html) | For prototyping and power distribution | 13,99 RON |
103+
| [Breadboard](https://www.bitmi.ro/electronica/breadboard-400-puncte-pentru-montaje-electronice-rapide-10633.html) | For prototyping and power distribution | 6,99 RON |
93104
| [LCD Display](https://www.bitmi.ro/electronica/display-lcd1602-hd44780-albastru-iluminat-10486.html) | Human-Machine Interface | 13,99 RON |
94105
| [I2C LCD Interface Module](https://www.bitmi.ro/electronica/modul-interfata-i2c-pentru-lcd1602-10456.html) | I2C converter | 9,99 RON |
95106
| [Bidirectional Logic Level Converter](https://www.bitmi.ro/electronica/convertor-nivel-logic-iic-i2c-bidirectiona-4-canale-10462.html) | Logic level shifter | 2,99 RON |
96-
| [Buttons](https://www.drot.ro/platforma-arduino/1253-microswitch-buton-6-x-6-x-6-mm.html) | Digital inputs | 0,44 RON |
97-
| [Buttons](https://www.drot.ro/platforma-arduino/1180-mikroswitch-tc-1212t-12-x-12-x-7-3-mm-smd-pcb.html) | Digital inputs | 0,87 RON |
107+
| [Buttons](https://www.drot.ro/platforma-arduino/1180-mikroswitch-tc-1212t-12-x-12-x-7-3-mm-smd-pcb.html) | Digital inputs | 6 x 0,87 RON |
108+
| [Male-to-Male jumper wires](https://www.bitmi.ro/electronica/40-x-fire-dupont-tata-tata-20cm-10511.html) | For breadboard and peripheral connections | 8,99 RON |
109+
| [Male-to-Female jumper wires](https://www.bitmi.ro/electronica/40-x-fire-dupont-tata-mama-20cm-10512.html) | For breadboard and peripheral connections | 6,99 RON |
98110

99111

100112

113+
## Software
101114

115+
The firmware is built using Rust and the Embassy async framework, allowing efficient, non-blocking execution of multiple game elements simultaneously.
102116

117+
1. Centralized Game Management:
103118

119+
The core game loop operates as a finite state machine that coordinates the entire gameplay experience:
104120

121+
- It supports two distinct game modes: Normal Mode (a balanced gameplay experience with fixed, comfortable timeout windows for each round, allowing the player to focus on accuracy), Speed Mode (An intense mode where the system automatically reduces the timeout window as the player advances through rounds, demanding faster reaction times)
122+
- Random Round Selection: Dynamically switches between 4 distinct round types (LED, Potentiometer, Photoresistor, or Servo)
123+
- State & Life Tracking: Manages the player's lives, increments scores, and triggers the appropriate game-over or victory transitions
105124

125+
2. Multi-Peripheral Asynchronous Integration
106126

127+
- Inputs (Buttons & Servo Trigger): Managed through hardware interrupts (EXTI) and thread-safe signals (Signal) to capture user actions instantly
128+
- Outputs (Display & Buzzer Tasks): Run as independent background tasks that wait for instructions through Channel queues. This prevents screen updates and audio generation from freezing or lagging the main game logic
129+
- Analog Sensors (Potentiometer & Photoresistors): Sampled smoothly via the ADC during specific gameplay windows to accurately read light levels and potentiometer positions
130+
131+
3. Anti-Cheating - detect false start
132+
133+
An active monitoring system runs during the random waiting phase ("Get ready..."). It polls all hardware entry points simultaneously (buttons, potentiometer, and all 3 light sensors). By calculating the change of the analog inputs, it securely catches any premature movement or light alterations regardless of environmental conditions, instantly penalizing the player
107134

108-
## Software
109135

110136
| Library | Description | Usage |
111137
|---------|-------------|-------|
112-
| [st7789](https://github.com/almindor/st7789) | Display driver for ST7789 | Used for the display for the Pico Explorer Base |
113-
| [embedded-graphics](https://github.com/embedded-graphics/embedded-graphics) | 2D graphics library | Used for drawing to the display |
138+
| [embassy-stm32] | The main library that connects the Rust code to the STM32 hardware | Used to initialize and configure all physical pins and peripherals: ADC (sensors), PWM (servo/buzzer), I2C (display communication), and EXTI (interrupt-based buttons). |
139+
| [embassy-time] | Time management utilities for delays, timestamps, and intervals | Used for the sensor polling loops to catch cheating, enforcing maximum response deadlines (timeouts) for each round, and measuring the player's exact reaction time |
140+
| [embassy-executor] | The runtime task manager for asynchronous execution | Used to launch and run multiple separate tasks (like the game manager, display updates, and buzzer sounds) concurrently |
141+
| [embassy-futures] | Async flow control and concurrency utilities | Uses select and select3 to monitor multiple events at the same time |
142+
| [embassy-sync] | Thread-safe synchronization primitives for communication | Uses Channel and Signal to safely pass data (like button events or display commands) between different running tasks |
143+
| [hd44780_driver] | Hardware driver for the HD44780-compliant character LCD display | Used to initialize the screen mode, control the cursor, and print real-time game text (scores, lives, and states) via the I2C bus |
144+
114145

115146
## Links
116147

117148
<!-- Add a few links that inspired you and that you think you will use for your project -->
118149

119-
1. [link](https://example.com)
120-
2. [link](https://example3.com)
121-
...
150+
1. [https://github.com/UPB-PMRust/lab-solutions]
151+
2. [https://github.com/embassy-rs/embassy/tree/main/examples/stm32]
152+
3. [https://docs.rs/hd44780-driver/latest/hd44780_driver/]

0 commit comments

Comments
 (0)