Preface: Manufacturing margins are thin. The difference between profit and loss is often OEE (Overall Equipment Effectiveness). Traditional maintenance is schedule-based (preventative). Modern maintenance is data-based (predictive). This guide explores the signals, systems, and connectivity required to build a factory that fixes itself.
1. Signal Processing: Vibration & FFT
Before a machine fails, it vibrates. But it doesn't just "shake"; it creates specific harmonic signatures. A failing inner race bearing vibrates differently than a misaligned shaft.
We attach high-frequency piezo-electric accelerometers (sampling at 20kHz) to the motor housing. Raw waveform data is useless to an AI. We must convert it to the Frequency Domain using Fast Fourier Transform (FFT).
# Python FFT Example for Edge Processing
import numpy as np
from scipy.fft import fft
def process_vibration(raw_data, sample_rate):
N = len(raw_data)
# Perform FFT
yf = fft(raw_data)
xf = np.linspace(0.0, sample_rate/2, N//2) # Frequency bins
# Power Spectral Density
power = 2.0/N * np.abs(yf[0:N//2])
return xf, power
The AI model (usually a 1D-CNN or Autoencoder) looks at this frequency spectrum. A spike at exactly 120Hz might indicate "Electrical Hum", while broad spectrum noise at 2kHz indicates "Bearing pitting".
2. Real-Time Edge Compute (Preempt-RT)
If the AI detects a "Catastrophic Failure Imminent" signal, it must stop the machine NOW. Not in 100ms. In 2ms.
Standard Linux is not real-time; a background task (like log rotation) can block the CPU. We patch the kernel with Preempt-RT to make it deterministic.
# Optimization for Real-Time Latency
# 1. Isolate CPU cores for the inference task
isolcpus=2,3
# 2. Set Process Priority (SCHED_FIFO)
chrt -f 99 ./safety_controller
3. High-Speed Visual QA
Cameras are the ultimate sensor. For a bottling plant moving 600 units per minute, we have 100ms per bottle. This is too fast for the cloud.
We deploy global-shutter cameras (to avoid motion blur) connected via 10GigE Vision to a local edge cluster.
4. Industrial connectivity (OPC-UA & 5G)
The "Language of Factories" is OPC-UA (Open Platform Communications Unified Architecture) or MQTT-Sparkplug B. The Edge Gateway translates Python AI decisions into PLC registers to physically actuate the machinery.
# Writing to a Siemens S7-1200 PLC via OPC-UA
from opcua import Client
client = Client("opc.tcp://192.168.0.1:4840")
client.connect()
node = client.get_node("ns=2;i=2") # Stop Command Register
node.set_value(True) # E-STOP
For mobile assets (AGVs - Automated Guided Vehicles), we rely on Private 5G to provide low-latency connectivity without the interference issues of Wi-Fi in metal-rich environments.
5. The Digital Twin Loop
The deployed model is not static. It streams metadata to the cloud "Digital Twin"—a virtual replica of the factory. If the Digital Twin predicts that increasing the conveyor speed by 5% will not cause vibration limit violations, it pushes a new config to the edge.
Conclusion: Industry 4.0 is not about dashboards; it is about closed-loop control. By fusing physics (vibration), vision, and connectivity, we create machines that are aware of their own health.