Skip to main content
Version: ACS CC

Xtreme Math Alarm Clock

An alarm clock that requires solving a math problem to be turned off.

info

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.

Logic Diagram

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

poza1 poza2 poza3

Schematics

Place your KiCAD schematics here. KiCAD schematics

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico WMain platform, Embassy support35 RON
DS3231 RTC ModuleReal-time clock for accurate alarms~25 RON
OLED Display 128x64 (SSD1306)Time, menu and math problem display~30 RON
Passive BuzzerAlarm sound with adjustable volume~5 RON
MCP41010 Digital PotentiometerProgrammatic volume control~15 RON
4x4 Matrix KeypadMath answer input~10 RON
MicroSD ModuleConfiguration and logs storage~15 RON
MicroUSB cable + 5V Power SourcePowering the Pico~20 RON
Breadboard + jumper wiresEasy connections without soldering~20 RON
Plastic enclosurePhysical protection and aesthetic finish~25 RON

Software

LibraryDescriptionUsage
embassy-executorAsync executorTask scheduling with Embassy
embassy-rpHAL for RP2040Specific support for Pico 2W
embedded-hal-asyncAsync peripheral abstractionI2C, SPI, GPIO
ssd1306OLED display driverDisplaying time and math problems
embedded-graphicsDrawing libraryText and shapes on OLED
ds323xRTC driverReal-time clock and alarm
keypadKeypad handlingScanning keypad input
embedded-sdmmcmicroSD file systemConfiguration and data storage
heaplessNo-heap data structuresBuffers, strings, queues
fugitTiming utilitiesAsync delays and timers
panic-probePanic debuggingRTT-based panic logging
defmt + rtt-targetEfficient loggingFor embedded debugging
cortex-mARM core supportResets, NOPs, etc.
  1. Embassy async embedded framework
  2. Rust Embedded Book
  3. SSD1306 Display Rust Driver
  4. DS3231 RTC Rust Driver