Blog Home

Tracking sleep quality with embedded ML and the Arduino Nano 33 BLE Sense

Arduino TeamJanuary 10th, 2023

Ensuring adequate and restful sleep is vital for maintaining good health, as decreases in sleep quality have been proven to cause a whole host of problems. University of Toronto researchers Zongyan Yao and Xilin Liu recognized this vital aspect to well-being and wanted to build an inexpensive device that could classify the various stages of sleep as well as report the resulting data wirelessly.

Clinical sleep evaluation is performed by taking polysomnograms, which are essentially measurements of brain, heart, respiratory, and other physiological features. Zongyan and Xilin decided on using an Arduino Nano 33 BLE Sense to classify single-channel EEG values with a lightweight machine learning model due to its relatively fast processor and available RAM. Training data for the model was sourced from the Sleep-EDF Expanded Database that contains several hours of sleep telemetry, including EEG, EOG, airflow, and body temperature, although only the EEG data was kept.

After preprocessing the dataset’s values to between 0.1 and 10, the team trained a custom 1D convolution model to classify each stage of sleep ranging from awake to rapid eye movement (REM), thereby yielding an accuracy of 77%. They were able to further increase this metric by performing subject-specific training, further increasing it. In the future, Zongyan and Xilin plan on developing their project further by adding an EEG sensor to enable a wide range of sleep research. More information can be found here in their paper.

Image credit: Z. Yao et al.


Leave a Reply

You must be logged in with your Arduino account to post a comment.