PiBuzz
A multifunctional device which serves as a custom alarm clock, equipped with environmental sensors.
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 has a snooze option and would sing a song loaded from an external audio file. The product is also equipped with a pressure and temperature sensor to observe the environmental conditions surrounding it. Aditionally, a light sensor 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
Log
Week 5 - 11 May
TODO
Week 12 - 18 May
TODO
Week 19 - 25 May
TODO
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 BH1750 (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 DFPlayer Mini module that plays MP3 files from an SD card, with the sound being output through a speaker. The components are interconnected on a breadboard using jumper wires and well powered.
Schematics
TODO: KiCad schematics.
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico 2W | The microcontroller | 40 RON x 2 |
DS3231 | RTC module | 19 RON |
BMP280 | Pressure and temperature sensor | 8.5 RON |
BH1750 | Light intensity sensor | 10.4 RON |
DFPlayer Mini | MP3 module | 14 RON |
40mm Speaker | 8 ohms 0.5W speaker | 2.75 RON |
Button | 12x12x7.3 button | 1.31 RON x 4 |
Button Cap | 12x12x7.3 button cap, multiple colors | 0.4 RON x 4 |
Breadboard HQ | Breadboard with 830 slots | 10 RON |
Electrolitic Condenser | 47 uF, 50 V condenser | 0.5 RON |
Pin Header | 2.54mm (40p) pin header | 1 RON |
Male-Male Wire Set | 10p, 10cm male-male wires | 2.85 RON |
Female-Male Wire Set | 40p, 10cm female-male wires | 6 RON |
Female-Male Wire Set | 40p, 15cm female-male wires | 8 RON |
Software
Library | Description | Usage |
---|---|---|
rp-pico-hal / embassy-rp | Hardware Abstraction Layer (HAL) for RP2040 microcontroller. | Provides fundamental access to peripherals: GPIO, I2C, SPI, UART, PWM, Timers etc. |
embassy-executor | Asynchronous runtime executor for embassy. | Managing concurrent tasks (e.g., reading sensors, updating display). |
panic-probe / panic-halt | Panic handler implementation. | Defines behavior on program panic. |
defmt / defmt-rtt | Efficient logging framework for embedded systems. | Useful for debugging output over a debug probe. |
ds3231 | Driver for DS3231 Real-Time Clock module. | Reading/setting current time and date via I2C. |
bmp280 | Driver for BMP280 Pressure & Temperature sensor. | Reading temperature and pressure values via I2C. |
bh1750 | Driver for BH1750 Ambient Light sensor. | Reading ambient light level (Lux) via I2C. |
ili9341 | Display driver for ILI9341 LCD controller. | Sending commands and pixel data to the LCD display via SPI. |
(HAL UART) | UART communication capability provided by the HAL. | Sending serial commands to the DFPlayer Mini module. |
(HAL GPIO) | GPIO input capability provided by the HAL. | Reading the state of the physical buttons. |
(HAL PWM) | PWM output capability provided by the HAL. | Controlling the brightness of the LCD backlight. |
embedded-graphics | 2D graphics library for embedded displays. | Drawing shapes, text, and UI elements onto the ILI9341 display. |
embedded-graphics-text | Text rendering capabilities and font data. | Displaying time, date, sensor data, and menu text. |
debouncr | Utility for debouncing digital inputs (buttons). | Preventing multiple triggers from a single button press. |
embedded-hal / embedded-io | Traits defining hardware abstraction interfaces. | Used by most drivers to ensure portability across different HALs. |
heapless | Static data structures without dynamic memory allocation. | Useful for buffers, queues, etc., in no_std environments. |