Inspiration

Sleep is important. In the lives of high school students and students in general, the number of hours of sleep you get often correlates to the grade you receive. Sleep impacts performance, happiness, and even lifespan. But sometimes even when you receive a full 8-hours of recommended sleep, you still don't feel refreshed. Instead, you feel miserable and snooze your alarm, hoping 10 minutes will feel like an hour. The reason why is simple. You woke up in the middle of your body's natural sleep cycle, disrupting your Circadian Rhythm. This is frustrating as 8-hours of sleep should guarantee a great day.

What it does

Well, no more! Using the new Bed Smart iOS/Android app, you can set alarms and wake up in the lightest sleep cycle -- optimizing the way you sleep forever. This app analyzes your sleeping patterns to set up natural alarms to wake you up in the least intrusive ways possible.

How we built it

We used the accelerometer on a smartphone to make any bed smart for practically no extra expense. We analyze movement data collected from your phone while you sleep. According to scientific research, 87% of the time, you can predict if a person is asleep by measuring their movements. If a person lying down with no movement for 20 minutes, we can assume they are asleep. With more scientific research, a typical person's natural sleep cycle is about 90 minutes or one-and-a-half hours long. We can simply subtract the remaining time left for the timer, divide by 90 minutes, round the result of the division, and set a timer to sound in 90 minutes times the result of the division to ensure you wake up in a light sleep cycle.

We also set this useful data up with IFTTT. Using Webhooks, we can set up smart home devices to respond to events from the alarm clock like when the user wakes up, when the user sleeps, and when the user prepares for bed. Imagine the reason why you can't fall asleep is that the temperature is too high. Well, using IFTTT and Bed Smart, you don't have to use your phone to set the temperature (which disrupts your Circadian Rhythm). Instead, you could set IFTTT to set the temperature lower when you prepare to sleep and when you finally fall asleep, turn the thermostat off to save on electricity cost. Or, you can set up IFTTT to automatically wake you up when your smart things detects something wrong like with a burglary or fire (though with the fire, you should have carbon monoxide alarms already).

Challenges we ran into

Originally, we wanted to build the accelerometer part with the Qualcomm Dragonboard but we couldn't figure out how to download UPM or import upm_utilities.h. So we scrapped that idea and migrated to Android/iOS. Originally, we were going to develop a React Native application but React Native changed so much since we last used it that we decided not to use it. IFTTT does not have much documentation on their Webhooks tool/service but we figured that out. We also had to implement some basic arithmetic math.

Accomplishments that we're proud of

Personally, I'm proud of publishing the Android app onto the Play Store. It took a while to sign that APK because it was the first Java-based Android app I published. I'm also proud of how I was able to develop the Android app relatively quickly and without bugs (there are bugs but they're simple to fix). - Devin

My fidget spinner record - Jesse

What we learned

We learned that documentation is the most important thing to have if you are planning to create an API or platform for developers. We also learned how to implement Firebase into our apps. It was much easier than developing a full-on Express.js app or Rails API. We also learned to not use very early stage open-source tools even if they're super hip (ahem React Native) because support tends to be broken or outdated in the early stage. We also learned about I2C and GPIO protocols for hardware components.

Personally, I learned how to use a fidget spinner - Devin

What's next for Bed Smart

We used a lot of Firebase in this application but we felt that we could have implemented some sort of dashboard system to analyze your sleep using machine learning to really get your Circadian Rhythm down. We also wanted to show a bunch of graphs of the accelerometer data as well as vertical lines of significant movement. We also wanted to do more with the Qualcolmm board. For example, we were planning to use a servo motor to pour the user a cup of tea when he/she wakes up from their sleep.

Built With

Share this project:
×

Updates