“Sleep, those little slices of death; oh how I loathe them.” -Edgar Allan Poe
The importance of sleep is a hot topic in science right now. Research suggests everything from several mini power-naps a day to giving up alarm clocks to shifting the school day later. Falling asleep is hard, but staying awake is harder. When you’re on a deadline and down to the wire, sleep is often the first thing to go. When you pulled a double shift and are driving home at zero-dark-thirty, you can’t afford to doze off. If you’re waiting up late for a roommate or family member, you don’t want to pass out. There are so many times when you prioritize consciousness and productivity over the bags under your eyes. Caffeine or loud music can help, but are not always affective and generally disruptive. We want to let you sleep on your terms: only when you choose.
What is Jolt?
Jolt is an IOS app, written in Swift, that collects data from the Microsoft Band, a wearable fitness tracker. By analyzing data on the wearer’s motion and heart rate, Jolt is able to predict when you’re close to dozing off. It notifies you with a haptic notification, which can be turned off on both a phone and the Band itself. There are low and high priority settings that represent different intensities. If a user is driving, they cannot dose off for even a moment, and can utilize the high priority setting that will buzz them fully awake when they have not yet fallen asleep. Low priority is better suited for students or workers, who can accept getting closer to dozing off if that means fewer interruptions.
How We Built It
With a lot of help from Stackoverflow.
How We Did It
The main technical challenge was calculating sleep onset. We skimmed a lot of papers that all had different biological markers for when a person actually falls asleep. We experimented for most of the night--hackers make ideal test subjects--to figure out a trigger that wasn't too conservative or frequent. We ended up with a complicated set of constraints. We first determine if the gyroscope has moved recently, and if it hasn't, the first test has passed. Then we examine current heart rate against the average value. This average is frequently refreshed with small sample sizes, but only when the subject is moving. We found that if we factored in "still" heart rates, the average came too close to the sleeping rate. We also added a sloth factor. If the user doesn't move for an extended period of time, the criteria for sleeping heart rate slowly rises. This is best suited for athletes, who's heart rate's don't change nearly as much upon sleep onset. In their case, even if their heart rate doesn't drop below the appropriate percent, the percentage keeps increasing. This sloth factor is reset if the user moves again. tl;dr: If the user's heart rate drops too far, we wake them up. If he or she stays still for a long time, we prompt them to move.
Challenges We Faced
We came to Dartmouth thinking that we'd use the Apple Watch as our wearable-of-choice. We'd never developed with it before, and had borrowed a couple from friends to test out. We struggled for about five hours before we figured out that the Watch couldn't do what we wanted. Despite having the sensors we needed, we couldn't access heart rate data when the phone was off, making it unusable for monitoring. We switched over to the Microsoft Band--another wearable we weren't used to--and went for it. Thankfully, we were able to access sensor data and the documentation was very thorough.
Our team came into this hackathon with a huge range of experience and skills. For two of us, this is our first hackathon. That alone is something we are proud of. But we each picked up some new skills. Alex learned how to write Swift. Claire learned how to mock up a UI. Lee developed with wearables for the first time. We are better and badder than we were a day ago, and that's pretty cool.
Jolt works pretty well, but we’re not done yet. In the future we’d like to expand Jolt’s functionality to incorporate a skin temperature analysis, which would improve our accuracy. We’d also like to create an Android version of the app.