1 Introduction

Sleep is one human activity easily changeable due to irregular lifestyles, leading to poor sleep cycles. How we feel is greatly influenced by the quality and quantity of our sleep. Existing research [1,2,3] has shown that poor sleep is associated with impairment in cognitive performance, mood fluctuations, and could affect mental health. The importance of sleep dates back almost 40 decades as a concept of sleep hygiene stated by Dr. Peter Hauri [4]. Sleep hygiene refers to the different factors such as diet, exercise (physical activity), and environmental factors (light, noise, and temperature) that may interfere with or promote better sleep. All these principles revolve around the fact that humans should give primary importance to sleep. However, most people’s sleep gets interfered with either traditional (caffeine) or contemporary factors such as smartphones and their usage before bedtime.

Smartphones have penetrated not just into the technology market but also into human lives. Statistics on smartphone users in India shows that 55\(\%\) of users belong to the age group of 18-24.Footnote 1. Studies shows that college students check their phone 150 times a day and are unable to sleep without smartphones. Excessive smartphone usage have fuelled the need for understanding impact of these devices on student behaviour particularly their sleep patterns. SurveysFootnote 2 have been conducted across Indian students enquiring about their sleep duration, causes for irregular sleep, and so on. For instance, responses from a survey conducted by a private healthcare providerFootnote 3 reveals that students used their phones just before bedtime, slept after 11PM, used social media at night and so on. Academic studies conducted via survey based approaches also found high smartphone usage, irregular sleep routine and poor sleep quality [5,6,7,8,9]. Such findings which follow the traditional survey based responses although informative, do not quantify and reflect the sleep patterns, accurate duration of mobile usage before and after wake up, the duration of interruptions and the sleep quality. Alternate but accurate forms of data collection are required to compliment such studies.

Smartphones have a rich source of sensors such as the accelerometer, gyroscope, light, microphone, proximity, Wi-Fi, and Bluetooth built-inside them. This led to the mobile sensing method [10]. The past decade has seen a number of works on mobile sensing for human activity recognition and health [11,12,13,14]. An extension of mobile sensing is digital phenotyping, which involves understanding the human (phenotype) characteristics from data collected in-situ passively through digital devices. Digital phenotyping has shown to provide an objective way of assessing human behavior, thus complementing traditional subjective methods [15, 16].

In this work, we conduct a phenotype study on college students to quantify their sleep patterns primarily through interactions with their smartphones. We recruited 40 students across two college campuses and installed a custom developed mobile application in their phones, to infer their sleep duration, sleep onset (bed-in)time, and wake-up time. Through this study, we aim to answer a set of research questions listed below:

  1. 1.

    What is the overall distribution of sleep duration among the students?

  2. 2.

    Do bed-in(sleep on-set) and wake-up time impact the overall sleep duration and sleep quality?

  3. 3.

    Are there any patterns in students’ bed-in and wake-up times?

  4. 4.

    Is there any association between bedtime, wake-up and sleep duration?

  5. 5.

    Is sleep affected by mobile usage?

Our contributions in this work include:

  • Revealing interesting insights into the sleep patterns of a cohort of Indian students. The work can be reproduced across any population.

  • Our work is significant in automatically inferring one’s sleep patterns without any additional infrastructure and having a potential to provide personalized sleep schedules.

  • Our custom-developed mobile app, Usage Tracker, is open source and an all-in-one app. No digital well-being app built inside phones can record minute-by-minute continuous sleep data. Our app provides a fine granularity.

The work in this paper is organized as follows. We discuss some relevant work in literature in Sect. 2. This is followed by a detailed description of our study in Section 3. We describe the sleep inference algorithm in Sect. 4. In Sect. 5 we discuss our findings and analysis. In Sect. 6, we discuss the significance of our work. We finally conclude the work in Sect. 7.

2 Related Work

With an increasing number of digital devices offering health-tracking features, the interest in users has increased multi-fold. Sleep, in particular, has been getting a good amount of focus, resulting in the development of tools and technologies assisting users in tracking sleep patterns and duration, evaluating sleep quality, and so on.

Below, we summarize state of the art in sleep data collection and detection, organizing related work into three sections based on the approach: survey-based, sensor and survey-based, and sensor, survey, and commercial products based.

2.1 Survey-Based Sleep Analysis

In the past decade in India, many researchers have tried to analyze sleep among college students. Shad et al. [5] collected responses for Pittsburg Sleep Quality Index (PSQI)Footnote 4 and Oldenburg burnout inventoryFootnote 5 across medical college students and observed that 65\(\%\) students reported poor sleep quality. Similarly work in [6] use the smartphone addiction scale and PSQI to report excessive of phones by students with high sleep disturbance. Authors in [7] conducted a study on physical and sleep quality of 617 college students and found that 51\(\%\) reported having low physical activity levels and poor sleep quality. Mathew et al. [8] enrolled 657 students for a self reporting exercise to understand sleep time and schedule. Responses revealed that students had inadequate sleep duration, late bedtime, and early wake‑up time. Kaur et al. [9] through the (PSQI) questionnaire concluded that sleep quality is significantly related to the general well-being of students.

We now discuss studies conducted on sample sets from the western population. Harari et al. [17] used smartphone addiction scale, PSQI and International Physical Activity Questionnaire-Short Form (IPAQSF) to report that excessive usage of smartphone could lead to poor sleep quality and low levels of physical activity. Pilcher et al. [18] considered self-reported logs and PSQI for sleep quality and sleep time duration for 45 students. Results show that poor sleep quality is significantly correlated with poor well-being, stress, and depressive symptoms. Another study conducted on 1871 Japanese students [19] revealed that female students have higher sleep quality issues than males. In [20], the authors examined sleep quality, and it’s impact on the academic performance of undergrad students again using PSQI. The authors observed that low academic performance was related to low sleep quality and high stress. Work in [21], surveyed sleep quality using PSQI with 4318 undergrad students and concluded that poor sleep quality was significantly associated with skipping breakfast, tea drinking, a higher tendency toward internet addiction, and poor social support.

In [22], the authors surveyed over a thousand Australian adults to assess sleep-related difficulties. The average sleep time was 7 h. 16\(\%\) of working adults worked just before bed and also had frequent sleep difficulties or daytime sleep-related symptoms. Younger adults (18–34 years) slept around an hour longer on non-working days than on working days compared with 18 min in older age groups. Authors in [23] conducted a study across 400 subjects in Italy and observed that the bedtime hour, sleep latency, and wake-up time increased during the pandemic. In particular, during the lockdown, the impact of delays in bedtime and wake-up was more pronounced in students. Work in [24] designed a questionnaire to identify the relationship between sleep and smartphone usage. Analyses revealed that the unsatisfied sleep quality group tended to use their phone for 8 h or more. Similarly, work in [25] collected survey-based responses on smartphone addiction and sleep quality.

2.2 Phone and Survey data

Authors in [26], take a machine-learning approach to detect sleep and classify participants into good and poor sleepers. They collected smartphone sensor data and a sleep diary based on a PSQI standard questionnaire. The classification resulted in 93.06\(\%\) accuracy. Authors in [11] build upon their sleep estimation algorithm in [27] and statistically identify a negative association between sleep and stress. The work involved collecting smartphone sensor data and survey responses for stress and depression based on Gold standards. Pletcher et al. [28], used PSQI questionnaires and mobile usage time and found that longer duration of screen time was associated with shorter sleep duration. The sleeping period was associated with poor sleep quality, decreased sleep efficiency, and a long delay in sleep onset. Work in [29] explored the impact of smartphone use on sleep quality before bedtime and during bedtime. They collected iPhone and Fitbit watch data for sleep estimation. Analyses show that mobile usage before bedtime and during bedtime leads to significantly low sleep quality.

2.3 Phone and Other Platforms

The earliest works looked at validating the efficacy of smartphones for estimating sleep in humans. Natale et al. [30] used a smartphone and an ActiWatch (an actigraphy-based watch). The authors compared the total sleep time, wake after sleep onset, and sleep efficiency across the two devices. Results showed that smartphones underestimated the total sleep time compared to the actigraph.

Authors in [27] proposed a sleep estimation model using features from the accelerometer, light, microphone, phone lock, phone off, and charging during the night. They compared their model with commercial products like Jawbone. The accuracy of their estimation was ± 42 min. Authors in [31] designed an algorithm to identify sleep/wake cycles by inferring the body’s motion through the accelerometer sensor in the phone. The authors instructed users to place the phone near the pillow to capture movements. The authors compare the accuracy of three approaches: probabilistic, statistical, and hiddden markov models (HMM). Results showed that HMM gave 84% accuracy, 10%, and 15% more than the first and second approaches, respectively.

Borger et al. [13], used smartphone touch interactions and wrist-worn accelerometers to capture body movements. They extracted wakeful periods/interruptions during sleep. Using these measures, they estimated the putative sleep onset and wake-up times. Massar et al. [32] combined wearable data, phone use, and self-reports to infer sleep. According to the results, k-means clustering revealed three patterns, each consistently expressed within a given individual. The three corresponding groups that emerged differed systematically in age, sleep timing, time in bed, and peri-sleep phone usage.

Table 1 presents an executive summary of works using the sensing based approach for sleep analysis. These works suggest that smartphone interactions can be leveraged to update the behavioral signatures of sleep with these peculiarities of modern digital behavior. However, what the Table 1 misses is there no such study on sleep using smartphones on Indian students. Moreover, none of the works in the table provide an open source app. Work in [33] develop a mobile app that collects only mobile usage data. In contrast, our app collects any kind of sensor data and is an open source. A detailed description of our app is provided in [34].

Table 1 Executive summary of sleep studies

3 Methods

We illustrate the study procedure in Fig. 1.

Fig. 1
figure 1

After obtaining the participants’ consent, we asked all participants to install the app on their phones through the circulated QR code. The app recorded mobile usage and sensor data. Participants uploaded the data regularly to a server for analysis. The server pushed the extracted sleep information back to the device for user visualization

A total of 52 students enrolled in the study. After the study, we end up getting productive data from 40 students. We conducted an online meeting with all students and explained the project goals, study parameters, the mobile application, and the data collection process.

3.1 Participants

Our data collection exercise focused on students of undergraduate and postgraduate programs. The population consisted of 25 men and 15 women students, of which 23 were in undergraduate and 17 were in postgraduate programs. After advertising the participation opportunity, we recruited only those who consented to provide app usage and sensor data from their phones.

3.2 Study Design and Procedure

We developed an in-house mobile application, “Usage tracker” that runs Android based phones. The app polls every five seconds to detect the opening of an application and records the name and usage duration of the app in the foreground. The app also records screen events such as unlocking/locking the device. We have beta-tested the app on many Android devices running various versions of Android (Android 6.0 Marshmallow to the latest Android 12.0). The app showed complete compatibility with all of the specified versions of Android. Since the app uses a continuous background service for polling data, measuring the battery impact of our app was also crucial. We found the battery usage of our app to be negligible on all the test devices by Android’s built-in battery usage reporting feature. Figure 2 shows the interface of Usage tracker.

Fig. 2
figure 2

The record activity toggle button will start the app and run in the background. Users can use the buttons to export data or upload a raw database (DB) file

3.3 Data Logs

We received an average of 20 h/day of data from each of the 40 participants. We extracted 16,500 h of phone usage and 4,00,000 unlocks for 744 nights. Students answered a one-time demographic questionnaire along with daily inputs on sleep quality and quantity, bed-in and wake-up times.

In the next section, we discuss the method of collecting sensor data and the sleep inference algorithm.

4 Sleep Inference

Typically, polysomnography (PSG) is the method to measure sleep quantity. PSG uses data such as brain waves, eye movements, muscle contractions, blood oxygen levels, snoring, and restlessness to infer sleep quantity and quality. However, the method requires the patient to be at a hospital for weeks and is expensive, making it complex and impractical for large-scale, long-term (i.e., weeks, months) sleep monitoring. Existing work has shown that digital devices or actigraphy-based [39, 40] and smartphone based [26] studies produce comparable results with PSG. We formally present our sleep detection algorithm below.

figure a

The algorithm makes use of multiple sensor data. Firstly, the accelerometer, a miniaturized electronic sensor vibrates when a force acts on the it. The force can either be a user moving the device or just the force of gravity if the device is kept idle. The sensor converts these vibrations into varying voltage levels, and further map them to gravity values in the scale (1 g, 2 g, 3 g where 1 g = \(9.8\,{\text{m}}/{\text{s}}^2\)). Gravity value considered as idle state of the phone. So, the algorithm checks if the idle state holds true. Following which the phone lock state is checked. The the ambient light and sound are captured and checked to see if the room is lowly lit and there are no vocal sounds, indicating a quite room. the time duration for which all these conditions satisfy is summed up as sleep hours.

We describe this logic in Fig. 3 through a sample data of one night.

Fig. 3
figure 3

From 40 min to 490 min there is no spike, considered as no physical or mobile activity. We consider this long duration as uninterrupted sleep of 7.5 h

4.1 Algorithm Accuracy

We first compare our algorithm’s sleep estimation with another algorithm in [41]. The authors use phone unlock and phone usage features to detect and identify longest duration as sleep from sensor data. The average sleep duration derived from our algorithm was 6.4 ± 0.7 h and the duration derived from their algorithm using our data 7 ± 0.8 h.

Next, we also compared our algorithm with commercial smartwatches. However, getting all 40 students to wear a smartwatch during the study period was cumbersome due to the unavailability of watches and the unwillingness to wear watches while sleeping. We conducted a poll and found that only \(90\%\) participants did not prefer wearing, citing discomfort. So, we identified five participants who agreed to wear the watch for 14 days. Two users wore a FitBit, one an OppoReno, and the other an iWatch. The sleep estimation algorithms in these watches are proprietary. So, we presume that these watches measure accelerometer data to detect arm movement and calculate the bed-in, wake-up, and total sleep.

In Fig. 4a we compare the average sleep duration across five users for 2 weeks between the measurement platforms and ground truth. In Fig. 4b we depict our algorithm’s error relative to the smartwatch as reference with 95\(\%\) confidence intervals.

Fig. 4
figure 4

Comparison of three approaches and error rate of our algorithm presented in (a) and (b) respectively

5 Findings

In this section, we first discuss the total sleep duration computed from our algorithm. Following this, we present the analysis on bed-in, wake-up times and sleep interruptions.

5.1 Sleep Time Analysis

We validated our algorithm with smartwatch and ground truth data of five users. Here, we summarize the sleep duration computed across all students using our algorithm and the ground truth in Table 2.

Table 2 Descriptive statistics of sleep variables inferred from sensor data vs self reported

In Fig. 5, we illustrate the distribution of students based on the sleep duration.

Fig. 5
figure 5

Sleep time distribution: majority of the students fall into the 4.87–6.27 h bins. The distribution is skewed to the left indicating an average sleep duration of about 6 h

5.2 Bed-in and Wake-Up Time Analysis

We inferred the bed-in and wake-up times as the first and the last sample timestamps between the longest set of samples identified as uninterrupted sleep. The goal is to analyze how the bed-in and wake-up times are distributed, what is their spread or variation, does the spread indicate irregular sleep schedules in students and lastly does the spread have any impact on the overall sleep duration and sleep quality. We illustrate the distribution of bed-in times across all students in Fig. 6.

Fig. 6
figure 6

Bed-in time distribution: majority of the students fall into time range of 00:00 am to 3:00 am

Next, we show the distribution of wake-up times in Fig. 7.

Fig. 7
figure 7

Wake-up time distribution: The distribution is skewed with most students waking up between 6:45AM and 7:45 AM

As we can see, the bed-in time has a wider distribution when compared with wake-up time. To explore further and observe the spread of these two variables, we computed the median values of all students’ bed-in and wake-up, and the quartile values. The box plots in Fig. 8 illustrate the findings. Note that Y axis, (time values) are indicated as number of hours post 11PM when students go to sleep).

Fig. 8
figure 8

The median bed-time is around 1.5 h after 11PM whereas the median wake-up time is 7.5 h after 11PM. Majority of the samples under both bed-in and wake-up fall in the third quartile(75% percentile) indicating late sleep onset and wake-up times

Interestingly, we also observed that students were clustered into multiple groups according to the variations (standard deviation) of their bed-in and wake-up times. Fig. 9 shows the distribution of bed-in time variations.

Fig. 9
figure 9

Bed-in variations: 20 students went to bed within 60 min across all days. 12 of them varied between 60 and 80 min. Only 8 students had large variations ranging between 80–143 min

Similarly, there were only five students who had irregular wake up schedules as seen in Fig. 10.

Fig. 10
figure 10

Wake-up variations: The distribution shows close to 30 students woke up with 1 h variations throughout. 8 students ranged between 60-80 min. And just 5 ranged between  80–140 min

The sleep duration numbers highlight that most students maintained a sleep routine of 6–7 h on average barring a few who had erratic bed-in and wake-up times. Since the sleep duration depends on when one goes to bed and wakes up, we fitted a linear regression line to check relation between wake-up on bed-in, shown in Fig. 11.

The wake-up times as expected are well correlated with the bed-in times. The regression model was significant with \(R^2 = 0.45\) and prediction error of 1.07 h.

Fig. 11
figure 11

Regression plot for wake-up and bed-in

As secondary outcome, we collected data from ten working professionals for 2 weeks to observe their bed-in time patterns and compared it with ten randomly sampled students (Fig. 12).

Fig. 12
figure 12

Average bed-in time trend

The trend shows that students display an irregular trend when compared with the working professionals. This finding says that we can infer in general that working professionals need to maintain a regular sleep schedule in contrast to students who are constantly faced with academic workloads, late night college events, meetings and so on.

5.3 Sleep Quality

We asked students to rate their every night sleep quality. The ratings are based on the PSQI scale ranging from Very bad(1), Fairly bad(2), Fairly good(3) and Very good(4). The average sleep quality score was across all students was 3 ± 0.6. However, we observed that the ratings depended on the bed-in time variation as shown in Fig. 13.

Fig. 13
figure 13

Sleep quality statistics: The data says that students who had a score of 1 tended to have relatively large variation in the bed-in time as against the other scores. Students with a high sleep quality score fell into the 50–60 min window of bed-in time variation

5.4 Sleep Interruptions

Sleep interruptions in the context of this work mean the probability of using the phone via an app, or a simple action of unlocking the phone for a few secs such as checking the time, or a notification. We present the distribution of the time when the interruptions happened in Fig. 14.

Fig. 14
figure 14

Maximum interruptions (45%) occurred between between 3:20 AM to 4:54 AM The distribution is skewed to the left with another 25\(\%\) interruptions occurring between 1:45 AM to 3:20 AM

We also compared the number of interruptions between the student and non-student population. This is shown in Fig. 15.

Fig. 15
figure 15

The non-student population hardly had one interrupted night as against three for the student population in 2 weeks

Interestingly, our unlock data revealed that most unlocks happened only 30–60 min before bed-in times and wake-up times of students. We resort to a violin plot Fig. 16 to depict this behavior.

Fig. 16
figure 16

Violin plot of unlocks before bed-in and after wake-up presented in (a) and (b) respectively

Next, we discuss our findings on association between sleep and mobile usage.

5.5 Sleep and Mobile Usage

Our Usage tracker application records the usage of various application in the mobile. We identified three distinct clusters of students based on their mobile usage. The scatter plot in Fig. 17 illustrates the clusters.

Fig. 17
figure 17

Three different colored clusters represent mobile usage between 2–6 h, 8–10 h and 10–14 h respectively

We applied Pearson’s correlation and obtained \(r =0.0147\) and \(p=0.688\) for sleep and mobile-usage. This shows poor significance between sleep and mobile usage.

6 Discussions

A majority of work in literature on sleep sensing and inference among college students report interesting findings pertaining to the target groups. Although not a comparison, we pick a recent work [42] on American students to see how their findings fare. Our students had a regular sleep routine of 6.4 ± 0.7 h, close to American students 6.99 ± 1.84 h. What is contrasting is that American students had a fairly early bed-in time of 23:43 ± 1.5 h, as against our students who slept around 01:47 ± 2.39 h. The standard deviation is also larger in Indian students.

The work holds significance in the sense that it can be extended into the exploring mental health or social psychology. This space is slowly being populated with studies that have shown that smartphone usage and interactions can be used to identify and map to mental health symptoms. For instance, authors in [36] tracked depressive symptoms by mapping sleep derived from sensor data with standard questionnaires such as PHQ-9. [37], explored the relationship between regularity in sleep timings and mental health. They used data from a wearable device, daily mood with a smartphone application and depression through a questionnaire.

6.1 Significance of Findings in this Work

  • Despite having a wide variation in bed-in times, our students maintained a regular sleep schedule of 6.4 ± 0.7 h. The sleep quality across the cohort was 3 ± 0.6 which shows that students were happy with their sleep and did not feel fatigue the next day. This is a very important finding which goes against the common notion that students are sleep deprived.

  • One of the reasons cited for sleep deprivation is excessive mobile usage [43]. Our findings show that mobile usage had no correlation with sleep.

  • 616 nights were interruption less and 117 nights with 1-4 interruptions. The probability density function shows that the probability of no interruptions is as high as 80\(\%\). The chances reduce to 10\(\%\) and 5\(\%\) for being interrupted once or more than one time respectively. This indicates that students take their sleep seriously.

  • Our findings resonate to the fact that with physiological differences, differences in genetic and environmental conditions, and other factors, each student maintained a sleep routine or circadian rhythm as described by authors in [41]. We discovered personalized sleep schedules or routines.

  • Lastly, our work presents a simple and effective methodology and platform to quantify a complex phenomena such as sleep partly to a certain extent. Our sleep findings or behavior can be used to understand how a simple touch interaction on a phone helps in sleep detection.

7 Conclusion

This work proposed a sleep sensing framework using the built-in sensors of smartphone. The phenotype study is novel in the sense that this is a first of its kind study across Indian students. The study was conducted on two college campus with undergraduate and postgraduate students. Our sensing algorithm inferred sleep using the accelerometer, light, microphone and phone unlock/lock data.

We found that the average sleep duration was 6.4 ± 0.7 h and an average sleep quality score of 3 ±0.6. Some of our significant findings include close to 90\(\%\) of the students exhibiting regular bed-in and wake-up times, resulting in a balanced sleep routine. Also as against the common notion that students use smartphones overnight, we found that close to 80% of the 744 nights, students had interruption-free sleep. The results from this work are a precursor to exploring sleep and its impact on mental health of students.