Fitbit Sleep Data Analysis

After my previous entry for a Facebook conversation analyzer I thought to share another recent project of mine, this time related to sleep, here the article I wrote.

Is a simple Python project for generating and visualizing sleep related stats. You can find the source code in my Github repository. As specified in the article I relied on another open source code to scrape all the intraday data directly from the Fitbit website.
Open to all kind of critiques and suggestions.


Hi Sagado,

Thanks for sharing this. Did you look at sleep interruptions, for example to see how much your device accurately detected them (or not)?

Hi Luke,

Fitbit has three possible values for a recorded sleep entry:
1= sleeping, 2= restless, 3= awake

I am not aware of the precise way on which these values are calculated, should be mostly based on how much you move around during sleep. Supposedly the more you move the less good your sleep is.

Is not easy to actually check how accurate the device is regarding this. One thing I wanted to try in the future is to actually record one or more night of my sleep with a night-vision/infrared camera, to actually see the correspondence between my movements and the Fitbit results.

Hi Sagado,

Thanks for your feedback.

I have about 360 nights video-recorded while sleeping with a Fitbit (out of about 1,200 nights video -recorded) and have been looking at how well it can track my sleepwalking. The results are pretty bad for Fitbit (and any other device I have tested).

If considering only times when I got out of bed, Fitbit sees them only 50% of the time.
If I includes all sleepwalking activity (things like sitting in bed and searching the bed) it drops down to around 10%.

I am still looking to find someone that has done a similar correlation, not necessarily in relation to a sleep disorder, to better understand what data from those devices is reliable. At this point I only consider sleep onset (from an aggregate of at least 3 devices) and a changing heart rate to be reliable. But would love to use more than that, should I see some evidence of accuracy, since I have tons of data collected.

Seems like you are definitely more acknowledged and equipped than me regarding the subject.

Many commented on the poor fidelity of the Fitbit measurements, but many times is mostly about it being “too sensitive”, so I am surprised to hear about your results. Such relevant movements as getting out of bed or even walking should definitely be identified.

My personal analysis was more inspired by my interest in dreams and lucid dreams, while I have luckily no sleep disorders. I already tried to check basic correlations between sleep and heartbeat, but didn’t get anything with a high enough values. From my knowledge of sleep states I know that different NREM and REM stages are associated with precise heartbeat levels, brain waves types and also behavior (sleepwalking should take place exactly during NREM 4), but I concluded that in no significant way I can derive these stages from the Fitbit data. EGG technologies seems still kind of the only way to go for such analysis.