Next post: Can AI Uncrumple This? Finding a Hidden Buckle

Bearing Health From Buzz

A browser-based bearing demo combines simulated vibration, envelope analysis, and a small fault classifier—and shows where detection still falls short.

Overview

Bearings often produce distinctive vibration patterns as faults develop. A small defect on the outer or inner race can create a repeated impact as the bearing rotates. The timing of those impacts helps identify the fault.

This demo explores whether a simple classifier can distinguish healthy bearings from several types of fault. It also measures false alarms, because a system that frequently reports faults where none exist can be just as impractical as one that misses real damage.

Rather than reporting accuracy alone, the demo includes a basic power-threshold baseline, per-class results, a false-alarm rate, and examples of where the classifier fails.

Try It

The rig has five controls:

  • Fault type: healthy, outer-race fault, inner-race fault, ball fault, or misalignment.
  • Strength: 0.2–1.5 in steps of 0.1; starts at 1.0.
  • Speed: 25–35 Hz in steps of 0.5 Hz; starts at 30 Hz.
  • Alarm limit: 0–100, mapped to a threshold from 0 to 1; starts at 50.
  • Stop cost and miss cost: the relative costs assigned to false alarms and missed faults. Stop cost ranges from 0 to 20,000 in steps of 500; miss cost ranges from 0 to 200,000 in steps of 5,000.

The speed control can move about 16% above or below the 30 Hz starting speed, while training varies speed by only ±2%. Testing speeds farther from the training range is useful for exploring the model’s limits, but it is not proof that the model generalizes reliably to other operating conditions.

How It Works

The browser generates a vibration signal, extracts features that may indicate a fault, and passes them to a small classifier.

Bearing model
↓
Simulated vibration
↓
Envelope analysis and signal features
↓
Fault classifier
↓
Predicted condition and confidence

The vibration signal

The seeded signal generator, src/lib/vibration-signal.ts, produces 1,024 samples at 2,048 Hz. An earlier description gave the sampling rate as 512 Hz; that was incorrect.

For a healthy bearing, the signal contains shaft motion and noise. A simulated fault adds sharp, decaying impacts at a repeating rate. The model represents an eight-ball bearing, using approximate fault frequencies of 2.8 times shaft speed for an outer-race fault and 5.2 times shaft speed for an inner-race fault. These are simplified synthetic signals, not recordings from a physical bearing.

Faults are simulated at two levels: an early fault at 0.4 times the nominal level and a clearer fault at 1.0 times that level. The signal also includes a small amount of speed variation.

Why analyse the envelope?

A fault impact can excite a high-frequency vibration in the bearing housing. The impact repeats at a lower fault-related frequency, but that repetition can be difficult to see in the raw spectrum because the housing resonance and shaft vibration dominate.

Envelope analysis extracts the changing amplitude of the vibration, making the repeating impacts easier to detect. In the demo, an outer-race example has a clear peak near 84 Hz in the envelope spectrum, even though the corresponding peak is difficult to identify in the raw spectrum.

The classifier uses six features: signal RMS, peakedness, crest factor, two frequency-band strengths, and the logarithmic difference between those band strengths. Together, they describe the signal’s overall energy, sharp impacts, and how its energy is distributed across selected frequency bands.

A small multinomial logistic classifier combines these features to predict one of the five conditions. Its weights are fitted from an initial zero state using full-batch gradient descent, stopping when the gradient-based convergence check is satisfied.

A simple baseline

The demo compares the classifier with a basic threshold on total signal power. This baseline is deliberately simple: the threshold is selected using clear faults, so it can miss faults that produce only small changes in signal power.

On the held-out evaluation set, the power baseline scores 70%, while the feature-based classifier scores 83%. The improvement suggests that the envelope and frequency-band features help, particularly when a fault does not produce a large increase in overall vibration power.

Results

The saved model is evaluated on held-out random seeds, rather than the examples used to fit its weights. The test suite, src/__tests__/vibration-golden.test.ts, checks the saved model’s results and fails the build if they drift from the expected results.

Actual condition Predicted healthy Outer race Inner race Ball fault Misalignment
Healthy 10 1 0 1 0
Outer-race fault 0 12 0 0 0
Inner-race fault 0 0 12 0 0
Ball fault 5 1 0 6 0
Misalignment 0 0 0 2 10

Across 60 test slices, the classifier gets 50 right: 83% accuracy, compared with 70% for the power-threshold baseline.

The false-alarm result is less encouraging. Two of the 12 healthy samples are incorrectly flagged as faulty, giving a false-alarm rate of about 17%. That is above the stated target of 3–8%. A practical next step is to require two consecutive faulty predictions before raising an alarm.

Ball faults are the hardest class in this test. The classifier identifies only 6 of 12 correctly; it calls five healthy and one outer-race sample a ball fault. At low fault strength, the simulated impacts can resemble ordinary vibration. The classifier also has no option to reject an unfamiliar signal: its softmax output always selects one of the five classes. Even noise can therefore receive a confident label. The displayed confidence should not be mistaken for a guarantee that the prediction is correct.

A Check Against Real Vibration Data

The live rig uses synthetic signals, so it is important to check at least part of the signal-processing pipeline against real measurements.

The widget includes a small reference-data check using drive-end recordings from the Case Western Reserve University (CWRU) Bearing Data Center. These recordings were collected at 12 kHz. The check uses three windows each from healthy, outer-race-fault, and inner-race-fault recordings. It runs at the original sampling rate because downsampling was found to obscure the high-frequency resonance band used in the analysis.

On these selected windows, the outer-race examples rank highest in the outer-related frequency band, with observed energy at nine times shaft speed and above. The inner-race examples rank highest in the inner-related band, with observed energy from about 2.4 times shaft speed and above. The healthy examples have a relatively flat envelope, staying below the code’s 0.004 threshold.

This check uses the same signal-reading code as the live demo, without retraining or retuning the classifier. It is a useful test of the feature extraction, but only a small set of examples. It does not establish that the classifier will achieve the same accuracy on real machinery.

Alarm Threshold Tuning

The alarm tuner below the rig replays a separate held-out set containing 12 healthy and 48 faulty slices. Move the alarm threshold to see how the number of detected faults, missed faults, and false alarms changes. The tuner also compares the costs assigned to unnecessary stops and missed faults.

This makes the trade-off explicit: lowering the threshold can catch more faults but may trigger more false alarms; raising it can reduce false alarms while allowing more faults to pass undetected. The useful threshold depends on the cost of each outcome, not on accuracy alone.

The test set is small and uses a fixed collection of saved signals. The cost curve is therefore a way to explore threshold choices, not a validated estimate of performance on a factory floor.

The separate diolei/bearing-watch project uses a JAX autoencoder trained on healthy CWRU spectra. Instead of assigning each signal to a fault class, it measures how poorly the model reconstructs the signal and treats unusually high reconstruction error as a possible fault.

The repository reports 0.978 precision, 1.000 recall, and a 0.017 false-positive rate on its saved evaluation run. Those results belong to a different model and evaluation setup; they are not the scores of the classifier in this widget. The repository also describes itself as a learning exercise, not a system validated for maintenance decisions.

Limitations

The live vibration is generated by a seeded simulation, not a physical accelerometer. It uses simplified fault-impact patterns, a fixed housing response, and a limited range of operating speeds. The training data includes only small speed variation, so tests far beyond that range should be treated as exploratory.

The results show that envelope features can improve on a simple power threshold for these test signals. They do not show that the classifier is ready for industrial use. Its held-out accuracy is 83%, its false-alarm rate is about 17%, and ball faults remain difficult to distinguish. Misalignment is also included as a user-selectable condition, but the code’s reference to a 2× shaft-speed component is not backed by a corresponding trained fault case in this evaluation.

Before deployment, the system would need more real measurements covering different fault severities, loads, speeds, bearing types, and misalignment conditions. It would also need a reliable way to reject unfamiliar signals and a tested alarm policy that meets the plant’s false-alarm requirements.

Next Steps

The first priority is to add an alarm hold-off that requires consecutive faulty slices before triggering. Next, the classifier needs a way to reject signals that do not match any known class. A remaining-life estimate based on fault severity could follow, but only after each new capability has its own tested evaluation set.

More real data—especially ball faults, misalignment, and different operating loads—should be added using the same saved-fixture approach so that each change can be evaluated consistently.

References