The problem
Cough frequency is a useful signal in respiratory studies, but counting coughs today means either manual tallying or shipping audio to the cloud — expensive, power-hungry and a privacy problem. TinyML changes the trade: a microcontroller can run a small neural network on-device, so the wearable decides locally and only the event (timestamp + confidence) leaves the device. This project builds that wearable. An ESP32-S3 board with an INMP441 MEMS microphone samples audio in short windows, computes mel-scale spectral features, and runs a TensorFlow Lite Micro CNN trained on cough-vs-non-cough audio (built from the public COUGHVID corpus plus custom-collected samples). A majority-vote smoother turns window labels into cough events, which are logged to flash and synced over BLE to a phone dashboard with the day's count, an hourly chart and a confidence-filtered event log. The report is explicit about the model's limits: it counts cough-like sounds, it does not diagnose anything, and accuracy is measured on the student's own test set during the build.
How it works
- The INMP441 microphone streams audio to the ESP32-S3 over I2S in short overlapping windows.
- Firmware computes mel-scale spectral features for each window — the same feature recipe used in training.
- The quantized TFLite Micro CNN scores each window as cough or non-cough; scores below the confidence threshold are discarded.
- A majority-vote smoother across consecutive windows merges sustained detections into single cough events with timestamps.
- Events are written to on-flash storage and advertised over BLE; the phone dashboard pulls new events on connect.
- The dashboard renders today's count, the hourly distribution chart and the confidence-filtered event log.
- Training happens offline: cough and non-cough clips are curated, augmented, and used to train and quantize the model that is flashed to the device.
Tech stack:
- ESP32-S3 (TinyML-capable, BLE on board) with Arduino/ESP-IDF firmware
- INMP441 MEMS I2S microphone
- TensorFlow Lite Micro (quantized CNN, on-device inference)
- Python training pipeline (feature extraction, augmentation, training, quantization)
- COUGHVID public corpus + custom-collected samples for training data
- Phone web dashboard over BLE (count, hourly chart, event log)
| Parameter | Value |
|---|---|
| Controller | ESP32-S3 with BLE |
| Microphone | INMP441 MEMS, I2S interface |
| Model | Quantized CNN via TensorFlow Lite Micro, mel-spectrogram input |
| Training data | COUGHVID public corpus + custom-collected cough/non-cough clips |
| Output | Cough events: timestamp + confidence; hourly counts |
| Privacy | On-device inference only; no audio stored or transmitted |
| Battery | Li-Po cell; design target of a full day per charge (usage-dependent estimate) |
| Evaluation | Accuracy, precision, recall on the student's held-out test set — measured during the build |
| Design target | Approximately 85%+ window-level accuracy (target, measured on your build, not guaranteed) |
Project features
- [On-device cough classifier] TFLite Micro CNN on the ESP32-S3 labels short audio windows as cough or non-cough locally — raw audio never leaves the device.
- [MEMS microphone front end] INMP441 I2S microphone with configurable gain; firmware documents the sampling setup and wind-noise behaviour.
- [Spectral feature pipeline] Mel-scale spectrogram features computed on-device from each audio window before inference.
- [Event smoothing] Majority-vote window over consecutive labels converts raw detections into discrete cough events with timestamps.
- [BLE phone dashboard] Cough count today, hourly bar chart, event log with confidence scores, and device battery level over Bluetooth Low Energy.
- [On-flash event log] Events persist in flash across power cycles and sync to the phone when it reconnects.
- [Privacy by design] No audio recording, no cloud upload — only timestamped event labels leave the wearable, stated as an explicit design guarantee.
- [Complete training pipeline] Dataset curation, augmentation, training and on-device evaluation notebooks; confusion matrix computed on the student's held-out test set.
What is included
- Complete ESP32-S3 firmware (audio capture, feature extraction, TFLite Micro inference, event logging, BLE)
- Training pipeline (dataset curation, augmentation, training, quantization, evaluation notebooks)
- Phone dashboard web app (count, hourly chart, event log, battery) over BLE
- Wearable assembly guide (board, microphone placement, battery, enclosure)
- Data-collection procedure for custom cough samples (consent and hygiene notes included)
- Project report PDF (background, TinyML design, training, evaluation, limitations)
- PPT presentation for final review
- Viva Q&A preparation document (TinyML, quantization, spectral features, BLE, evaluation)
- Setup guide (environment, training, flashing, dashboard pairing)
Limitations & prerequisites
- This is an academic prototype, not a medical device: cough counts are indicative and must never be used for diagnosis, treatment decisions or health monitoring. The report and dashboard carry this warning.
- The model detects cough-like sounds — throat clearing, loud laughter and similar transients can trigger false positives; the evaluation documents the confusion patterns openly.
- Wind noise and a loose microphone mount degrade detection; the assembly guide documents placement and the firmware's gain staging.
- No clinical accuracy is claimed; performance is measured on the student's own held-out test set, which cannot represent all voices, ages and environments.
- Battery life is estimated from the power budget — continuous inference plus BLE advertising drains faster than the headline figure in noisy environments.
- Training a robust model needs a diverse custom dataset; the COUGHVID corpus helps, but the report is honest that dataset bias is the main accuracy risk.
Frequently Asked Questions
Which dataset is used?
The public COUGHVID corpus of crowdsourced cough recordings plus custom-collected cough and non-cough clips. The notebook documents the exact composition, the train/test split and the augmentation used.
Does the wearable record or upload audio?
No. Inference runs entirely on the ESP32-S3; only timestamped cough events with confidence scores leave the device over BLE. No audio is stored or transmitted — this is an explicit design guarantee.
Is the accuracy guaranteed?
No. The design target is approximately 85%+ window-level accuracy, but the training notebook measures accuracy, precision and recall on your held-out test set during the build, and the report documents your own numbers.
Can it distinguish coughs from throat clearing?
Imperfectly — similar transient sounds are the main false-positive source, and the confusion matrix in the report shows this openly. The confidence threshold is tunable to trade sensitivity against false alarms.
Is this a medical device?
No. It is an academic prototype for demonstrating TinyML audio classification. It must not be considered a replacement for certified medical equipment, professional diagnosis or clinical decision-making.
Is this project suitable for a final-year project?
Yes — for Electronics, IoT and AI/ML programs. It demonstrates TinyML deployment, quantization, audio feature engineering, BLE systems and honest evaluation of a health-adjacent prototype, all strong viva material. Suitable for B.E./B.Tech final-year projects in Electronics, IoT and AI/ML.
Components & software requirements
- ESP32-S3 (TinyML-capable, BLE on board) with Arduino/ESP-IDF firmware
- INMP441 MEMS I2S microphone
- TensorFlow Lite Micro (quantized CNN, on-device inference)
- Python training pipeline (feature extraction, augmentation, training, quantization)
- COUGHVID public corpus + custom-collected samples for training data
- Phone web dashboard over BLE (count, hourly chart, event log)
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.