Sleep quantity affects an individual’s personal health. The gold standard of measuring sleep and diagnosing sleep disorders is Polysomnography (PSG). Although PSG is accurate, it is expensive and it lacks portability. A number of wearable devices with embedded sensors have emerged in the recent past as an alternative to PSG for regular sleep monitoring directly by the user. These devices are intrusive and cause discomfort besides being expensive. In this work, we present an algorithm to detect sleep using a smartphone with the help of its inbuilt accelerometer sensor. We present three different approaches to classify raw acceleration data into two states – Sleep and Wake. In the first approach, we take an equation from Kushida’s algorithm to process accelerometer data. Henceforth, we call it Kushida’s equation. While the second is based on statistical functions, the third is based on Hidden Markov Model (HMM) training. Although all the three approaches are suitable for a phone’s resources, each approach demands different amount of resources. While Kushida’s equation-based approach demands the least, the HMM training-based approach demands the maximum.
We collected data from mobile phone’s accelerometer for four subjects for twelve days each. We compare accuracy of sleep detection using each of the three approaches with that of Zeo sensor, which is based on Electroencephalogram (EEG) sensor to detect sleep. EEG is an important modality in PSG. We find that HMM training-based approach is as much as 84% accurate. It is 15% more accurate as compared to Kushida’s equation-based approach and 10% more accurate as compared to statistical method-based approach. In order to concisely represent the sleep quality of people, we model their sleep data using HMM. We present an analysis to find out a tradeoff between the amount of training data and the accuracy provided in the modeling of sleep. We find that six days of sleep data is sufficient for accurate modeling. We com- are accuracy of our HMM training-based algorithm with a representative third party app SleepTime available from Google Play Store for Android. We find that the detection done using HMM approach is closer to that done by Zeo by 13% as compared to the third party Android application SleepTime. We show that our HMM training-based approach is efficient as it takes less than ten seconds to get executed on Moto G Android phone.