Xtreme Math Alarm Clock
An alarm clock that requires solving a math problem to be turned off.
Author: Cristian-Andrei Frant
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-CristiFrant
Description
This project involves the development of a digital alarm clock, designed to improve the morning waking experience. The clock functions like a regular one, but it stands out by how the alarm is turned off: the sound gradually increases in volume until it reaches a maximum level, and to stop it, the user must input the correct answer to a math problem displayed on the screen.
Motivation
Many students struggle to wake up in the morning, especially during exam periods or important lectures. Regular alarms can be ignored or turned off easily, either because they are not loud enough or because they can be disabled with a single button press.
The Xtreme Math Alarm Clock is an innovative solution that introduces an intellectual challenge to the waking process: to stop the alarm, the user must solve a math problem shown on the screen. The volume increases progressively, promoting active waking, and the required interaction reduces the chances of falling back asleep. This project successfully combines embedded hardware with cognitive stimulation in a useful and creative way.
Architecture
Raspberry Pi Pico 2W: Serves as the central unit, managing all logic and timekeeping operations of the system, including interfacing with other components.
DS3231 RTC Module: Maintains accurate time, even without power, enabling precise alarm scheduling.
OLED Display (SSD1306): Displays the current time and the math problem required to stop the alarm.
4x4 Matrix Keypad: Allows the user to input their answer to the displayed math problem. Each key press is read by the Pico for validation.
Passive Buzzer: Emits the alarm sound, with intensity controlled via PWM by the Pico.
Digital Potentiometer MCP41010: Programmatically adjusts the buzzer’s volume, increasing the intensity over time.
MicroSD Module: Enables storing data such as last wake-up times, settings, or usage logs.
All components are controlled and synchronized by the Raspberry Pi Pico 2W, which acts as the system's brain. The RTC provides timekeeping, and when the alarm time is reached, the Pico activates the buzzer and displays a math question. The user must input the correct answer through the keypad. In the meantime, the sound level is progressively increased using the digital potentiometer.
Log
Week 21 - 27 April
- Identified the primary components required for the project.
- Outlined the overall system architecture.
- Began researching key elements such as the potentiometer and LCD module.
Week 28 April - 4 May
- Placed orders for all necessary hardware components.
- Started drafting the official project documentation.
- Completed the full electronic schematic using KiCad.
Week 5 - 11 May
- Built a demo of the project with the hardware i had
- Got more hardware parts and updated the demo
Week 12 - 18 May
- Started writing code and testing the componenets one by one
- Tried linking the lcd with the keypad
- Finished a small demo
Week 19 - 25 May
- Finished the final code
- Linked all the parts with each other
Hardware
1602 LCD with I2C Interface and Blue Backlight R1-4 10kohm Micro-SD-Card AT24C256 I2C EEPROM Clock- DS3231MZ 2 Raspberry pi pico 2w Passive buzzer 3.3 volt 4x4 Keypad
Schematics
Place your KiCAD schematics here.
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico W | Main platform, Embassy support | 35 RON |
DS3231 RTC Module | Real-time clock for accurate alarms | ~25 RON |
OLED Display 128x64 (SSD1306) | Time, menu and math problem display | ~30 RON |
Passive Buzzer | Alarm sound with adjustable volume | ~5 RON |
MCP41010 Digital Potentiometer | Programmatic volume control | ~15 RON |
4x4 Matrix Keypad | Math answer input | ~10 RON |
MicroSD Module | Configuration and logs storage | ~15 RON |
MicroUSB cable + 5V Power Source | Powering the Pico | ~20 RON |
Breadboard + jumper wires | Easy connections without soldering | ~20 RON |
Plastic enclosure | Physical protection and aesthetic finish | ~25 RON |
Software
Library | Description | Usage |
---|---|---|
embassy-executor | Async executor | Task scheduling with Embassy |
embassy-rp | HAL for RP2040 | Specific support for Pico 2W |
embedded-hal-async | Async peripheral abstraction | I2C, SPI, GPIO |
ssd1306 | OLED display driver | Displaying time and math problems |
embedded-graphics | Drawing library | Text and shapes on OLED |
ds323x | RTC driver | Real-time clock and alarm |
keypad | Keypad handling | Scanning keypad input |
embedded-sdmmc | microSD file system | Configuration and data storage |
heapless | No-heap data structures | Buffers, strings, queues |
fugit | Timing utilities | Async delays and timers |
panic-probe | Panic debugging | RTT-based panic logging |
defmt + rtt-target | Efficient logging | For embedded debugging |
cortex-m | ARM core support | Resets, NOPs, etc. |