Ask a team that has shipped industrial AI where the time went, and the answer is remarkably consistent: somewhere between 60 and 70 percent of the effort goes into data, not models. Not because the models are simple, but because a factory is a museum of automation history. PLCs from four vendors, a historian with three naming conventions, a line installed before anyone said "IIoT", and a few machines with no digital output at all. Before a model can learn anything, that estate has to be connected, contextualised, time-aligned, labelled and made queryable. This post walks through each layer and why it is worth building once, properly.

Layer 1: Connectivity — OPC UA, MQTT and retrofits
Bridging operational technology to IT is the first job, and there are three main routes:
-
OPC UA for modern PLCs and SCADA systems. It gives you a browsable address space, typed values and security built in, and it is the most reliable way to read from controllers without custom drivers.
-
MQTT as the transport from the plant edge upward. Publish/subscribe decouples producers from consumers, so adding a new consumer — a model, a dashboard, a historian — does not mean touching the PLC again.
-
Retrofit sensors for legacy machines: wireless vibration, temperature, current and acoustic sensors that need no PLC integration at all. For condition monitoring, these are often enough.
A common pattern is an edge gateway that reads OPC UA from the controllers, normalises values, and publishes to an MQTT broker. Keep flows one-way out of the control network wherever you can. Nothing in the AI stack should be able to write to a PLC.
Layer 2: Context — the unified namespace
Raw tags are meaningless to a model. N7:44 or TT_4471 tells you nothing about which machine, which line, which product or which batch. Contextualisation maps every signal to where it lives in the business.
The unified namespace (UNS) is the pattern most teams converge on: a single, hierarchical topic structure — typically following the ISA-95 levels of enterprise, site, area, line and cell — where every system publishes its current state, and every consumer subscribes to what it needs.
acme/
plant-b/
machining/
line-3/
cnc-12/
spindle/temperature -> {"v": 61.4, "u": "degC", "ts": "2026-09-11T08:14:02.118Z", "q": "good"}
spindle/vibration_rms -> {"v": 2.31, "u": "mm/s", "ts": "...", "q": "good"}
state -> {"v": "RUNNING", "ts": "..."}
job/current -> {"part": "GX-40-HSG", "batch": "B-20931", "op": 20}
cmms/
workorders/cnc-12 -> {"id": "WO-88121", "failure_code": "BRG-WEAR", ...}
Once tag 4471 is published as line-3/cnc-12/spindle/temperature alongside the job and batch currently running, a model knows what it is looking at.
Layer 3: Time alignment
This is the silent killer. The PLC clock, the historian clock, the MES clock and the CMMS clock are rarely in sync, and a few seconds of skew is enough to associate a quality defect with the wrong process window.
What helps:
-
Timestamp at the source whenever the device supports it, and keep both the source and ingestion timestamps.
-
Run NTP or PTP on edge gateways and monitor offset as a metric, not as an assumption.
-
Store timestamps in UTC with explicit precision. Local time plus daylight saving plus a night shift is a bug waiting to happen.
-
When you join streams sampled at different rates, resample deliberately (as-of joins, forward-fill limits) and record the method so training and inference match.

Layer 4: Quality — drift, gaps and changed units
Industrial signals degrade in ways that do not throw errors. Sensors drift slowly as they age. Gateways drop packets during network hiccups. A firmware update quietly changes a value from Fahrenheit to Celsius, or from raw counts to engineering units. A replaced sensor comes back with a different calibration.
Build the checks into the pipeline, not the notebook:
-
Range and rate-of-change checks per tag, with the limits stored alongside the tag definition.
-
Gap detection with explicit quality flags, so models can distinguish "zero" from "no data".
-
Unit metadata on every value, and alerts when a tag's distribution shifts sharply after a maintenance event or firmware update.
-
A change log linking sensor replacements and recalibrations to the data they affect.
Layer 5: Labels from the CMMS
Supervised models need ground truth, and in a factory the ground truth mostly lives in maintenance and quality records. That is where the pain starts. Work orders reference assets by different IDs than the historian, failure codes are chosen from a dropdown in a hurry, and the free-text note says "replaced seal, running OK".
Linking a work order back to the sensor window that preceded it requires asset-ID mapping between the CMMS and the namespace, a defined look-back window per failure mode, and usually some cleanup of failure codes with the maintenance team. It also explains why true failure prediction takes time: well-maintained equipment fails rarely, so you may only have a handful of labelled events per asset class. Starting with anomaly detection, which learns what normal looks like, is the practical route until enough confirmed failures accumulate.
Governance: decide it before it decides itself
Someone has to own each data source, decide how long raw data is kept, and decide what may leave the plant network. Writing this down early prevents the situation where a vendor's cloud quietly becomes the only copy of your process history.
Why it is worth building once
Plants that treat each AI use case as its own data project pay for the plumbing five times. Plants that build a clean, contextualised layer once find that the first project carries the cost and the second and third are dramatically cheaper, because predictive maintenance, vision traceability, scheduling inputs and knowledge copilots can all read from the same namespace.
The full picture of which AI tools sit on top of this layer, and what they cost, is in our guide to AI automation tools for manufacturing. Building the integration layer across a brownfield estate is the kind of custom software development work our team does most often.
Frequently Asked Questions
Why does data work dominate manufacturing AI projects?
Factories run equipment and software from many eras and vendors, with inconsistent naming and some machines that have no digital output. Connecting, contextualising, aligning and labelling that data takes most of the effort before any model can be trained.
Do we need both OPC UA and MQTT?
They solve different problems. OPC UA is the dependable way to read from modern controllers; MQTT is the lightweight transport that distributes those values to many consumers. Many plants read with OPC UA at the edge and publish over MQTT.
What is a unified namespace in plain terms?
It is a single, organised structure where every machine and system publishes its live data under a clear path that says which site, line and machine it belongs to. Any new application can subscribe to what it needs without a new point-to-point integration.
How do you get training labels for predictive maintenance?
By linking completed work orders and quality records in the CMMS back to the sensor data that preceded each event. This usually requires mapping asset IDs between systems and cleaning up failure codes with the maintenance team.
Can we skip the data layer for a quick pilot?
You can, but the pilot will rely on hand-prepared data that does not transfer to the next line. Building even a minimal contextualised pipeline from the start is what lets a pilot scale without starting again.