// PROJECT 004

TinyML Vibration Fault Classifier

On-device anomaly detection for industrial motors — TFLite Micro model trained with Edge Impulse, deployed on STM32H7, achieving 94% accuracy at under 5mW. Detects bearing wear, imbalance, and misalignment before failure.

TFLite MicroEdge ImpulseSTM32H7CMSIS-NNDSPPythonC++
// RAW VIBRATION — X AXIS (bearing fault) — Normal — Bearing fault // FFT SPECTRUM (512-point) BPFO harmonics // INFERENCE RESULT normal........ 0.03 imbalance..... 0.05 misalign...... 0.04 bearing_out... 0.81 bearing_in.... 0.04 looseness..... 0.02 ALERT: BEARING_OUTER_RACE Confidence: 81% Inference: 18ms PIPELINE: ADC@8kHz → Windowing → FFT(512) → Feature extract → INT8 model → Alert via CAN Model size: 47KB Flash · Tensor arena: 80KB RAM · CMSIS-NN kernels · 3.7x speedup vs reference
94%Accuracy
<5mWPower
18msInference
8 classesFault Types
MCUSTM32H743 · ARM Cortex-M7 @ 480MHz · FPU
SensorADXL355 3-axis MEMS accelerometer · SPI
ModelMobileNet-v1 (0.1x) INT8 quantized · 47KB
FeaturesFFT spectral features · 512-point · 3-axis
InferenceCMSIS-NN kernels · 18ms @ 480MHz
Power18mW active · 0.36mW avg (10ms/500ms duty)
TrainingEdge Impulse · 12,000 labelled samples

Project Overview

Deployed an on-device machine learning system for predictive maintenance of industrial motors. The STM32H7 samples 3-axis vibration at 8kHz, computes FFT spectral features, and runs an INT8-quantized TFLite Micro model to detect 8 fault classes — all in 18ms with 94% accuracy, at under 5mW average power.

Signal Processing Pipeline

/* 512-point FFT feature extraction — CMSIS DSP */
void extract_features(float *accel_xyz, float *features) {
    arm_rfft_fast_instance_f32 fft;
    arm_rfft_fast_init_f32(&fft, FFT_SIZE);  /* 512 points */

    for (int axis = 0; axis < 3; axis++) {
        float fft_out[FFT_SIZE];
        arm_rfft_fast_f32(&fft, &accel_xyz[axis * FFT_SIZE],
                          fft_out, 0);
        arm_cmplx_mag_f32(fft_out, &features[axis * 32], 32);

        /* RMS, peak, kurtosis */
        features[96 + axis*4 + 0] = compute_rms(&accel_xyz[axis*FFT_SIZE], FFT_SIZE);
        features[96 + axis*4 + 1] = compute_peak(&accel_xyz[axis*FFT_SIZE], FFT_SIZE);
        features[96 + axis*4 + 2] = compute_kurtosis(&accel_xyz[axis*FFT_SIZE], FFT_SIZE);
    }
}

INT8 Quantization

Full INT8 post-training quantization using Edge Impulse's pipeline reduced model size from 184KB (float32) to 47KB with only 1.2% accuracy drop. The model uses CMSIS-NN optimized convolution kernels giving a 3.7× speedup over the reference TFLite implementation.

Duty Cycle Power Management

Motors don't need continuous monitoring — 10ms of data every 500ms is sufficient to catch developing faults. In Stop mode between acquisitions:

Deployment Results

← Previous
BLE Asset Tracking System
← All Projects