Overview
A normal alarm makes you guess a wake-up time the night before. This one calculates it! Every night it takes tomorrow's first fixed commitment, whether that be a class or work, checks how long the trip will actually take given live traffic, subtracts the prep and buffer time the user personally needs, and sets the alarm for the latest moment that still gets me there. It's a single build that spans embedded firmware, a serverless cloud backend, and a web app. This was inspired by my tendency, at both community college and university, to set a manual alarm every day before sleeping, and wake up the next morning to still put in my destination in google maps, constantly watching the reach time in order to truly juice every extra minute of sleep I could get.
Architecture
- Hardware (ESP32-WROVER): the physical clock which displays the computed wake time, handles the alarm, and takes user input. It calls no APIs and does no scheduling math itself, only polling one Firestore document,
computed/today. - Cloud backend (Firebase): Firestore holds the schedule, Cloud Functions run the wake-time calculation, Hosting runs the web app, and Auth handles access..
- Web app: a Monday–Sunday schedule grid where the user enters recurring commitments, with the occasional date overrides, a transport mode, and a defaults panel for buffer time and time zone.
What I Built
- Wired and integrated the full device. I2C OLED display, rotary encoder, RGB LED status light, a passive buzzer, a 10-segment LED bar graph as a countdown, and a push button
- Wrote the nightly Cloud Function that reads the day's schedule entry or override, calls the Google Maps Distance Matrix API with
departure_time=nowandtraffic_model=best_guess, and works backward from the required arrival time to writecomputed/today - Added a manual function for on-demand recalculation when the schedule changes last minute
- Modeled the Firestore handling (
schedule,overrides/{date},settings/profile,computed/today) and built the composite index ondayOfWeek+startTimethe query needs - Built the web schedule app with Firebase Auth and deployed it on Hosting
Problems Worth Noting
- An API edge case: live-traffic estimates only apply to driving mode, as walking and biking fall back to static times in the Distance Matrix API, so the calculation has to treat those modes differently.
- Maintenance: the Distance Matrix API is now "Legacy" with Google steering developers to the Routes API.
Why It Mattered
People always say to build solutions that solve real problems. This was a prime example of something that only I really needed at the time, so I began my first true personal project, and learnt how to apply circuitry and embedded programming along the way. I can't wait to see what this project grows into, hoping to build an iOS app in the future (which the backend is perfectly set up for), and 3D model a eye-pleasing enclosure for the clock.