The Plan: Not have cellphones in the bedroom. So I have to have a clock that can be an alarm clock with lots of functionality and NO LIGHT!
- No lights: The alarm clock should not emit any light to ensure it doesn’t disturb sleep.
- Decent audio: Must have a good quality speaker for the alarm sound.
- Externally powered: The clock will be plugged into an external power source, but it must retain power in the event of a power outage.
- Traditional digital alarm clock shape:
- Cube-like design: Wide and deep but not tall, ensuring stability and preventing it from falling over.
- Large top surface: Large enough to accommodate a snooze button and an off button, easily accessible.
- Raspberry Pi Zero 2 W: The Raspberry Pi will serve as the brain of the clock, handling time management, alarms, and the display.

- ReSpeaker 2-Mics Pi HAT: This HAT will handle the audio for the alarm sound. It has built-in microphones and a speaker output to provide decent quality sound.

- Uninterruptible Power Supply UPS HAT for Raspberry Pi Zero: This will ensure that the clock retains power in the event of a power outage, so it doesn't lose track of the time or alarms.


-
6 Momentary, Non-Latching Buttons:
- Button A: Snooze the alarm.
- Button B: Turn the alarm off.
- Button C: Toggle the display between showing the current time and the alarm time.
- Button D: Factory reset.
- Button E (+): Increase the alarm time when setting or adjusting it.
- Button F (-): Decrease the alarm time when setting or adjusting it.
-
Rocker or Sliding Switch: To enable or disable all alarms.
- NTP Sync: The clock will sync with Network Time Protocol (NTP) if internet is available during setup.
- Manual Time Adjustment: If no internet is available, Buttons E and F will be used to manually set the time.
| Item | Cost |
|---|---|
| Raspberry Pi Zero 2 W | C$: 21.00 |
| ePaper Display | C$ 38.00 |
| ReSpeaker 2-Mics Pi Hat | C$ 17.50 |
| Pi UPS | C$ 33.95 |
| Enclosure: 3D printed. Probably going to go through multiple iterations so maybe around | C$ 40.00 |
| SD card: I'll probably use 16Gb cards which go for under | C$ 10.00 |
| Power Supply | C$ 9.95 |
| USB-C enclosure support | C$ 2.02 |
| Buttons, Switches, jumper cables | C$ 15.00 |
| Shipping not included in any prices maybe another ? | C$ 60.00 |
Including 12% tax, for 2x, no-light, fully customisable, bed-side alarm clocks, that should bring the total to around C$ 420
That's of course not counting the time bulding, designing the enclosure and doing all the coding - but that's where the fun comes in!
- Capacitive touch sensors for up/down/set
- Haptic feedback near the buttons
- Buttons be surrounded by a 0.5mm raised area
- Buttons be on the side (left or right or both)
- All alarms on/off slider at rear.
- Snooze/Off on top
- need to figure out how to make that a large capacitive touch sensor
- I think it's possible to hack these guys by scraping the red stuff off of the 2nd image below and soldering some copper shielding on to it - but I don't know - research required.


- Check for saved Wi-Fi network:
- If connected: Proceed with normal operation
- Check for system updates
- If new update available, display on screen.
- NTP Sync
- Get time display immediately
- Check for system updates
- If not connected:
- Step 1: Scan for available Wi-Fi networks (APs).
- If no APs are found:
- Display message:
"No Wi-Fi available. Press and hold Button B for 3 seconds to use offline mode." - If Button B is held for 3 seconds, disable Wi-Fi and allow the user to set the time manually using Buttons E (+) and F (-).
- Otherwise, keep scanning for available Wi-Fi networks every minute.
- Display message:
- If APs are found:
- Step 2: Display option to press Button B for 3 seconds to use Offline Mode or press Button C to connect to Wi-Fi.
- If Button B is long-pressed: Disable Wi-Fi, enter offline mode, and allow time setup manually.
- If Button C is pressed: Proceed with Wi-Fi setup using a mobile device.
- If no APs are found:
- Step 1: Scan for available Wi-Fi networks (APs).
- If connected: Proceed with normal operation
- Step 3: Enable AP mode on the Pi and generate a QR code showing the clock's AP credentials (random ESSID and password).
- Step 4: Display a message on the e-paper screen:
"Scan QR code to connect to the clock’s Wi-Fi."- The user connects to the clock's Wi-Fi on their mobile device.
- Step 5: Once connected to the clock's Wi-Fi, show the following options on a web interface served by the Pi:
- Select Wi-Fi from available networks (list acquired during scan) and enter password.
- Manually enter Wi-Fi name and password (for hidden networks).
- Use WPS (if supported).
- Go into Offline Mode (disable Wi-Fi, allow manual time setup).
- Step 6: After Wi-Fi is set up (or in offline mode), prompt the user to set the locale (timezone).
- If connected to Wi-Fi, the clock will automatically try to set the timezone based on locale information acquired via NTP.
- If no Wi-Fi: Show a list of general timezone options (e.g., UTC, PST, EST, etc.) that can be selected using Buttons E (+) and F (-), or let the user enter the timezone manually via the web interface during offline mode setup.
4. Fallback for Hidden APs or WPS:
- If the user selects hidden AP or WPS, allow manual input of AP name/password via the web interface or guide the user through WPS setup (if supported by their router).
- Step 7: On successful connection to Wi-Fi or manual time setup (in offline mode), display the time and the next queued alarm on the e-paper screen.
- If Wi-Fi is connected, automatically sync the time via NTP based on the selected locale.
- The clock will update once per minute and show the current time on the e-paper display.
- The first alarm time will be displayed.
- Use Buttons E (+) and F (-) to adjust the alarm time.
- Press Button C again to either save save or proceed:
2.1.1. Short Press While Alarm Time is Displayed: (This needs to be reworked. You don't wantt o have to scroll through 20- alarms just to add a new one)
- Saves the current alarm time and either:
- 2.1.1.1: Moves to the next alarm (if one exists), and 2.1.1 is repeated.
- 2.1.1.2: If no more alrms exist, ask if the uers wants to exit the alarm set up or creat a new alarm.
- 2.1.1.3: When new alarm is selected, the initial time is set to 12:00, which can be adjusted using + or - buttons.
- Saves the current alarm and exits back to the clock display showing the current time.
- Enables Wi-Fi Access Point (AP) mode and displays a QR code for easy mobile connection.
- The mobile web interface will allow users to:
- Add new alarms.
- Edit existing alarms.
- Delete alarms.
- Button A: Snoozes the alarm for 5 minutes.
- The default snooze period can be changed via the mobile web interface and can be on a per-alarm basis.
- Button B: Stops the alarm.
- Button D (recessed and hidden behind a small hole) will act as a reset button.
- Pressing Button D will restore the clock to factory defaults.
-
Audio Streaming Service Setup:
- Add and save a streaming service for audio playback (e.g., music, alarms).
- Supported streaming services:
- Spotify
- Apple Music
- Pandora
- Deezer
- Google Play Music
- TuneIn Radio
- SoundCloud
- Allow the user to authenticate with their account for the selected service.
-
Alarm Management:
- Add, edit, or delete alarms.
- Set custom times, tones, snooze time, or actions for each alarm.
-
Alarm Tone Options:
- Choose a built-in alarm tone (default sounds).
- Upload a custom audio clip (e.g., MP3, WAV files).
- Select which streaming service to use as the alarm source (stream specific playlists, songs, or radio channels).
-
System Usage Opt-In:
- Allow users to opt-in to a system that tracks how many clocks are in service, using IP addresses to estimate location.
- Disabled by default.
-
Wi-Fi Configuration:
- Reconfigure Wi-Fi settings:
- Scan for available networks.
- Input new SSID and password.
- Reconfigure Wi-Fi settings:
-
System Management:
- Reboot Clock: Restart the system if needed.
- System Update check: Calls home and tries to update the code.
- Restore Factory Defaults: Reset all settings to default, erasing user data.
-
Easter Eggs:
- Add some fun hidden features (e.g., small games, quirky sounds, or hidden custom modes).
- Consider adding:
- Random messages or jokes when accessing certain settings.
- Special audio clips unlocked after a certain time or during holidays.
- Hidden themes for the web interface.
-
Locale and Time Zone Setup:
- Let users configure the clock's locale, time zone, and daylight saving settings, especially useful when the clock is offline.
-
Battery Management:
- Display the current battery status or power source.
- Notify users of low power or if the clock is running on UPS backup.
-
NTP Sync Toggle:
- Option to toggle NTP syncing (time synchronization with the internet).
- Allow manual time adjustment if NTP is disabled.
-
Alarm Snooze Customization:
- Customize snooze intervals for each alarm (e.g., 5 minutes, 10 minutes, 15 minutes).
- Maybe even change alarm tone based on how many times the snooze has been hit
-
Update notes
- Include all version history
-
User Feedback:
- Add a "Feedback" option for users to report bugs or suggest features.
- Implement an optional user poll to vote for future features.
-
Integration with Smart Home Devices:
- Future option to integrate with platforms like Google Home, Amazon Alexa, or IFTTT to control alarms and music through voice commands or automation.
- Objective: Allow users to set the time manually if there’s no Wi-Fi connection.
- Approach:
- Button Mapping: Assign specific functions to buttons E (+) and F (-) for adjusting time.
- State Management: Implement a state machine or flag to switch between normal and manual time settings.
- UI Feedback: Display instructions on the e-paper screen to guide users through manual time setting.
- Objective: Enable users to switch between viewing the current time and setting/adjusting alarms.
- Approach:
- Button Mapping: Assign a button (e.g., Button C) to toggle between time mode and alarm mode.
- Display Updates: Update the e-paper display based on the current mode. Use clear visual indicators for the mode.
- Objective: Allow users to configure Wi-Fi settings via a mobile device.
- Approach:
- AP Mode: Enable Access Point mode on the Raspberry Pi so it can be discovered by mobile devices.
- QR Code Generation: Use a Python library (like
qrcode) to generate a QR code with the Pi’s AP credentials. - Instructions: Display a message on the e-paper screen guiding users to scan the QR code.
- Objective: Provide a user-friendly interface for Wi-Fi setup and configuration.
- Approach:
- Framework Choice: Use Flask for simplicity, especially for a lightweight application. Django is more robust but may be overkill for this task.
- UI Components: Create forms for selecting Wi-Fi networks and entering passwords.
- Backend: Implement endpoints to handle Wi-Fi configuration and store user inputs.
- Deployment: Ensure the web interface runs on the Raspberry Pi and is accessible when the Pi is in AP mode.
- Objective: Allow users to manage alarms and customize audio settings via a web interface.
- Approach:
- Alarm Management: Provide forms for setting, editing, and deleting alarms.
- Audio Customization: Allow users to upload audio files and select tones from predefined options.
- Integration: Link these settings to the backend logic that controls alarm behavior and audio playback.
- Objective: Enable users to reboot the device, restore factory settings, and adjust system settings.
- Approach:
- Reboot: Implement a backend function to reboot the Pi, accessible via the web interface.
- Factory Reset: Develop a script that restores default settings and clears user data.
- Settings Management: Create forms or toggles for adjusting system settings. Ensure changes are saved and applied correctly.
- Objective: Ensure the alarm functionality is robust and responsive.
- Approach:
- Alarm Scheduling: Use Python’s scheduling libraries to handle alarm times and triggers.
- Button Integration: Map button presses to snooze and stop functionalities.
- Audio Playback: Integrate audio playback with alarm triggers.
- Objective: Allow alarms to use music from streaming services.
- Approach:
- APIs: Research APIs provided by services like Spotify and Apple Music. For Spotify, use the Spotify Web API; for Apple Music, use the Apple Music API.
- Authentication: Implement OAuth for secure user authentication.
- Integration: Use the APIs to fetch and play songs or playlists. Handle API requests and responses in Python.
- Objective: Let users upload their own audio files for alarms.
- Approach:
- File Upload: Create a web form for file uploads.
- File Handling: Store uploaded files in a specific directory on the Pi and integrate them into the alarm system.
- Validation: Ensure that uploaded files are of acceptable formats and sizes.
- Objective: Provide flexibility in alarm tone settings.
- Approach:
- Storage: Use a structured format like JSON for saving alarm settings (time, tone, snooze duration).
- Database vs. Plaintext: A lightweight database (like SQLite) is preferred over plaintext for managing alarm settings, as it provides better structure and querying capabilities.
- Implementation: Load and save alarm settings from/to the database. Ensure the system reads these settings correctly at runtime.
- Repetition Options:
- Once-off (deleted after being executed)
- Daily
- Weekly
- Monthly
- Yearly
- Weekdays
- Weekends
- Custom options (e.g., every 2nd Tuesday and Thursday, 3rd Friday of every month, annually on January 7th when it falls on a Tuesday)
11. Add Easter Eggs (Hidden Messages, Sounds, etc.)
- Objective: Add fun and engaging features to the clock.
- Approach:
- Hidden Features: Implement special modes or messages that trigger under specific conditions (e.g., long-pressing a button).
- Randomization: Use random functions to trigger Easter eggs, making them feel less predictable.
- Objective: Optionally track the number of clocks in service for analytics or support.
- Approach:
- Opt-In Feature: Add a checkbox or toggle in the web interface for users to opt-in.
- Tracking Mechanism: Collect data (e.g., IP addresses) only from users who opt-in.
- Data Display: Show aggregate data on a separate admin interface or dashboard.
- Default: Smaller time font with space for icons denoting power source, alarms, and warnings.
- Non-default 1: Full time display with the largest possible time readout, no space for status icons.
- Non-default 2: Smaller time display with icons and the time of the next alarm.
- Inverted Alarm Display: Alarm time displayed with a black background and white text.
- Non-inverted Alarm Display: Standard alarm time display without inversion.
- Timing: Implement light/dark mode as part of the web interface design.
- Approach: Use CSS media queries or a toggle switch in the interface to switch between light and dark themes. Store user preferences using cookies or local storage.
- Acquire hardware
- Assemble Raspberry Pi Zero 2 W, e-paper display, ReSpeaker HAT, UPS HAT, buttons, and switches.
- Set up Raspberry Pi OS.
- Install necessary drivers and libraries for e-paper, audio HAT, and buttons.
- In the ReSpeaker code
- Disable LED code
- Disable I2C code
- Disable Button Code
- In the Epaper code
- Remap GPIO17 (pin 11) to GPIO16 (pin 36)
- Remap GPOI18 (pin
- In the ReSpeaker code
- Test each hardware component individually.
- Physically remove the LEDs from the ReSpeaker
- Set up NTP synchronization for timekeeping.
- Implement manual time adjustment with buttons for offline mode.
- Design e-paper display layout for clock face and alarm times.
- Implement button functionality to switch between time and alarm modes.
- Test UPS backup to ensure time is not lost during power outages.
- Implement Wi-Fi setup using AP mode and QR code generation.
- Develop a simple web interface (using Flask/Django) for Wi-Fi setup.
- Create web interface for alarm management and audio customization.
- Add functionality to reboot clock, reset to factory defaults, and change settings.
- Implement core alarm logic (set, snooze, stop).
- Integrate support for streaming services (Spotify, Apple Music, etc.).
- Add support for custom audio uploads (e.g., MP3, WAV).
- Customize per-alarm settings (different tones for each alarm).
- Test audio quality with the ReSpeaker HAT.
- Test UPS HAT to ensure clock operates during power outages.
- Display power source status (main power vs UPS).
- Test low battery notifications.
- Add easter eggs (hidden messages, sounds, etc.).
- Refine the web interface with extra settings (e.g., NTP toggle, locale setup).
- Implement system opt-in for tracking clocks in service (disabled by default).
- Final testing and bug fixing for smooth user experience.
- Implement display options:
- Default: Smaller time font with space for icons denoting power source and alarms.
- Non-default 1: Full time display with largest possible time readout, no space for status icons.
- Non-default 2: Smaller time display with icons and the time of the next alarm.
- Implement alarm display options:
- Inverted Alarm Display: Black background with white text.
- Non-inverted Alarm Display: Standard display without inversion.
- Implement options for alarm repetition:
- Once-off
- Daily
- Weekly
- Monthly
- Yearly
- Weekdays
- Weekends
- Custom options (e.g., every 2nd Tuesday and Thursday, 3rd Friday of every month, annually on January 7th when it falls on a Tuesday)
- Implement light/dark mode toggle for the web interface.










