Industrial IoT · Machine learning · FastAPI · Edge
Teaching a model what “normal” sounds like: vibration monitoring at the edge
You rarely have examples of the failures you want to predict. What I learned building a predictive-maintenance demo that learns healthy behaviour, explains its alarms, and admits what it cannot see.
By Dhruv Suthar
Predictive maintenance is usually pitched as “AI that predicts failures”. The catch is that most plants have very few recorded failures to learn from, and the ones they have rarely match the next one. So for a recent demo I flipped the question: instead of teaching a model what failure looks like, teach it what normal looks like, and flag everything else.
The setup was deliberately small: an industrial vibration and temperature sensor on a running motor, an IO-Link gateway, and a local server. No cloud.
Start from a scale people already trust
Maintenance teams already know ISO 10816-3, which grades vibration velocity into zones from “newly commissioned” to “damage likely”. Showing machine health on that scale first means the screen speaks their language before any machine learning appears. The zone limits are configurable for the machine class, because a small fan and a large pump should not share thresholds.
Learn only from healthy data
The anomaly model is an Isolation Forest combined with a robust z-score, trained only on samples recorded while the machine is known to be healthy. Each sample has 18 features: velocity RMS, acceleration RMS, peak-to-peak, kurtosis, crest factor and shape factor, on each of three axes. The output is a single anomaly index from 0 to 100.
Training is a button: put the machine in a known-good state, press “learn normal”, wait a couple of minutes. Because the model only needs healthy data, it can be set up on day one instead of after the first breakdown.
An alarm should explain itself
A number that jumps from 3 to 84 is alarming but not useful. Every warning and alarm therefore lists the features that drove it, as ratios to the learned baseline, for example peak-to-peak on one axis at many times its normal level. That tells a technician where to look and makes the model’s behaviour something they can argue with.
Thresholds are simple on purpose: a warning at 40 and an alarm at 70, with a short debounce, and every warning and alarm goes into an event log.
Give the faults you have seen a name
Anomaly detection says “this is unusual”. Fault fingerprints add “and it looks like this”. Recording a short signature while the machine is in a known condition, such as healthy or imbalanced, builds a small library. The live signature is compared against it continuously, so the screen can say which known condition the machine is closest to.
What happened in the demo
With the motor running normally, the anomaly index sat around 3 out of 100. When we induced vibration, it rose past the warning threshold and then the alarm threshold within seconds, peaking at 91. The alarm was logged with its driving features, and the fingerprint match switched to imbalance. When the disturbance was removed, the index fell back and the alarm cleared.
Be honest about what it cannot see
This sensor’s vibration band suits imbalance, misalignment and looseness, but not early, high-frequency bearing defects, which need different hardware. And a demo is not a field trial: prediction accuracy and downtime savings have not been measured yet, so I do not claim them. Saying so up front is what makes the rest of the screen credible.
Keep it local
The sensor reports over IO-Link to the gateway. A FastAPI server polls the gateway over HTTP REST about once a second, stores samples in SQLite, and pushes updates to browsers over WebSockets. Nothing leaves the local network, which removes the first objection most plant IT teams raise.
- Learn normal, flag the rest: you will not have enough failure data.
- Lead with a standard the operators already use.
- Make every alarm explain which features drove it.
- Name known faults with fingerprints.
- State the hardware’s limits and the claims you have not measured.
