Detect Sleep Cycles

Using history to Detect sleep cycles.

Sleep cycles are 90-110 minutes in duration, and at the end may be interrupted by a brief awakening. Consider the image below: (Here’s a hypnogram showing sleep stages, courtesy of Wikipedia)

Lucid dreaming app accurately captures the intensity of user’s activity throughout the night. As the user becomes more active, the intensity of activity increases, producing easily detectable peaks, indicating the lightest sleep throughout the night. Activity above a certain level indicates full awakening, such as getting out of bed.

The easiest way to find out your REM cycles is to look at the history plot like the one below:

By looking at the sleep score graph above, it becomes evident that sleep cycles for the blue graph may involve from sleep onset until 2:00AM, from 2:00Am until 3:20, from 3:20 until 5:00, from 5:00 until about 6:30 and from 6:30 until 8:00. Note that both graphs involve different going to sleep time, although the duration of sleep is roughly the same.


Sleep scores for 4 days are different except for a similar activity between 3-4AM

When comparing 3 or 4 day sleep history, the results are different. The sleep cycles can still be identified, but they don’t align as I’ve expected. This could be due to different times going to bed. My hypothesis is that with consistent sleep schedule, the patterns will align more precisely.

Sleep cycles for REM detection

My accelerometer malfunctioned last night, but otherwise the app still worked and data looks very promising. I went to bed at 00:01 and experienced an intense night of dreaming. The cool thing is that my awakenings to recall dreams were pretty evenly spaced.

Dreams (triangles) and awakenings (circles) are spaced evenly at 80-90 minutes.

As the night progressed, the REM periods became long and shallow enough for me to wake up twice and remember 2 dreams/dream episodes. I expect the 80-90 minute period between dream recall to be my Sleep Cycle duration.



[Placeholder for instructions on how to tune the sleep cycle detection method]


Insomnia case – what not to plot.

I had the misfortune of experiencing insomnia on April 13th and 14th, and here’s the activity graphs for those days. Notice that the plot uses the same axis as the ones above. Large spikes at regular intervals indicate tossing and turning due to being uncomfortable and unable to sleep. Spikes in sleep score cutting off the chart indicate getting off the bed or a very significant movement.

Here are two regular days plotted on the same graph as insomnia days. It is evident that the insomnia level of activity dwarfs even the largest activity experienced during regular nights. This is why it is important to separate nights with “good” data from nights with “bad” data.

Comparing regular sleep days (red and blue) to insomnia days (mustard and green)

Using this information I expect to be able to create a better way to set rules for delivering voice reminders.