joshriang
← Back to portfolio

Web & frontend·JavaScript·Published

Smart Alarm

A course project that tried to fix the worst part of waking up: an alarm that fires at the end of a light sleep phase instead of at a fixed minute. Movement data is analysed with SleepPy to estimate sleep stage, a React and Tailwind UI configures the alarm and shows the current stage, a FastAPI server bridges the browser to the hardware, and ESP32 firmware listens on serial for commands and drives a motorised curtain and audio output. The components are deliberately separate: WebsiteFiles holds the React frontend and FastAPI backend, ArduinoFiles holds the .ino sketch, and Konsep holds the design diagrams. The honest limit is that this is a software skeleton around hardware I could not fully characterise: the firmware handles a small serial command vocabulary, and real use needs sensor calibration and the curtain mechanism actually attached.

Date
2026
Main stack
JavaScript
Code
github ↗
01
02
  • Serial is a fragile contract: without an explicit command vocabulary and timeouts on both sides, a dropped byte leaves the Python bridge waiting forever and the UI lying about hardware state.
  • Sleep staging from a single movement sensor is a coarse signal; the value is in the wake-up window, not in pretending the stage labels are clinical.
  • With hardware in the loop, software-only tests cover almost none of the failures, so the calibration step has to be designed before the demo, not after.
03

Scale 0–100: how much this project relied on each skill.