The problem
Snoring is the most common sleep complaint people actually want measured — "how bad is it, really?" — yet the answer is usually a partner's grumpy estimate. Phone apps exist, but they upload bedroom audio to the cloud and drain the phone. This project takes the embedded route: a sensitive electret microphone with automatic gain control listens all night, an ESP32 analyzes the audio stream in real time for the loud, quasi-periodic bursts characteristic of snoring, and every detected event is timestamped and logged to a microSD card as a small CSV — no audio is stored, only event metadata, so privacy is structural. In the morning the OLED shows a sleep report: total snore events, the loudest episode, the longest quiet stretch, and an estimated sleep-quality score. A single button starts and stops the night, and a real-time clock keeps the timestamps honest across power cycles.
How it works
- The user presses the button at bedtime; the ESP32 starts sampling the MAX9814 microphone output at ~8 kHz into a rolling buffer.
- Firmware computes short-time energy in 100 ms frames and tracks periodicity — snores show as loud bursts repeating every few seconds.
- When energy crosses the adaptive threshold with the right burst pattern, an event opens; it closes after 10 seconds of quiet, and is logged with timestamp, duration and peak level.
- The adaptive threshold slowly follows room background noise, so a fan or air conditioner does not flood the log.
- At wake-up a long press ends the session; firmware aggregates the night's events into the morning report shown on the OLED.
- The CSV log on the microSD card accumulates night after night for trend review on a computer.
Tech stack:
- ESP32 dev board
- MAX9814 microphone amplifier + electret mic
- DS3231 RTC · microSD card module
- 0.96 inch OLED display (I2C)
- Pushbutton · 5 V USB power
- Arduino IDE · C/C++ firmware
| Parameter | Value |
|---|---|
| Audio sampling | Approximately 8 kHz, rolling RAM buffer (design target) |
| Analysis frames | 100 ms energy + periodicity check |
| Detection | Adaptive energy threshold with burst-pattern validation |
| Logging | CSV on microSD: timestamp, duration, peak level |
| Report | Total events, loudest episode, longest quiet stretch, 0–100 score |
| Timekeeping | DS3231 RTC with battery backup |
| Power | 5 V USB, approx. 120 mA (expected) |
| Privacy | No audio stored or transmitted — metadata only |
Project features
- [On-device snore detection] Energy-plus-periodicity analysis on the ESP32 flags snore-like bursts in real time — no cloud, no phone, no audio ever leaves the device.
- [Privacy by design] Only event metadata (timestamp, duration, peak level) is logged to microSD; raw audio is processed in RAM and discarded, which the report documents as a design guarantee.
- [Automatic gain control] MAX9814 microphone amplifier with built-in AGC keeps quiet-room sensitivity high without clipping on loud snores.
- [Morning sleep report] OLED summary at wake-up: total events, loudest episode time, longest quiet stretch and a 0–100 sleep-quality estimate from event density.
- [Timestamped CSV logging] Every event lands on the microSD card with date, time, duration and peak level — weeks of data open directly in a spreadsheet for analysis.
- [One-button operation] A single press starts the night session; a long press ends it and shows the report — usable in the dark, half-asleep.
- [RTC timekeeping] DS3231 keeps event timestamps accurate even if the device is unplugged between nights.
What is included
- Working sleep monitor prototype (ESP32, microphone module, RTC, SD card, OLED, button)
- Complete firmware source with detection algorithm and report generator
- Wiring diagram and bedside enclosure guidance
- Detection-threshold tuning procedure for the buyer's room
- Project report PDF (background, audio analysis theory, algorithm, testing)
- PPT presentation for final review
- Viva Q&A preparation document (sampling, energy detection, AGC, SD logging)
Limitations & prerequisites
- Snore detection is heuristic (energy + periodicity), not clinical polysomnography — it estimates snoring activity; it does not diagnose sleep apnea or any medical condition, and the page and report state this plainly.
- Very quiet rooms with loud HVAC can raise the adaptive threshold and miss soft snores; the tuning procedure addresses the buyer's own room.
- The 0–100 sleep-quality score is a simple event-density heuristic for demonstration, not a validated clinical metric — described as such.
- Detection accuracy is not claimed as a measured figure; the report documents the buyer-run validation procedure (annotated test nights) instead.
- One microphone covers one side of the bed; partners' snores in the same room will also be picked up.
Frequently Asked Questions
How does it tell a snore from other noises?
Snores are loud bursts that repeat every few seconds. The firmware looks for that combination — high short-time energy plus a repeating pattern — rather than just loudness, which rejects most one-off noises.
Does it record my bedroom audio?
No. Audio lives only in a rolling RAM buffer for analysis and is discarded; the SD card stores only event metadata (time, duration, peak level).
Can it diagnose sleep apnea?
No — and it makes no such claim. It is a wellness demonstrator that quantifies snoring activity; anything medical needs a proper sleep study.
What do I do with the CSV log?
Open it in any spreadsheet to see snoring patterns across nights — useful for showing a doctor, or for correlating with lifestyle changes.
Will my room fan confuse it?
The adaptive threshold follows steady background noise like fans, so constant hums are ignored; only bursty sounds above the background trigger events.
Is this project suitable for a final-year project?
Yes — for Electronics and IoT & Embedded programs. It is real-time DSP on a microcontroller: sampling, energy analysis, adaptive thresholds and data logging with a privacy-first design. Suitable for B.E./B.Tech final-year projects in Electronics and IoT & Embedded.
Components & software requirements
- ESP32 dev board
- MAX9814 microphone amplifier + electret mic
- DS3231 RTC · microSD card module
- 0.96 inch OLED display (I2C)
- Pushbutton · 5 V USB power
- Arduino IDE · C/C++ firmware
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.