Roost is a sophisticated, web-controlled alarm clock built for the Arduino UNO Q. It integrates a Python backend with a JavaScript-based web interface to manage alarms that can trigger physical hardware actions, such as moving a servo motor or updating a 7-segment display.
- Web-Based Interface: A sleek, mobile-friendly UI to create, edit, and toggle alarms.
- Real-Time Sync: Uses WebSocket communication to synchronize alarm states between multiple web clients and the hardware.
- Hardware Integration:
- 7-Segment Display: Displays the current time in PST (UTC-8).
- Servo Control: A servo motor is used to perform physical "wake" actions when an alarm is triggered.
- Smart Scheduling: Supports repeating alarms on specific days of the week.
- Arduino UNO Q (x1)
- TM1637 7-Segment Display (Connected to pins 6 and 7)
- Servo Motor (Connected to pin 9)
- USB-C® Cable (For power and programming)
- Arduino App Lab
- Python Dependencies: Essential libraries include
opencv-python-headless,ultralytics,pygame, andtorch.
python/main.py: The application backend that manages the alarm data store, handles WebSocket messages, and communicates with the Arduino via the Router Bridge.sketch/sketch.ino: The Arduino firmware that controls the TM1637 display and the servo motor based on commands received from the Python backend.assets/: Contains the frontend components, includingindex.html,style.css, andapp.js.python/start_alarm.py: A helper script triggered when an alarm goes off.
- Time Management: The Python backend tracks time in PST and sends regular updates to the Arduino to refresh the 7-segment display.
- Alarm Triggering: When the current time matches a saved alarm, the backend notifies the web interface, initiates the alarm sequence via
start_alarm.py, and calls thefire_servofunction on the Arduino. - Communication: The system relies on the
WebUIbrick for the browser-to-Python link and theRouter Bridgefor the Python-to-Arduino link.
- Launch the application using Arduino App Lab.
- Access the interface by navigating to
<UNO-Q-IP-ADDRESS>:7000in your web browser. - Use the "Add New" button to set a time and select the days for your alarm.
- The system automatically handles "loading" the servo (setting it to 0 degrees) via the background loop to ensure it is ready to fire.