When I got my Garmin watch near the middle of last year, I thought it would help me to better track my day and to optimize how I spend my time.

Unfortunately, I eventually realised that the smart watch is only so smart as the feedback that it has programmed into it and how you change your habits based on what it is telling you.

The watch has a number of sensors built into it, in general, it measures your steps and heart rate. The use of these sensors allows for a number of inferences to be made such as flights of stairs climbed, stress, and a number of other activities/analyses that are created in order to allow for greater insights.

This guy has some useful information on how reliable each of these pieces of information are. This is purely based on the fact that some of these features are inferred from multiple levels down the data collection system.

Anyways, what I really wanted to do was to download my data in order to see what I can do with the actual data. In doing this, I saw that the bulk data download provides some really convenient JSON files that hold a few pieces of data on each day and how you slept.

I created a GitHub repository to keep track of this process, it can be found here, it runs you through the process of downloading your own data and extracting it.

I just wanted to get an idea of how my sleep is compared to averages, or how much I should be sleeping.

Sleep Analysis and Research

There are numerous articles on the internet which speak about the best ways in which to sleep, how to organize your day to allow for better quality sleep, foods that you should/shouldn’t eat. I won’t cover these, instead leave this to the user and allow them to interpret their sleep data as they wish.

In order to provide some metrics or abilities to analyse sleep, I have looked at some journals that look into the science of sleep.

This article (and this one) has recommendations on the number of hours in a day that an individual should sleep based on their age. This is purely a recommendation and depends on the individual.

The SleepFoundation.org has some recommendations to attempt to get better sleep:

  • Stick to a sleep schedule, even on weekends.
  • Practice relaxing bedtime ritual.
  • Exercise daily.
  • Evaluate your bedroom to ensure ideal temperature, sound, and light.
  • Sleep on a comfortable mattress and pillows.
  • Beware of hidden sleep stealers, like alcohol and caffeine.
  • Turn off electronics before bed.

Some of these are not particularly suited to analysing with the data, however, I am taking note of some of these that may be easy to implement and test out.

This article, though not from a journal has some notes on what may be done to improve sleep. Take these with a pinch of salt as always.

Sleep Stages

In general, according to Wikipedia (and obviously whoever Wikipedia is referencing) sleep occurs two main stages, Rapid Eye Movement (REM) and Non-REM.

Each of these stages lasts for approximately ninety minutes, this means that in a normal sleep cycle, you will have 4 - 6 of these cycles.

The NREM cycle is broken up into three separate stages: N1, N2, and N3 where the last stage is often referred to as delta sleep or deep sleep.

The normal order of this is:

N1 –> N2 –> N3 –> N2 –> REM

The proportion of REM sleep is higher the closer to waking time. [1^]Interesting, I wonder if this is why I feel like I do most of my dreaming just before I wake up.