Built to order

Sleep Quality Monitor with Snore Detection using ESP32

This project builds a bedside sleep monitor that listens through the night and reports on snoring. A MAX9814 microphone amplifier feeds audio to an ESP32, which detects snore-like sound bursts by energy and periodicity analysis, logs each event with a timestamp to microSD, and shows a morning summary — total snores, loudest episode, longest quiet stretch — on an OLED. A one-button interface keeps it usable half-asleep, and everything is processed on-device with no audio leaving the room. Suitable for B.E./B.Tech final-year projects in Electronics and IoT & Embedded.

Sleep Quality Monitor with Snore Detection using ESP32 — project thumbnail preview
More project photos (2)

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

  1. The user presses the button at bedtime; the ESP32 starts sampling the MAX9814 microphone output at ~8 kHz into a rolling buffer.
  2. Firmware computes short-time energy in 100 ms frames and tracks periodicity — snores show as loud bursts repeating every few seconds.
  3. 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.
  4. The adaptive threshold slowly follows room background noise, so a fan or air conditioner does not flood the log.
  5. At wake-up a long press ends the session; firmware aggregates the night's events into the morning report shown on the OLED.
  6. 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.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of an ESP32 development board at the centre, with sensor nodes, data-flow arrows and a circuit-brain motif representing an AI agent reasoning and sending decisions back.Engineering students building IoT or embedded final-year projects who want to add local AI agent behaviour with ESP32, MQTT and a small language model.

AI Agents on ESP32: Agentic IoT Final-Year Projects

An agentic IoT system observes, reasons, acts, remembers and explains. On ESP32 that means a split architecture: the chip senses and acts while a small local model (Ollama on your laptop) reasons over MQTT — a full LLM needs gigabytes of RAM the chip doesn't have. This guide covers three working patterns (host-reasoned agent, on-device tinyML on ESP32-S3, and a hybrid of both), plus Wi-Fi CSI presence sensing, parts and budget for India, code shapes, and honest limits to state in your report.

Read guide
Technical illustration of three electronic control units linked by a twisted-pair CAN bus cable carrying signal pulses between them.Electronics, E&TC, IoT and robotics students who keep hearing “CAN bus” in EV, automotive and industrial project ideas and want to understand it properly before wiring anything

CAN Bus Basics for Students: How ECUs Communicate

CAN bus is the shared network that lets dozens of controllers in a car, EV or robot communicate over two wires. This guide explains message IDs, arbitration, the physical layer, frame structure, error handling and CAN FD, then walks through building a working two-node bench network with an ESP32 and a transceiver.

Read guide
Illustration of a quadcopter drone build showing labeled parts including frame, motors, propellers, ESCs, flight controller, and battery.B.E./B.Tech Electronics, Mechanical, and Computer Science students planning to build a quadcopter drone who need to select compatible parts without wasting money on mismatched

Drone Build: Parts Selection Guide

Picking drone parts that actually work together is a sizing problem, not a shopping problem. This guide walks the compatibility chain — frame to props to motors to ESCs to battery — with the thrust math, firmware choices, LiPo safety, and the bench-test order that prevents disasters.

Read guide
Get a quotation