|
| 1 | +# Adaptive Sunrise Alarm & Ambient Monitor |
| 2 | +A web-managed, dual-architecture smart clock that features asynchronous timekeeping, environmental sensing and a light-and-sound wake-up sequence. |
| 3 | + |
| 4 | +:::info |
| 5 | + |
| 6 | +**Student:** Stuparu Alessia-Ștefania **Username:** alessia.stuparu **GitHub Repository:** [https://github.com/UPB-PMRust-Students/fils-project-2026-alessiastuparu](https://github.com/UPB-PMRust-Students/fils-project-2026-alessiastuparu) |
| 7 | + |
| 8 | +::: |
| 9 | + |
| 10 | +## 1. Project Description |
| 11 | + |
| 12 | +**I am implementing an internet-connected alarm that features a dashboard for management, an internal asynchronous software RTC, and a hardware interface that handles tactile button inputs while triggering a LED ring, a buzzer, and an MP3 audio module.** |
| 13 | + |
| 14 | +The system is split into 2 parts: a Wi-Fi-enabled chip that handles networking and UI, while an ARM-Cortex-M33 manages hardware tasks such as turning on the LED ring, sensors, and audio outputs. |
| 15 | + |
| 16 | +## 2. Motivation |
| 17 | + |
| 18 | +I chose to do this project because I wanted to build a practical, daily-use tool while learning about cross-architecture communication and asynchronous embedded Rust. By using the RP2040 and STM32U5, I can better grasp the concepts of memory safety, state synchronization and custom protocol design. |
| 19 | + |
| 20 | +## 3. Architecture |
| 21 | + |
| 22 | +The system relies on two microcontrollers that work at the same time and communicate via a hardware UART bridge: |
| 23 | + |
| 24 | +* **The Raspberry Pi Pico 2W:** Represents the networking layer as it hosts an Embassy-based web server to receive user commands via HTTP. |
| 25 | +* **STM32:** Represents the control layer as it manages alarm state, local timekeeping, physical button inputs, and peripheral driving. |
| 26 | +* **Communication Protocol:** To keep the two chips in sync, I am using the postcard serialization format so that commands sent from the Pico W to the STM32 are interpreted without data corruption or memory errors. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +## 4. Log |
| 31 | + |
| 32 | +### Weeks 1-7 |
| 33 | +* Came up with the idea for the project and did needed research. |
| 34 | +* Finished the project proposal and selected hardware components. |
| 35 | +* Made final changes to the hardware part and ordered components. |
| 36 | + |
| 37 | +### Week 8 |
| 38 | +* Set up the Cargo workspace for both of the architectures so it handles cross-compiling. |
| 39 | +* Designed the behavior of the chips and what each of them handles. |
| 40 | +* Created a shared directory library so that specific commands are understood by both chips. |
| 41 | + |
| 42 | +### Week 9 |
| 43 | +* Programmed the Pico W so that it acts like a Wi-Fi server and created the HTML/JS website. |
| 44 | +* Established the UART serial connection so the Pico W can send data to the STM32. |
| 45 | +* Programmed the STM32 to multitask. It ticks a clock in the background while listening for new commands, all while using a Mutex to share memory between tasks. |
| 46 | +* Completed the Documentation Milestone. |
| 47 | + |
| 48 | +## 5. Hardware |
| 49 | + |
| 50 | +The system uses a Nucleo STM32U545RE-Q as the main controller, a Raspberry Pi Pico 2W for Wi-Fi networking and web hosting, a 1.8" TFT LCD for time and temperature visualization, a BME280 sensor for environmental monitoring, a WS2812B LED ring for sunrise simulation, an active buzzer and a DFPlayer Mini with a 3W speaker for audible alarms, and tactile buttons for manual hardware control. |
| 51 | + |
| 52 | +## 6. Bill of Materials |
| 53 | + |
| 54 | +| Device | Usage | Price | |
| 55 | +|--------|-------|-------| |
| 56 | +| [Raspberry Pi Pico 2W](https://www.optimusdigital.ro/ro/raspberry-pi/13247-raspberry-pi-pico-w.html) | Wi-Fi network and web server hub | 39.66 RON | |
| 57 | +| [GroundStudio BME280 3V3](https://ardushop.ro/ro/electronica/1125-modul-senzor-de-presiune-barometrica-si-temperatura-bme280.html) | Temperature and Humidity monitoring (I2C) | 32.67 RON | |
| 58 | +| [DFPlayer Mini MP3 Player](https://www.aliexpress.com/) | Decodes and plays MP3 audio files for the alarm | 13.98 RON | |
| 59 | +| [Mini Speaker 3W 8 Ohm](https://www.aliexpress.com/) | Audio output for the DFPlayer | 16.67 RON | |
| 60 | +| [MicroSD Card (8GB-32GB)](#) | Stores MP3 files for the DFPlayer | Already owned | |
| 61 | +| [Active Buzzer KY-012](https://www.aliexpress.com/) | Backup audible alarm trigger | 13.21 RON | |
| 62 | +| [1.8" LCD TFT SPI ST7735](https://www.aliexpress.com/) | Digital clock and UI display | 19.18 RON | |
| 63 | +| [WS2812B LED Ring (16 LEDs)](https://www.aliexpress.com/) | RGB LED ring for sunrise simulation | 35.80 RON | |
| 64 | +| [Tactile Buttons 6x6x5mm](https://www.aliexpress.com/) | Physical inputs for snooze and alarm cancel | 17.62 RON | |
| 65 | +| [Breadboard 830 puncte MB-102](https://ardushop.ro/ro/electronica/10-breadboard-830-puncte-mb-102.html) | Hardware prototyping base | 21.18 RON | |
| 66 | +| [MB102 Breadboard Power Supply](https://www.optimusdigital.ro/ro/surse-de-alimentare/28-sursa-de-alimentare-pentru-breadboard.html) | Regulates 3.3V/5V power for the breadboard rails | 4.69 RON | |
| 67 | +| [9V 1A Power Adapter](https://ardushop.ro/ro/home/83-sursa-alimentare-9v-1a.html) | Main wall power source for the breadboard | 8.99 RON | |
| 68 | +| [Dupont Wires (M-M & M-F)](https://www.optimusdigital.ro/) | Hardware interconnections | 19.24 RON | |
| 69 | +| [Nucleo STM32U545RE-Q](https://ro.farnell.com/stmicroelectronics/nucleo-u545re-q/dev-board-32bit-arm-cortex-m33/dp/3953770) | Main logic and peripheral controller | Already owned | |
| 70 | + |
| 71 | +## 7. Software |
| 72 | + |
| 73 | +| Library | Description | Usage | |
| 74 | +|---------|-------------|-------| |
| 75 | +| [embassy-stm32](https://docs.rs/embassy-stm32/) | Hardware abstraction for STM32 | Used for configuring SPI, I2C, UART, and GPIO (for the tactile buttons) on the Nucleo | |
| 76 | +| [embassy-rp](https://docs.rs/embassy-rp/) | Hardware abstraction for Pico 2W | Used for configuring the RP2040/RP2350 peripherals | |
| 77 | +| [postcard](https://docs.rs/postcard/) | no_std message serialization | Used to safely pack and unpack UART network commands between the two chips | |
| 78 | +| [cyw43](https://docs.rs/cyw43/) | Pico W Wi-Fi driver | Used to establish the wireless network connection | |
| 79 | +| [embassy-net](https://docs.rs/embassy-net/) | Asynchronous network stack | Used to serve the HTTP dashboard to the user | |
| 80 | +| [st7735-lcd](https://docs.rs/st7735-lcd/) | SPI display driver | Used for drawing the clock UI and temperature to the 1.8" TFT screen | |
| 81 | +| [bme280-rs](https://docs.rs/bme280-rs/) | I2C sensor driver | Used to read room temperature and humidity | |
| 82 | +| [smart-leds](https://docs.rs/smart-leds/) | Addressable LED API | Used to control the WS2812B ring for the sunrise simulation | |
| 83 | +| [dfplayer](https://docs.rs/dfplayer/) | UART driver for DFPlayer Mini | Used to trigger MP3 audio playback for the alarm | |
| 84 | + |
| 85 | +## 8. Links |
| 86 | + |
| 87 | +1. [Embassy Framework Documentation](https://embassy.dev/) |
| 88 | +2. [Postcard Protocol Specification](https://postcard.jamesmunns.com/) |
| 89 | +3. [The Rust on Embedded Devices Book](https://docs.rust-embedded.org/book/) |
| 90 | +4. [DFPlayer Mini Manual & AT Commands](https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299) |
| 91 | +5. [ST7735 Display Datasheet](https://www.displayfuture.com/Display/datasheet/controller/ST7735.pdf) |
0 commit comments