Skip to main content
Version: ACS CC

PiBuzz

A multifunctional device which serves as a custom alarm clock, equipped with environmental sensors.

info

Author: Samson Alexandru-Valentin
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-sammsonn

Description

A device that has the main functionality of a digital clock displayed on a screen with an alarm function, operated by physical buttons. The alarm is manually set by the user and would emit sound via the buzzer. The product is also equipped with a pressure and temperature sensor to observe the environmental conditions surrounding it. Aditionally, a photoresistor is used in order to automatically adjust the brightness of the display.

Motivation

This project is inspired by a real world problem of mine, and it probably affects a lot of the current population, especially teenagers and young adults. When going to bed, I always take my phone with me and end up scrolling mindlessly for 1-2 hours. This has a very negative impact on my sleep, which is way more important than most think. But the main reason why I have my phone next to me in bed is because I use it as an alarm in order to wake up. This is also bad because the phone can overheat under the pillow, causing potential damage, and there is also the concern of EMF radiation exposure when keeping your cell phone close to the head for extended periods of time. So, building this clock by hand I can get rid of all these problems, removing the need of my smartphone at night.

Architecture

architecture

Log

Week 5 - 11 May

Soldered the pins to the microcontrollers and the sensors, reviewed all of the laboratories and inspected the data sheets of the hardware components used.

Week 12 - 18 May

Wired the pieces to the raspberry pi pico, started working on the software, wrote code in order to test each component individually, then succesfully confirmed that all of them work together.

Week 19 - 25 May

Completed the code, soldered all of the hardware on a perfo board and built the case for the clock.

Hardware

The main hardware is the Raspberry Pi Pico 2W microcontroller, which provides processing and Wi-Fi connectivity. A DS3231 RTC module is used for precise timekeeping. Environmental sensors include a BMP280 (temperature, pressure) and a photoresistor (ambient light, for automatic display adjustment). The user interface consists of an ILI9341 (2.4 inch) color LCD for display and touch buttons for control. The audio alarm is handled by a buzzer. The components are interconnected on a perfo board using jumper wires and well powered.

hardware1 hardware2 hardware3

Schematics

KiCad

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2WThe microcontroller40 RON x 2
ILI9341Display67 RON
DS3231RTC module19 RON
BMP280Pressure and temperature sensor8.5 RON
PhotoresistorPhotoresistor (type 5528)1.49 RON
BuzzerActive buzzer1 RON
Button12x12x7.3 button1.31 RON x 4
Button Cap12x12x7.3 button cap, multiple colors0.4 RON x 4
Breadboard HQBreadboard with 830 slots10 RON
Pin Header2.54mm (40p) pin header1 RON x 3
Male-Male Wire Set10p, 10cm male-male wires2.85 RON
Male-Male Wire Set10p, 30cm male-male wires5 RON
Female-Male Wire Set40p, 10cm female-male wires6 RON
Female-Male Wire Set40p, 15cm female-male wires8 RON

Software

Library (Crate)DescriptionUsage in Project
Core Embassy & HAL
embassy-rpAsynchronous Hardware Abstraction Layer (HAL) for the RP2350 microcontroller (Pico W).Provides fundamental access to peripherals: GPIO (Buttons, Buzzer, Display Control), I2C (RTC, BMP280), SPI (Display), ADC (LDR), DMA, Timers.
embassy-executorAsynchronous runtime executor for the Embassy framework.Managing and running concurrent asynchronous tasks (main task, button_and_buzzer_task).
embassy-timeTimekeeping utilities, timers, and delays for asynchronous tasks within the Embassy framework.Used for Timer::after() for periodic operations, and EmbassyDelay for blocking delays needed by display initialization.
embassy-syncSynchronization primitives (like Mutex) for safe concurrent access to shared data in async environments.Used for Mutex<NoopRawMutex, _> to share the SPI bus for the display and potentially other SPI devices (though IMU part was commented out).
embassy-embedded-halProvides adapter types to use embedded-hal blocking traits with Embassy's async SPI/I2C.Used for SpiDevice to wrap the shared SPI bus for the display, providing a blocking-like interface.
Low-Level & Panic Handling
cortex-mLow-level access to ARM Cortex-M processor core peripherals and intrinsics.(Often used indirectly by HALs and runtime, e.g., for critical sections). Not explicitly used for peripherals in your main but foundational.
cortex-m-rtMinimal runtime for Cortex-M microcontrollers, handles startup and interrupt vector setup.Provides the #[entry] macro for the main function (though #[embassy_executor::main] is used now). Foundational.
panic-probeA panic handler that prints panic messages via a debug probe (e.g., RTT using probe-rs).Defines the behavior when the program panics, sending details to the debugger.
Logging
defmtHighly efficient deferred formatting logger for embedded systems.Used for all logging output (info!, error!, warn!).
defmt-rttImplements a defmt global logger that sends log data over RTT (Real-Time Transfer) to a debug probe.Enables viewing defmt logs via probe-rs.
Display & Graphics
mipidsiGeneric driver for MIPI Display Serial Interface (DSI) compatible displays, including ILI9341.Used to initialize and control the ILI9341 display (clear, set orientation).
display-interface-spiProvides an SPI-based communication interface for display drivers like mipidsi.Bridges the mipidsi driver with the underlying SPI HAL.
display-interfaceDefines traits for display communication interfaces.(Dependency of display-interface-spi).
embedded-graphicsA 2D graphics library for drawing shapes, text, and images on embedded displays.Used for defining text styles, drawing text (Text), and shapes (Rectangle) on the ILI9341 display.
Utilities
heaplessProvides data structures (like String) that do not require dynamic memory allocation (std's alloc).Used for HString to create fixed-size string buffers for formatting text to be shown on the display.
embedded-hal-asyncAsynchronous hardware abstraction traits for embedded systems (e.g., async I2C).The I2c trait from this is used to enable methods like .read(), .write(), .write_read() on embassy_rp::i2c::I2c.
core::fmt::WriteStandard library trait for formatting into a writer (available in no_std through core).Used with heapless::String and the write! macro to format variables into displayable strings.

Functional Diagram

  1. Raspberry Pi Pico - Alarm Clock Project
  2. pico-alarm-clock
  3. Raspberry Pi Pico - Alarm Clock