Skip to content
Projects
Academic prototype2026Arduino Nano 33 BLE Sense Rev2C++PythonTinyMLIMU

TinyML Vibration Anomaly Detection on Arduino Nano 33 BLE Sense Rev2

A lightweight softmax model classifies local IMU windows as NORMAL or ANOMALY and triggers ALERT after three consecutive anomaly windows.

Role

I built the pipeline from synthetic-data generation and feature extraction to model training, C++ export and on-device inference.

Key results

98.61%
Offline test accuracy · synthetic dataset
~1 ms
Measured inference latency
12% flash · 19% RAM
Compiled resource usage

Problem and constraints

Small fans and motors can develop abnormal vibration before failure. A node device should detect this locally with low memory use, no cloud dependency, and a clear live output for the operator.

Security

The device processes motion locally and does not transmit sensor data. The design keeps the demo self-contained and avoids credentials, network dependency, or external services.

Reliability

The sketch uses overlapping windows, normalized features, an anomaly probability threshold of 0.60, and a 3-window ALERT persistence rule so a single accidental bump does not immediately become a final alert.

What I built

I generated balanced synthetic vibration windows, extracted 20 statistical features from 2-second IMU windows, trained a two-class softmax model, exported means, standard deviations, weights, and biases into model_parameters.h, and implemented the same processing path in Arduino C++.

Architecture

System design flow

TinyML Training and Local Inference Flow

End-to-end TinyML architecture for vibration anomaly detection: offline Python training, C++ model parameter export, Arduino deployment, local IMU sampling, softmax inference, Serial Monitor output, and built-in LED alerting.

Open full diagram
TinyML Training and Local Inference Flow diagram for TinyML Vibration Anomaly Detection on Arduino Nano 33 BLE Sense Rev2
TinyML Training and Local Inference Flow

What the diagram shows

  • Separates offline training/export from the runtime path so it is clear that no cloud inference is used
  • Shows the embedded runtime loop: 100 Hz sampling, 2-second windows, 50% overlap, 20 features, normalization, softmax inference, thresholding, and persistence
  • Includes the project result: 98.61% offline accuracy, about 1 ms inference latency, 12% flash usage, and 19% RAM usage

Technical Decisions

  • 100 Hz IMU sampling with 2-second windows and 50% overlap
  • 20 lightweight vibration features from X/Y/Z axes and combined magnitude
  • Two-class softmax classifier exported directly to C++ without a large inference runtime
  • Serial Monitor output for time, state, probabilities, persistence counter, and latency
  • Built-in LED alert after 3 consecutive anomaly windows

Validation

  • Trained and evaluated the classifier offline on the synthetic balanced dataset.
  • Checked Serial Monitor output for state, probabilities, persistence counter and latency.
  • Compiled the sketch on Arduino Nano 33 BLE Sense Rev2 and recorded flash/RAM usage.

Results

98.61%

Reached 98.61% offline test accuracy on the synthetic balanced dataset

about 1 ms

Measured about 1 ms inference latency in the Arduino Serial Monitor

12%

Compiled at 12% flash usage and 19% RAM usage on the Nano 33 BLE Sense Rev2

Live demo showed stable board as NORMAL, tap/shake as ANOMALY, sustained movement as ALERT, and recovery to NORMAL

Complete stack

Embedded Hardware

Arduino Nano 33 BLE Sense Rev2IMUBuilt-in LED

Training Pipeline

PythonSynthetic dataset20 vibration features

Runtime Model

C++TinyMLSoftmaxModel export

Validation

Serial MonitorOffline test setFlash/RAM report

Artifacts

Next technical step

Planned work

Validate the model with real measured vibration data beyond the synthetic balanced dataset.