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:
- Active (10ms): 18mW — ADC + FFT + inference
- Sleep (490ms): 0.12mW — only RTC running
- Average: 0.36mW — runs on CR2032 for 14 months
Deployment Results
- Detected bearing outer race fault 3 weeks before catastrophic failure in pilot deployment
- False positive rate: 2.1% — acceptable for maintenance scheduling use case
- Over-the-air model updates via CAN bootloader — new fault classes added without hardware change