Every night, millions of people struggle with poor sleep, often without realizing the cause. Snoring, sleep apnea, and other disruptions silently affect their health, energy, and productivity. Left unchecked, these issues can lead to long-term risks like hypertension, fatigue, and reduced quality of life.
Traditional sleep studies, while accurate, are costly, time-consuming, and require overnight stays in clinical labs. This makes them inaccessible for many who need answers.
SnoreSense was created to change that. It’s an affordable, portable, and AI-powered sleep quality monitor designed to track snoring activity, detect breathing irregularities, and analyze sleep patterns — all from the comfort of your home. By transforming complex sleep data into simple, actionable insights, SnoreSense empowers users to take control of their sleep health, improve their daily energy, and protect their long-term well-being.
Components Used
Hardware
- Seeed Studio MG24 Sense
Software & Tools
- Simplicity Studio IDE (for firmware development)
- Edge Impulse Studio (for model Training)
- TensorFlow Lite Micro (for running AI model inference on MCU)
- C/C++ programming
- Custom Snore Detection ML Model (trained on snore vs. non-snore audio samples)
- Android/iOS App (future expansion) for displaying sleep score & history
The dataset for snoring vs. non-snoring audio can be sourced from Kaggle (public audio datasets).
- The dataset for snoring vs. non-snoring audio can be sourced from Kaggle (public audio datasets).
- Alternatively, you can record your own dataset using a microphone in different conditions (quiet background, fan noise, conversations, actual snores).
- Make sure you label the dataset into two classes: Snore and Non-Snore.
- Go to Edge Impulse Studio.
- Create a new project (e.g., SnoreSense AI).
- Select Audio Classification project type.
- Upload your datasets (Snore / Non-Snore audio samples).
- Use MFCC (Mel Frequency Cepstral Coefficients) feature extraction for audio preprocessing.
- Add a Neural Network (Keras) block for classification.
- Train the model and validate accuracy.
- Once trained, go to Deployment → TensorFlow Lite for Microcontrollers.
- Download the generated
.tflite
model file from Dashboard.
- Open Simplicity Studio IDE.
- Create a new empty C++ project for your target device (e.g., EFR32xG24).
- Copy the
.tflite
file into the config folder of your project. - Enable AI/ML SDK in the project settings.
- Go to Project → Properties → SDKs and enable AI/ML SDK.
- Build the project.
- The
.tflite
file will be automatically converted into.c
and.h
array files, which will appear inside the autogen folder of your project. - The
.tflite
file will be automatically converted into.c
and.h
array files, which will appear inside the autogen folder of your project.
- You check the other information on the silicon lab website
Data Flow:Microphone → MCU (Noise Filtering + AI Inference) → Snore Events → Sleep Score → Bluetooth → Smartphone App
Key Algorithms:
- Adaptive silence threshold
- RMS-based amplitude filtering
- TensorFlow Lite Micro inference
- Snore probability margin filtering
- Sleep score calculation
User Experience:
- Place SnoreSense device near bed.
- Device listens and detects snores overnight.
- Sleep score & snore insights are available on smartphone app.
Install the Silicon Labs Arduino Core and required libraries:
- Add this in Arduino IDE Preferences: https://siliconlabs.github.io/arduino/package_arduinosilabs_index.jsonInstall the Silicon Labs board files from board manager.
- Create a new Arduino sketch.
- Include the necessary headers:
#include <SilabsMicrophoneAnalog.h>
#include "SilabsTFLiteMicro.h" - Copy the
.c
and.h
files (generated from Simplicity Studio) into your Arduino project folder. - In your Arduino code, configure the microphone and inference logic (as in your final working snore detection sketch). Check the steps given on the Github.
Sleep Quality Monitoring
- Count snore events per hour.
- Track intensity, frequency, and duration of snoring.
- Compute Sleep Score using formula:
Sleep Score = 100 – (Weighted impact of snore frequency, duration, intensity)
- Classify sleep into categories: Excellent, Good, Fair, Poor.
- You can find the full working code on this github link.
Compile and upload the sketch to your development board.
Step 5: Testing and Verification- Place the device near the bed while sleeping.
Open Serial Monitor to view:
- Snore detected / No snore detected
- Sleep score update
Verify that the inference results match real-world audio input.
Bluetooth Communication (Future Integration
- Transmit snore events, sleep score, and timeline to smartphone.
- Display results in a mobile app with daily/weekly/monthly trend.
- Transmit snore events, sleep score, and timeline to smartphone.
- Successfully detects snores in real-time.
- Adaptive threshold reduces false positives from fan noise and speech.
- System computes sleep score based on snore patterns.
- Basic results displayed via Serial Monitor, with planned mobile integration.
- Personal sleep monitoring at home.
- Early detection of potential sleep apnea or breathing disorders.
- Non-invasive sleep quality assessment.
- Integration with smart home/IoT devices for health tracking.
- Android/iOS Mobile App for:
- Sleep score dashboard
- Snore pattern visualization
- Long-term trends & cloud sync
- Integration with Wearables (heart rate, SpO2) for comprehensive sleep monitoring.
- Machine Learning Improvements – refine model with more diverse datasets to distinguish snore vs. speech more accurately.
- Alerts & Smart Actions – vibrate a smart band or adjust smart home devices (e.g., increase room airflow) when excessive snoring is detected.
SnoreSense showcases the potential of combining edge AI with low-power hardware to address one of the most overlooked aspects of health: sleep quality. By detecting snoring patterns and analyzing sleep disturbances in real time, it bridges the gap between costly, clinical-grade sleep studies and the growing need for accessible, home-based solutions. Its lightweight design and efficient on-device inference demonstrate how advanced AI can run locally without reliance on cloud processing, ensuring both privacy and responsiveness.
With planned Bluetooth app integration, SnoreSense will not only track and analyze data but also present actionable insights to users in an intuitive way. This transforms it from a simple monitoring tool into a comprehensive personal health companion. For millions struggling with snoring or undiagnosed sleep disorders, SnoreSense has the potential to provide early detection, better self-awareness, and improved long-term well-being — all at an affordable cost.
Comments