---
title: Condition-Based Monitoring in Industrial & Marine Systems: A Python & IoT Telemetry Architecture
date: 2025-08-06 18:05:00
category: Engineering & IoT
tags: [Python, IoT, Condition Monitoring, Signal Processing, Marine Engineering, Vibration Analysis]
author: Md Sanuar Mahmud
description: Practical engineering guide to Condition-Based Monitoring (CBM) with Python and IoT. Covers vibration telemetry, FFT spectral harmonics, Kurtosis, and ISO 10816 standards.
canonical_url: https://sanuar.net/condition-based-monitoring-iot-python
---

> Key Takeaways:
> 
> - Shift from Calendar to Condition: Traditional time-based maintenance replaces healthy components prematurely while missing sudden early fatigue failures. Condition-Based Monitoring (CBM) continuously evaluates machinery health using real-time sensor telemetry.
> 
> - High-Frequency Vibration is the Gold Standard: Mechanical degradation in bearings and gears emits micro-vibrations long before measurable temperature spikes or acoustic noise develop. Catching defects at Stage 1 or Stage 2 saves equipment from catastrophic seizure.
> 
> - Time-Domain vs. Frequency-Domain: Time-domain statistical indicators (RMS, Kurtosis, Crest Factor) signal that a machine is degrading. Frequency-domain Fast Fourier Transform (FFT) and Hilbert envelope analysis isolate the exact failing component (inner race, outer race, gear tooth).
> 
> - Edge to Cloud Pipeline: Deploying Python on industrial IoT edge gateways allows sub-millisecond signal processing, filtering out gigabytes of noise and streaming only calculated spectral peaks via lightweight MQTT to central dashboards.
> 
> - Standards-Driven Thresholds: Real monitoring systems must adhere to recognized international benchmarks, including ISO 10816-3 (Mechanical vibration evaluation on non-reciprocating machines) and ISO 20816-1.

Whether you are operating a 14-story commercial building's chilled water circulation pumps or managing propulsion machinery aboard a transatlantic container vessel, mechanical failure follows an unforgiving curve: **the P-F (Potential to Failure) interval**. When an auxiliary generator bearing or a high-pressure ballast pump begins to degrade, microscopic subsurface fatigue cracks develop weeks before any maintenance technician notices audible squealing or thermal overheating.

In traditional industrial operations, maintenance follows a calendar schedule: replace the bearing every 10,000 running hours regardless of condition. This approach introduces two fatal flaws: it unnecessarily discards components with thousands of remaining service hours, and it fails to detect early-stage defects caused by shaft misalignment, improper lubrication, or dynamic shock loads that occur between scheduled inspections.

By coupling industrial IoT accelerometers with Python's scientific computing stack, modern engineering teams can build automated Condition-Based Monitoring (CBM) systems that analyze high-frequency vibration telemetry, compute spectral harmonics, and predict failures weeks before downtime strikes.

## 1. The Mechanical Physics of Bearing & Gear Degradation

Rotary machinery degradation progresses through four distinct stages on the vibration spectrum:

Degradation Stage
Frequency Band
Physical Manifestation
Telemetry Indicator

**Stage 1 (Incipient)**
Ultra-high (> 20 kHz)
Subsurface shear stress cracks and micro-fissures in bearing raceways.
Spike in ultrasonic acoustic emissions; standard overall RMS remains flat.

**Stage 2 (Defect Formation)**
500 Hz – 2 kHz
Micro-spalling on raceways or rolling elements excites natural resonance frequencies.
Detectable via Hilbert Transform Envelope Demodulation; minor Kurtosis rise.

**Stage 3 (Operational Deterioration)**
Fundamental Defect Frequencies ($BPFO, BPFI$)
Surface pits, spalls, and flaking. Harmonic sidebands emerge around rotational speed ($1\times RPM$).
Clear peaks in raw FFT velocity spectra; significant Crest Factor and RMS elevation.

**Stage 4 (Imminent Failure)**
Broadband noise / $1\times, 2\times, 3\times$ harmonics
Widespread spalling, cage collapse, excessive clearances, severe shaft overheating.
Broadband floor elevation; extreme temperature spike; machine must be tripped immediately.

To pinpoint the exact failing element, an engineer calculates the four fundamental bearing characteristic fault frequencies based on internal bearing geometry (pitch diameter $D_p$, ball diameter $d$, number of rolling elements $z$, and contact angle $\beta$):

```
Ball Pass Frequency Outer Race (BPFO) = (z * f_r / 2) * (1 - (d / D_p) * cos(beta))
Ball Pass Frequency Inner Race (BPFI) = (z * f_r / 2) * (1 + (d / D_p) * cos(beta))
Ball Spin Frequency (BSF)            = (D_p * f_r / (2 * d)) * (1 - ((d / D_p) * cos(beta))^2)
Fundamental Train Frequency (FTF)    = (f_r / 2) * (1 - (d / D_p) * cos(beta))

Where:
  f_r = Shaft rotational speed (Hz) = RPM / 60
  z   = Number of rolling elements (balls or rollers)
  d   = Rolling element diameter
  D_p = Pitch diameter
```

## 2. Edge IoT Telemetry Pipeline Architecture

In industrial and marine environments, streaming raw vibration data (sampled at 20 kHz to 50 kHz across multiple axes) continuously to the cloud would consume hundreds of gigabytes of satellite bandwidth daily. Instead, we implement an **edge-compute architecture**:

- **Industrial Sensor Layer:** Triaxial piezoelectric accelerometers (e.g. 100 mV/g sensitivity) mounted rigidly via stud or magnetic base on bearing housings in horizontal, vertical, and axial orientations.

- **Edge Gateway (Linux / Raspberry Pi Compute Module 4):** An industrial gateway reads analog sensor streams via high-speed 24-bit ADCs over Modbus TCP or SPI.

- **Local Python Analytics Engine:** Python processes 1-second raw acceleration bursts, calculates statistical scalar metrics, performs Fast Fourier Transform (FFT) velocity integration, and checks against ISO 10816 thresholds.

- **Telemetry Transmission via MQTT:** The gateway publishes compact JSON payloads containing calculated RMS, Kurtosis, and top spectral peaks over TLS-encrypted MQTT to the central monitoring dashboard.

## 3. Python Signal Processing: Time & Frequency Domain Analysis

The core computational engine uses numpy and scipy.signal to compute both statistical time-domain indicators and frequency-domain velocity spectra. Here is a production-grade script that takes raw acceleration time-series data and produces actionable diagnostic telemetry:

```
import numpy as np
from scipy import signal
from scipy.integrate import cumulative_trapezoid

def analyze_vibration_signal(acceleration_g: np.ndarray, sampling_rate_hz: int, shaft_rpm: float):
    """
    Processes raw acceleration time-series telemetry.
    Calculates statistical time-domain features, integrates to velocity,
    and extracts key spectral peak frequencies via FFT.
    """
    n_samples = len(acceleration_g)
    time_total = n_samples / sampling_rate_hz

    # 1. TIME-DOMAIN STATISTICAL METRICS
    mean_val = np.mean(acceleration_g)
    acc_clean = acceleration_g - mean_val  # Remove DC offset

    rms_acc = np.sqrt(np.mean(acc_clean ** 2))
    peak_acc = np.max(np.abs(acc_clean))
    peak_to_peak = np.ptp(acc_clean)
    crest_factor = peak_acc / (rms_acc + 1e-9)

    # Kurtosis: measures the 'peakedness' or impulsiveness of the signal
    # Normal Gaussian noise has Kurtosis ~ 3.0; bearing defects elevate this > 4.5
    kurtosis_val = float(np.mean((acc_clean / (np.std(acc_clean) + 1e-9)) ** 4))

    # 2. NUMERICAL INTEGRATION: ACCELERATION (g) -> VELOCITY (mm/s)
    # Velocity is the standard metric used in ISO 10816-3 severity standards
    acc_mps2 = acc_clean * 9.80665  # Convert g to m/s^2

    # High-pass filter to remove low-frequency integration drift (< 5 Hz)
    sos = signal.butter(4, 5.0, btype='highpass', fs=sampling_rate_hz, output='sos')
    acc_filtered = signal.sosfilt(sos, acc_mps2)

    # Cumulative trapezoidal integration to velocity (m/s) then convert to mm/s
    time_axis = np.linspace(0, time_total, n_samples)
    velocity_mps = cumulative_trapezoid(acc_filtered, time_axis, initial=0)
    velocity_filtered = signal.sosfilt(sos, velocity_mps)  # Re-filter drift
    velocity_mms = velocity_filtered * 1000.0

    rms_velocity_mms = np.sqrt(np.mean(velocity_mms ** 2))

    # 3. FREQUENCY DOMAIN (FFT) VELOCITY SPECTRUM
    # Apply Hanning window to mitigate spectral leakage
    window = np.hanning(n_samples)
    fft_vals = np.fft.rfft(velocity_mms * window)
    fft_freqs = np.fft.rfftfreq(n_samples, d=1.0 / sampling_rate_hz)
    amplitude_spectrum = (2.0 / np.sum(window)) * np.abs(fft_vals)

    # 4. HARMONIC PEAK EXTRACTION
    # Identify top 5 dominant vibration frequencies
    peak_indices, _ = signal.find_peaks(amplitude_spectrum, height=0.1, distance=int(sampling_rate_hz / 50))
    sorted_peaks = sorted(peak_indices, key=lambda idx: amplitude_spectrum[idx], reverse=True)[:5]

    dominant_harmonics = [
        {"freq_hz": round(float(fft_freqs[idx]), 2), "amplitude_mms": round(float(amplitude_spectrum[idx]), 2)}
        for idx in sorted_peaks
    ]

    # 5. ISO 10816-3 MACHINE SEVERITY EVALUATION (Class II / Medium Machines 15-75 kW)
    if rms_velocity_mms < 1.12:
        iso_zone = "Zone A (Good - Newly Commissioned)"
    elif rms_velocity_mms < 2.8:
        iso_zone = "Zone B (Acceptable - Long Term Operation)"
    elif rms_velocity_mms < 7.1:
        iso_zone = "Zone C (Unsatisfactory - Plan Maintenance Soon)"
    else:
        iso_zone = "Zone D (Unacceptable - Imminent Danger of Damage)"

    shaft_hz = shaft_rpm / 60.0

    return {
        "rms_velocity_mms": round(float(rms_velocity_mms), 2),
        "peak_acc_g": round(float(peak_acc), 2),
        "kurtosis": round(kurtosis_val, 2),
        "crest_factor": round(float(crest_factor), 2),
        "iso_severity_zone": iso_zone,
        "shaft_rotational_speed_hz": round(shaft_hz, 2),
        "top_spectral_peaks": dominant_harmonics
    }
```

## 4. Real-World Marine Case Study: Auxiliary Generator Bearing Alert

During an oceanic voyage, an auxiliary marine genset (1,800 RPM, $30\text{ Hz}$ shaft rotational speed) powering vessel electrical systems exhibited normal operating temperatures ($62^\circ\text{C}$). To the shipboard crew, the machinery appeared entirely healthy.

However, our IoT condition monitoring unit registered a critical shift in telemetry:

- **Overall Vibration:** RMS velocity rose moderately from $1.4\text{ mm/s}$ to $3.6\text{ mm/s}$ (shifting from ISO Zone B to Zone C).

- **Statistical Impulsiveness:** Vibration Kurtosis jumped from a normal baseline of $2.9$ to $6.8$, pointing to impulsive repetitive impacts.

- **FFT Peak Analysis:** High-resolution spectral demodulation revealed sharp harmonic peaks at $147.2\text{ Hz}$, $294.4\text{ Hz}$, and $441.6\text{ Hz}$. Cross-referencing the bearing geometry ($SKF\text{ 6316}$) confirmed these were exact multiples of the **Ball Pass Frequency Inner Race (BPFI = 4.92 \times 30 Hz = 147.6 Hz)**.

The chief engineer was alerted to schedule an in-port bearing change at the next harbor. Upon disassembly, the engineering team uncovered an advanced fatigue spall on the inner raceway. Had the generator remained running for another 200 operational hours, the rolling elements would have welded to the shaft, destroying the generator stator and causing an expensive mid-ocean blackout.

## Frequently Asked Questions

### What is the difference between Condition-Based Monitoring (CBM) and Predictive Maintenance (PdM)?

Condition-Based Monitoring (CBM) continuously measures real-time physical variables (vibration, acoustic emissions, temperature) to evaluate current mechanical health. Predictive Maintenance (PdM) takes this telemetry a step further, applying machine learning and statistical time-series forecasting to estimate the exact Remaining Useful Life (RUL) of the asset.

### Why is vibration velocity measured in mm/s for machinery evaluation?

Per ISO 10816 standards, vibration velocity directly reflects the destructive kinetic energy ($E_k \propto v^2$) and cyclic fatigue stresses acting on machine bearings and structural mounts. While acceleration emphasizes high-frequency spikes and displacement emphasizes low-frequency unbalance, velocity provides a balanced evaluation of overall machinery severity.

### What does a high Kurtosis value indicate in vibration analysis?

Kurtosis is a statistical measure of signal impulsiveness. A healthy rotating bearing produces a Gaussian vibration profile with a Kurtosis close to 3.0. When an early-stage fatigue spall develops, rolling elements strike the pit like miniature hammers, producing high-amplitude sharp spikes that elevate Kurtosis above 4.5 long before overall RMS velocity exceeds alert limits.

### How do edge IoT gateways handle noisy industrial electrical interference?

Industrial installations use shielded twisted-pair cables, balanced differential 4-20mA or RS-485 signaling, digital low-pass and high-pass Butterworth filters, and optical isolation barriers to prevent 50/60 Hz mains electrical hum and variable frequency drive (VFD) switching noise from corrupting vibration readings.

### Can Python be deployed on resource-constrained embedded edge devices?

Yes. By utilizing optimized C-extensions (NumPy, SciPy) and compiling critical loops or running lightweight Python runtimes on ARM-based Linux gateways (e.g. Raspberry Pi CM4 or BeagleBone Industrial), telemetry analysis runs in tens of milliseconds with minimal power consumption.