Inspiration
One of the most commonly shared experiences—especially during college—is waking up without feeling energized or relaxed. Our friends and roommates constantly complained about inadequate sleep. We even skipped lectures just to catch extra sleep. Whether you sleep for 4 hours or 12 hours, the hardest part of the day is getting out of bed feeling groggy and unenergized. Many of us (including our team) suffered from insomnia and other nightmares (literally). We experimented with melatonin but found that it sometimes only helped us fall asleep—it didn’t necessarily keep us in the deep, restorative stages of sleep. We knew there had to be a better, more personalized way to ensure every night leads to a refreshed morning.
What it does
SleepSync is an app and hardware solution that enhances your sleep by combining optimization with live health data.
Software:
SleepSync collects data from your Fitbit (or other wearable device), such as heart rate, respiratory rate, temperature, etc., and processes it into an algorithm based on a wide variety of literature (including optimization and health, noted at the bottom). This algorithm releases a dosage of melatonin based on your biometric data and the stage of the sleep cycle you're in. This dosage optimizes each sleep stage, gradually tapering off throughout the night to ensure you wake up feeling energized and refreshed. Users can then write any comments or complaints about their sleep, which are fed into a Natural Language Processor using Gemini, which updates future doses to respond to sleep feedback. Historical data is also utilized to optimize dosage for each user.
Hardware:
A mg/hour dosage is sent from the SleepSync app to an ESP8266, which is connected to an Arduino using a custom script linked to a pump that dispenses melatonin into a transdermal patch (proof of concept using water). And yes, studies support that melatonin can be absorbed through the skin; there are even skin patches available for it.
User interaction:
The user interacts with the app by simply entering the time they are sleeping and wearing the transdermal patch/watch. Then, upon waking up, they can submit an optimal message describing their sleep, which will adjust future dosages.
How we built it
1] Algorithm - We began by establishing literature-based heuristics to design our dosing algorithm. We defined initial coefficients for key biometric parameters: HRV, RHR, α, β, γ, Temperature, Time, Respiratory Rate δ, ϵ, and feedback. We also incorporated adaptive feedback adjustments that incrementally modify these coefficients based on daily user input and recalibration of baseline values.
2] App and Server Architecture - We utilized an Expo app for mobile compatibility and integrated the Fitbit API (any API, such as Apple Watch/Health Kit, could also work) for live biometric data. We included an API for Gemini to perform NLP.
GUI Enhancements: On the sleep page, we implemented dynamic charts that track biometric trends and dosing history, updating in real time with every API call.
3] Hardware - We employed an ESP8266 as a server, an Arduino as a "smart-patch," a mechanical pump for dispensing the melatonin, a battery pack for power, and a breadboard for circuit construction.
Challenges we ran into
Data Integration: Combining live biometric data from HealthKit with user feedback and external API responses (Google Gemini and Google Sheets) necessitated careful synchronization.
Model Calibration: With limited pre-existing data, we had to construct adaptive components that could recalibrate coefficients based on individual sleep patterns and subjective feedback.
Hardware/Software Coordination: Integrating multiple components—from app GUI to backend servers—posed challenges in maintaining consistency and compatibility.
User Variability: Accommodating the wide variability in user sleep behavior while ensuring the model remains both flexible and reliable was a critical hurdle.
Accomplishments that we're proud of
Effective Algorithm: We developed a dynamic, literature-informed dosing algorithm that personalizes melatonin recommendations based on real-time biometric data and user feedback.
Innovative NLP Integration: By harnessing Google Gemini, we constructed an NLP module that analyzes free-text sleep feedback and fine-tunes our dosing parameters for a truly adaptive experience.
Live Data & Intuitive GUI: Our solution displays real-time biometric trends and dosing history through an interactive, user-friendly interface, making complex data accessible at a glance.
Full-Stack & Hardware Breakthrough: In an intense 36-hour development sprint, we successfully built a complete full-stack solution—integrating front-end, backend, and hardware components—while overcoming connectivity challenges.
Personalization at Scale: Our adaptive algorithm continuously recalibrates based on individual sleep patterns, ensuring every user receives a tailor-made solution for their sleep quality. Exciting Hardware Integration: The hardware development was not only a technical success but also an enjoyable and engaging process that underscored our commitment to seamless integration and innovation.
What we learned
We learned how to use Expo to develop a cross-platform app for Web, iOS, and Android. We also learned to integrate live biometric data by leveraging the Fitbit API to refine our algorithm. Additionally, we learned to apply NLP through the Gemini API, utilizing prompting techniques to optimize our algorithm with user feedback and enhance the user experience. Finally, we learned to engineer an Arduino-powered pump system connected to a Wi-Fi microchip, enabling communication between the app and hardware through TCP/IP networking and HTTP requests.
What's next for SleepSync
We envision SleepSync as a highly compatible app that seamlessly integrates multiple APIs to support a wide range of fitness watches and smartwatches. Our next step is to expand into the Apple ecosystem by implementing the HealthKit framework, enabling Apple Watch integration for iOS users.
Additionally, we plan to enhance our hardware framework by leveraging Firebase to store user biometrics and facilitate real-time communication with a server. This system will calculate personalized melatonin dosages and transmit them to a compact, comfortable smart patch for improved sleep regulation.
With continued development, we believe SleepSync has the potential to transform sleep quality, providing a data-driven, personalized approach to optimizing rest and overall well-being.
Contact us
11235813 on Discord phuuu on Discord underwater_animal_10031 on Discord Tom123 on Discord
Built With
- arduino
- c++
- csv
- esp8266
- expo.io
- fitbit
- gemini
- github
- html
- java
- javascript
- json
- kotlin
- react
- react-native
- tailwind
- typescript
- xml
Log in or sign up for Devpost to join the conversation.