Natan Oliveira Martins

← Back to index
03 IoT · edge In construction

Predictive maintenance from vibration

Sensors on industrial machines stream vibration and temperature; an unsupervised model flags a failing bearing days ahead.

  • MQTT (Mosquitto)
  • InfluxDB
  • Apache Airflow
  • scikit-learn
  • Grafana

Code and roadmap on GitHub →

Interactive demo

Inject a fault
Time speed

Drag to orbit · scroll to zoom · Training the Isolation Forest on 400 healthy windows…

Day–
Bearing temp.–
Vibration RMS–
Kurtosis–
Anomaly score–
Status–
Anomaly score (smoothed) per 6-hour window
Vibration signal, last 0.1 s window
Spectrum of the same window · Hover the spectrum to read frequencies.

Things to try

  1. Inject bearing wear and watch the spectrum: impacts excite a resonance near 2.3 kHz long before the overall RMS moves. The model sees it; the classic alarm doesn’t.
  2. Reset and inject imbalance: here the 1× rotation peak grows and RMS works fine too. The model’s advantage is smaller, and the timeline shows it honestly.
  3. Lower the threshold and let the healthy machine run: false alarms appear. Every alert threshold is a trade between lead time and operator trust.

The problem

Failures are rare, so there is almost nothing labelled to learn from. The model has to learn what normal looks like for each machine and notice drift, without drowning operators in false alarms.

How it works

  1. Sensors publish over MQTT; a bridge writes raw readings to InfluxDB.
  2. Airflow computes spectral features (FFT bands, RMS, kurtosis) per machine every few minutes.
  3. An Isolation Forest per machine scores each window; a smoothed score crossing a threshold opens an alert.
  4. This is the one project designed to run live on this server, with simulated machines.
Sensors vibration · temp MQTT broker InfluxDB time series Airflow FFT features Isolation Forest per machine Alerts smoothed score
Fig. 03 — How it works

What is real, what is simulated

Real

  • The FFT, the features (RMS, kurtosis, crest factor, band energies) and the Isolation Forest are implemented from scratch and run in your browser.
  • The model is trained when the page loads, only on healthy windows; the threshold is the 99.5th percentile of their scores.
  • Lead times in the timeline come from the model’s actual alerts in your run.

Simulated in this demo

  • The vibration signal is synthetic: shaft harmonics, noise, and bearing impacts at the outer-race defect frequency ringing a structural resonance.
  • Degradation follows a fixed 21-day exponential curve; time is compressed.
  • Known limitation: overheating moves a single sensor, and the Isolation Forest score saturates above its training range, so for that fault the model is usually not earlier than the classic temperature alarm.

Not built yet

  • Hybrid detector: per-sensor physical limits alongside the model
  • MQTT broker, InfluxDB and Airflow running live on this server
  • Validation on a public bearing dataset (e.g. NASA IMS / CWRU)
  • Grafana dashboard