Sound Monitor is an IoT sound and acoustic pattern monitoring tool designed to capture live audio, analyze spectral characteristics (PSD / Power), detect target operational states (e.g., compressor/device ON/OFF), and record state transitions to a SQLite database.


STFT spectrogram of a compressor sound recorded in advance using a smartphone’s digital microphone.


PSD Welch 60-1000Hz


Welch PSD

Environmental conditions for measuring sound


Laptop with a built-in microphone

A laptop running Ubuntu Server with Docker installed was used for the setup. For measurements, only basic tools were available: an HP laptop and its built-in microphone.

Also, you can see the surge voltage protection device that will be used in the next project - Seven Segment Monitor.

Predictors & Detection Methods

SoundMonitor uses modular predictors inheriting from BasePredictor to classify audio states from Power Spectral Density (PSD) analysis.

Historical project began for different version of application and trey different solution since main problem is detect off state when is real-life environment sound and it will generate false positive events in day time. Now dev version v.0.6.0 start to implement for sound analyze CNN torch audio with VGGish models based on audio sets from YouTube-8M. 
The sound quality of the built-in microphone is so poor and noisy that I’ve decided to stop the project and switch to a more reliable method: visually checking the refrigerator’s power consumption by reading the amperage, where the OFF state is 00.0A and the ON state is 00.7A - Seven Segment Monitor.

Power Predictor (Currently in use)

Mechanism: Computes the band power in dB from the PSD signal (compute_band_power_db).

Classification: Compares the computed dB level against configured threshold levels (THRESHOLD_ON_POWER_DB, with hysteresis bounds THRESHOLD_ON_POWER_UP and THRESHOLD_ON_POWER_DOWN).

Scoring: Generates normalized confidence scores [0.0, 1.0] based on relative power levels between the ON and OFF bounds and applies penalty filtering for out-of-bounds power surges when evaluating smoothed states.


Power measurements for state OFF


Power measurements for state ON

PSD KNN (Alternative / Not currently active)

Mechanism: Template-matching k-Nearest Neighbors classifier on normalized PSD features.

Features & Alignment:

Employs signal alignment (compute_aligned_signals_batch) via cross-correlation against baseline templates.

Normalizes PSD vectors (e.g. L2 normalization and standard scaling) and extracts peak frequencies and frequency band metrics.

Computes cosine similarity / distance against recorded training templates (template_on_*.npz and template_off_*.npz).

Status: Maintained in codebase as an alternative template-based classifier; PowerPredictor is currently instantiated in detector.py.


PSD Spectrum for compressor ON state


PSD Spectrum for compressor OFF state

Diagrams


Mix temperature with ON/OFF states


False positive errors occurring in the ON state

Repositories: