TinyML for Acoustic Anomaly Detection in IoT Sensor Networks
Authors: Amar Almaini, Jakob Folz, Ghadeer Ashour
Organizations: computer science, Deggendorf Institute of Technology, Deggendorf, Germany · Computer Science and Engineering, University of West Bohemia, Pilsen, Czech Republic · The Applied College, King Abdulaziz University, Jeddah, Saudi Arabia
Tiny Machine Learning enables real-time, energy-efficient data processing directly on microcontrollers, making it ideal for Internet of Things sensor networks. This paper presents a compact TinyML pipeline for detecting anomalies in environmental sound within IoT sensor networks. Acoustic monitoring in IoT systems can enhance safety and context awareness, yet cloud-based processing introduces challenges related to latency, power usage, and privacy. Our pipeline addresses these issues by extracting Mel Frequency Cepstral Coefficients from sound signals and training a lightweight neural network classifier optimized for deployment on edge devices. The model was trained and evaluated using the UrbanSound8K dataset, achieving a test accuracy of 91% and balanced F1-scores of 0.91 across both normal and anomalous sound classes. These results demonstrate the feasibility and reliability of embedded acoustic anomaly detection for scalable and responsive IoT deployments.
Figures & tables
Figure 1: TinyML pipeline for MFCC-based sound anomaly detection on IoT sensor nodes.
Parameter
Value
MFCC coefficients
13
Frame length
40 ms
Frame overlap
50%
Sample rate
16 kHz
Input shape
13 × 32
Hidden layers
[128, 64] (ReLU)
Table I: Model training and preprocessing parameters.
Model
Accuracy
F1-Score
ROC AUC
Avg. Precision
Original (float32)
0.95
0.95
0.991
0.992
Quantized (int8)
0.91
0.91
0.970
0.970
Table II: Model Performance Comparison Before and After Quantization
Class
Precision
Recall
F1-Score
Support
Normal (0)
0.88
0.94
0.91
3996
Anomalous (1)
0.94
0.89
0.91
4283
Accuracy
–
–
0.91
8279
Table III: Class-wise Evaluation Metrics for the Quantized Model
Figure 2: Confusion matrix showing predicted vs. actual labels for the binary classification of urban sounds.
Figure 3: ROC curve showing the model’s ability to separate normal and anomalous audio events.
Figure 4: Precision-Recall curve highlighting the trade-off between detection sensitivity and alert specificity.
Figure 5: Training and validation accuracy across 35 epochs. Early stopping triggered after performance plateaued.
Figure 6: Training and validation loss across 35 epochs. The model exhibits stable learning and generalization.
This paper presents a fully autonomous Tiny Machine Learning (TinyML) Z-Score-based anomaly detection system deployed on a low-power microcontroller for real-time monitoring of appliance behavior using power side-channel data. Unlike existing Internet of Things (IoT) anomaly detection approaches that rely on offline training or cloud-assisted analytics, the proposed system performs both model training and inference directly on a resource-constrained microcontroller without external computation or connectivity. The system continuously samples current consumption, computes Root Mean Square (RMS) values on-device, and derives statistical parameters during an initial training phase. Anomalies are detected using lightweight Z-Score thresholds, enabling interpretable and computationally efficient inference suitable for embedded deployment. The architecture was implemented on an STM32-based platform and evaluated using a 14-day dataset collected from a household mini-fridge under normal operation and controlled anomaly conditions. Results demonstrate perfect detection performance, with Precision and Recall of 1.00, inference latencies on the order of tens of microseconds, and a total memory footprint of approximately 3.3 KB SRAM and 63 KB Flash. These results confirm that robust and fully autonomous TinyML anomaly detection can be achieved on low-cost microcontrollers. Future work includes extending the framework to incorporate additional lightweight models and multi-device learning scenarios.
Abdulrahman Albaiz, Fathi Amsaad
Department of Computer Science & Engineering, Wright State University, Dayton, Ohio, USA
The rapid expansion of the Internet of Things (IoT) and its integration with backbone networks have heightened the risk of security breaches. Traditional centralized approaches to anomaly detection, which require transferring large volumes of data to central servers, suffer from privacy, scalability, and latency limitations. This paper proposes a lightweight autoencoder-based anomaly detection framework designed for deployment on resource-constrained edge devices, enabling real-time detection while minimizing data transfer and preserving privacy. Federated learning is employed to train models collaboratively across distributed devices, where local training occurs on edge nodes and only model weights are aggregated at a central server. A real-world IoT testbed using Raspberry Pi sensor nodes was developed to collect normal and attack traffic data. The proposed federated anomaly detection system, implemented and evaluated on the testbed, demonstrates its effectiveness in accurately identifying network attacks. The communication overhead was reduced significantly while achieving comparable performance to the centralized method.
Time-series anomaly detection is increasingly important in IoT systems, sensor networks, and edge monitoring applications, where models must operate under strict constraints on memory, latency, and power consumption. While recent deep-learning approaches have improved detection accuracy, many remain computationally expensive and often fail to capture subtle anomalies due to limited multi-scale sensitivity. Autoencoders are widely used for anomaly detection because they reconstruct normal patterns well, leading to elevated reconstruction errors for anomalous inputs. Their simplicity and efficiency also make them suitable lightweight backbones for handling multi-scale inputs. To address these challenges, we propose a Lightweight MultiScale AutoEncoder (LMSAE) network for univariate time-series anomaly detection, designed to be compact and computationally efficient. LMSAE leverages the Discrete Wavelet Transform (DWT) to extract multi-scale features and employs a multi-scale loss function to improve sensitivity to subtle or hidden anomalies. Experiments on benchmark datasets demonstrate competitive or superior detection performance despite using significantly fewer parameters and a model size of less than 500 KB. LMSAE also achieves low-latency, low-power inference on the NVIDIA Jetson Nano, with 9x reduction in inference latency and 2x reduction in power consumption, making it ideal for edge deployment.
Raheen Junaid Wani, Smruti R. Sarangi
School of Information Technology Indian Institute of Technology, Delhi New Delhi, India 110016 · Department of Computer Science Indian Institute of Technology, Delhi New Delhi, India 110016