During the night your body follows a 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 a method called sleep actigraphy (accelerometric movement measurement during sleep) which helps us to recognize your sleep phases when you are sleeping. This method in backed by several scientific researches which show that even not as precise as EEG it still provides comparable outputs and it is more convenient for the users.
The phone has an accelerometer sensor build in which is very sensitive and if placed in your bed we start receiving a record of your movement over night. In deep sleep your muscular movements are suppressed and thus in this phase the sleep graph gets flat.
Normal alarm clocks don't care about sleep cycles and they trigger alarm regardless whether you are in light or deep sleep. That's the reason why you may feel tired after wake-up even though you slept long enough.
Sleep as Android is different. It uses sensors in your mobile phone (e.g. accelerometer and orientation sensor) to track how you move during the night. Your body movements are directly related to your current sleep phase. Basically more movement means lighter sleep. The sensors on current Android smart phones are so sensitive, that even you place the phone on the mattress Sleep as Android is able to track significant differences in you sleep patterns.
Immediate movements are aggregated into larger time frames and such data is than used to plot the sleep graph. Below is an example real-life sleep graph. Usually a healthy sleep 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 from 5-15 minutes. Stage 1 and 2 are considered as light sleep and this is the best time to be woken up in the morning. So a healthy sleep graph should look like a 10-30 minutes of light sleep (high peaks) followed with areas of deep sleep with less or no peaks lasting from 40 to 100 minutes. Although different resources on sleep may provide different figures.
Currently we do not show the REM phase of you sleep specifically in the sleep graph, but it may be assumed in the second halve of each deep sleep period.
From that we can conclude that deep sleep % may actually range between 20%-80%, but 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.
In the figure below we see 5 sleep cycles with deep sleep phases duration from 25-80 minutes and light sleep duration from 10-50 minutes.
Many different factors such as alcohol, noisy environment, stress etc... may affect your sleep graph. Below is a graph which indicates such issue with many peaks throughout the night.
Because the sensitivity of sensors between phones differs, everyone has a different mattress and different intensity of movements the absolute values play not a big role. What is more important are relative changes in your movement during sleep. The graph than may be read as follows: separate the graph's Y-axis in three equidistant segments, where the bottom segment is the deep sleep, the middle segment is light sleep and the upper segment is being awake.
You can immediately recognize there is something wrong with the sleep graph below. For some reason there were no data from 7:35. Maybe the person being measured accidentally pressed the power button on the phone which resulted in no data from the sensors, or the battery got low and as the phone was not placed into the charger. Before you rely on Sleep as Android for your everyday wake-up, please make several test runs with it first to make sure your sleep graphs look as they should (even in case measurement does not work properly on your device/mattress, the alarm will fire in the specified time interval). But keep in mind that each sleep graph is unique and heavily affected by several different factors (for example consumption of alcohol before sleep).
Of course the idea of tracking sleep cycles using movements is not new. For years there are special devices around using the same principle, but they are quite costly (around $200) and as your mobile phone currently has all the components required, the question states why not to use them instead for a much lower cost and more features.
Moreover, during development of Sleep as Android the accuracy of the mobile phone sensors has been tested and compared with satisfactory results to special accelerometers used in medical applications (especially in psychiatry). Best results may be achieved using an armband or similar accessory, see refer to Accessories.