How it works

Sleep actigraphy

During the night, your body follows certain sleep cycles. It goes from light sleep to deep sleep and occasionally into the REM-sleep, where the most memorable dreaming occurs. We use the method called sleep actigraphy (accelerometric movement measurement) which helps us to recognize your sleep phases when you are sleeping. This method is backed by scientific research which shows that even though not as precise as PSG it still provides comparable outputs with more convenient use. The biggest advantage of actigraphy is definitely the simple setup which makes in perfect for everyday use in home conditions. The phone has an accelerometer sensor built-in which is very sensitive. If placed in your bed, we start receiving a record of your movement overnight. In deep sleep, your muscular movements are suppressed and thus in this phase, the sleep graph (the output of sleep actigraphy) gets nearly flat. In contrast, during light sleep, you tend to turn around which manifests as significant peaks in the sleep graph.

Your body movements are directly related to your current sleep phase. In general, the more movement the lighter the sleep. The sensors on current Android smartphones are so sensitive, that even if you place the phone on the mattress near your body Sleep as Android is able to track significant differences in you sleep patterns. Please read more in Sleep tracking on how to correctly setup sleep tracking.Measuring your sleep cycles allows us to do two important things:

  1. Smart wake up — finding the best moment for the alarm to wake you up in the optimal sleep phase for pleasant wake-up and a good start into your day (see Alarms)
  2. Calculating your deep sleep % and cycle count which may be an indicator of healthy/unhealthy sleep. For example very low deep sleep percentages may indicate sleep deprivation issues (see Statistics)

Understanding sleep graphs

Raw data from the accelerometric sensor (x, y, z) are aggregated into larger time frames and such aggregates are than used to plot the sleep graph.

Basics – actigraph, hypnogram and noise graph


  • TOP: the actigraph shows how much you were moving throughout the night
  • MIDDLE: the hypnogram shows your sleep phases progress during the night.
    • Light green column (highest) = you’ve been awake
    • Medium green column = light sleep
    • Dark green column = deep sleep or REM phase
  • BOTTOM: the grey noise graph shows how much noise (sleep talk, snoring, environment) was there throughout the night

Graph with lines (red line, blue line)


  • Red line – heart rate through the night. Red dots with numbers inside are the maximum and minimum heart rate.
  • Blue line – breathing rate if you are using sonar, blood oxygen level if you are using oximeter. Blue dots with numbers indicate maximum and minimum.

A healthy sleep (assuming you are a monophasic sleeper) is 7-8 hours long and consists of 5 sleep cycles where the first lasts for 70-100 minutes and the consequent cycles get longer but lighter. Each cycle consists of 5 stages lasting usually 5-15 minutes. Stage 1 and 2 are considered light sleep and this is the best time to be woken up in the morning.
So a healthy sleep cycle looks like a 10-30 minutes of light sleep (high peaks) followed by an area of deep sleep (low peaks or no peaks) lasting 40-100 minutes.
Different resources on sleep may provide different figures though.

NOTE: In case only actigraphy is employed the ~REM figure in the graphs is just an assumption based on  and is not directly based on common knowledge on sleep. In general actigraphy is not powerful enough to directly recognize the REM phases. In case you use an additional heart rate sensor we do REM phase detection on a the combined activity and heart rate data (see Wearable)

From the above we can conclude that deep sleep % may actually range between 30%-70%. Figures out of this range may indicate either incorrect sleep tracking setup (see Setup sleep tracking) or some sleep issues. For example very low deep sleep % may indicate either sleep deprivation or issues in your life style such as higher alcohol or caffeine intake, not enough sport etc. See an example of such sleep graphs in the figure below.


Graph with markers (icons)

Beside deep sleep marked with a green dashed line and light sleep marked in blue, there are several other events depicted in the sleep graphs.

  • inv_ic_action_smart  smart wake up period, further described in Alarms
  • inv_ic_action_noise  snoring events, as described in Snoring detection
  • inv_ic_action_pause  periods when sleep tracking has been paused, as described in Sleep tracking
  • inv_ic_action_mic  noise recordings, as described in Noise recording
  • inv_ic_action_time  alarms and snoozed within the sleep graph
  • inv_ic_action_sunrise surise and sunset times

For more details on the tracked sleep measured, please consult Statistics.

Smart wake up

Normal alarm clocks don’t care about sleep cycles and they trigger alarm regardless whether you are in a light or deep sleep phase. That’s the reason why you may feel tired after wake up even though you slept long enough. Waking up from a deep sleep phase is unnatural and may cause you feel disoriented, exhausted and sleepy. Waking up in a light sleep phase on the other hand feels natural and is similar to the experience of waking up on the weekend without an alarm clock at all.Sleep as Android is different. It uses the sleep phase information based on accelerometric sensors in your mobile phone to recognize your sleep phases. In general you specify a time window during which you wish to be woken up and the Smart wake up algorithm looks for significant light sleep indications to trigger the alarm. For more info on Smart wake up please refer to Smart wake up.

In the actigraph, smart wakeup period is marked by a red hashed line, see below.


Sleep advice

With the modern hectic lifestyle it is more and more difficult to get enough deep sleep. There is stress, noise from the street and many more factors which lower your deep sleep %. From that perspective we can see the aim of maximizing deep sleep % as an interesting goal in improving your sleep. We have implemented a simple polynomial regression analysis of your deep sleep % in relation to sleep length and fall asleep hours to advice you on better sleep habits to maximize deep sleep percentage. This analysis is available when opening Charts as you can see on the images below. In this example highest deep sleep percentages are achieved with fall asleep hour around 2:43 and sleep length 9:26.


Of course such advice needs to be taken only as a slight guidance in which direction you may adjust your sleep habits. But we don’t recommend to do any dramatic changes. Rather gradual iterative adjustments with feedback from the sleep tracking are recommended. Also the performed analysis always needs some correction and interpretation from the user.


More on sleep data analysis in Statistics and Advice.

Snoring detection

Over a long period of time we have been gathering snoring samples in order to use machine learning algorithms and to teach Sleep as Android to detect snoring. Currently our algorithm is already performing very well. It is based on a training set of 600 snoring recordings and we are constantly gathering new and adding to the set in order to improve snoring detection accuracy. For more on snoring please refer to Snoring detection.

Heart rate detection

If you are using a smartwatch with HR sensor or a dedicated HR strap, you can use those to gather heart rate data. HR data make the whole sleep tracking much more accurate, especially distinguishing between sleeping and being awake, which actigraphy alone does not do well.

More on heart rate detection