Analyze your sleep cycles with ESP8266. Assess sleep quality and find out about personal sleep-habits.
In this project, we record motion data during sleep to analyze our sleep habits.
The setup on this page is designed to be active during sleep hours to collect sleep data. Analysis of this data provides valuable insight into your sleep activity.
For example: Long term data collection reveals sleep habits and can help you find out important facts about your personal sleep - such as the relationship between wake-up time and sleep quality, sleep quality of naps vs. sleep quality at night, etc.
Soldering iron for preparation of the sensor module
Sostware:
We assume you are starting from scratch; only in posession of items mentioned in the BoM.
If your sensor comes with seperate header pins I recommended you to solder them onto the chip first (the ESP8266 usually ships with pre-soldered header pins). If you are just getting started with soldering you can find guidance on this task here: https://www.instructables.com/Solder-Arduino-Header-Pins-Easily/
Setup Arduino IDE with ESP8266 on your computer. You need to do this in order to compile and upload the code onto the ESP. Follow advice from these sites if you don’t know how to do this:
Clone the repository and open esp.ino in the Arduino IDE. Change your SSID and password in the seperade arduino_secrets.h file. Maybe you want to adjust the configuration in the source code as well. When you are read hit upload.
The ESP will start gathering data as soon as it is connected to a power source. When you want to fetch the data from your compyter follow these steps:
Using the analyze_data.pyt script we can perform automated analysis of our sleep-data. The results will be displayed in a graph.
From the sensor data we can get an approximate view on our sleepcycles:
script.py <filename>
Example usage:
retrieve_data.py mySleepToday
analyse_data.py mySleepToday
retrieve_data.py
analyze_data.py