New

Introducing Free Tier: Get Started with Cedalo MQTT Platform |Get Started

Back to Blog

AI Anomaly Detection: How to Spot Problems in Machine Data Before They Cause Downtime

Vitalii Tutevych
Vitalii Tutevych Published November 30, 2026 20 min read
Industry 4.0
AI Anomaly Detection: How to Spot Problems in Machine Data Before They Cause Downtime

AI anomaly detection uses machine learning to model the normal behavior of a system and flags deviations from it. Fed with real-time machine data over MQTT, it can catch a drifting bearing or a leaking valve days before a fixed alarm limit trips.

AI Anomaly Detection: Key Takeaways

  • AI anomaly detection, also known as outlier detection, learns a baseline of normal machine operation and flags combined shifts in vibration, temperature or speed, often before any single sensor value hits its alarm limit.
  • Anomaly detection in sensor and machine data distinguishes three anomaly types: point anomalies (single outliers), contextual anomalies (normal values in the wrong operating state) and collective anomalies (patterns across several signals).
  • Machine learning anomaly detection for industrial data mostly uses unsupervised or semi-supervised learning and depends on complete, timestamped machine data streamed in real time over MQTT.
  • Cedalo, the company behind the open-source MQTT broker Eclipse Mosquitto, offers Pro Mosquitto as a production-ready MQTT broker that streams machine data in real time to AI anomaly detection models.

What Is AI Anomaly Detection?

AI anomaly detection is the automated search for data points and patterns that deviate from a learned model of normal behavior. The model builds this baseline from historical data and flags live readings with a high deviation score.

Classic data anomaly detection often relies on statistical checks such as z-scores that evaluate one variable at a time. Machine learning methods capture non-linear relationships between many signals and adapt their baseline to load, product or time of day.

How Does AI Anomaly Detection Differ From Rule-Based Monitoring?

Rule-based monitoring checks each signal against a fixed limit that an engineer sets by hand. AI anomaly detection learns the normal range of many signals together and adjusts it to the operating state. You detect slow drifts and combined deviations that no single limit covers.

CriterionRule-based monitoringAI anomaly detection
Detection logicFixed threshold per signalLearned baseline across several signals
Maintenance effortEngineers update limits after every process changeRetraining on new normal data
Unknown failure patternsDetects only what a rule describesFlags any strong deviation from the baseline
ContextSame limit at startup, full load and standstillBaseline depends on operating state, shift or recipe

A centrifugal pump has alarm limits of 80 °C for bearing temperature and 25 A for motor current. Within two weeks, temperature rises from 58 to 66 °C and current from 17 to 19 A at unchanged flow. No alarm fires because both values stay far inside their limits.

An anomaly model recognizes this combination as new for this flow rate and can raise an alert days before the bearing fails. Keep fixed limits for hard safety boundaries and add anomaly detection for everything that drifts.

Which Types of Anomalies Show Up in Sensor and Machine Data?

Sensor and machine data contains three types of anomalies. A point anomaly is a single value far outside the normal range. A contextual anomaly is a value that looks plausible in general but is wrong for the current time or operating state.

A collective anomaly is a group of data points that only looks abnormal as a whole, such as several sensors on one line drifting in the same direction. Fixed thresholds catch most point anomalies and almost none of the other two.

Anomaly typeExample in the MQTT topicTypical causeDetectable with a threshold?
Pointplant1/line2/filler/pressure jumps from 4.1 to 9.8 bar for one readingPressure spike, sensor fault, valve slamYes, if the spike exceeds the limit
Contextualplant1/line2/compressor/power reads 42 kW at 2 a.m. during a planned standstillMachine left running, compressed air leakNo, 42 kW is normal during production
Collectiveplant1/line2/+/temperature rises by 1 to 2 °C on filler, capper and labeler over three shiftsCooling water problem, shared supply issueNo, every single value stays in range
Three time-series charts: a single pressure spike, power draw during a planned standstill, and a shared temperature drift across filler, capper, and labeler
Figure 1: Point, contextual, and collective anomalies in sensor and machine data.

Machine data is time series data, which means order and timing carry information. A collective anomaly only becomes visible if readings from different sensors share consistent timestamps and a stable sampling rate.

If one gateway sends every second and another every ten seconds with clock drift, the model compares readings that never happened at the same moment.

How Does a Model Learn What Normal Machine Operation Looks Like?

An anomaly detection model learns normal operation by building a baseline from data recorded during fault-free operation. For every new reading or time window, it calculates how far the data sits from that baseline and outputs an anomaly score. The learning method decides how much labeled data you need to get there.

Three learning methods are in use. They differ mainly in how much labeled failure data they need and which labels they require for training.

MethodTraining dataStrengthLimit
UnsupervisedUnlabeled history, mostly normal operationFinds failure patterns nobody has seen beforeMore false positives in the first weeks
SupervisedLabeled examples of normal and faulty statesHigh hit rate for known failuresMisses failures absent from the training data
Semi-supervisedVerified normal operation onlyClean baseline, catches new deviationsNeeds a reliably fault-free training period

Why Is Unsupervised Learning the Default for Industrial Anomaly Detection?

Unsupervised learning is the default because labeled failure data is rare in production. A filling line might see two seal failures per year, each with a slightly different signature.

Algorithms such as Isolation Forest, clustering methods or autoencoders work with no labels at all. Autoencoders used for anomaly detection are usually trained only on verified normal data, which is the semi-supervised setup below. They train on the history a historian has recorded from the UNS topics and flag whatever falls outside the learned structure.

The trade-off shows up in the first weeks. The model flags startup sequences or cleaning cycles it has rarely seen. Your team confirms or dismisses these alerts. Use that feedback to move the alert limit or to choose data for a later retraining run to sharpen the model over time.

When Does Supervised Anomaly Detection Make Sense?

Supervised anomaly detection makes sense when you have documented, labeled failure cases in sufficient numbers. A typical source is quality inspection that publishes each rejected part to a topic such as plant1/line2/quality/reject.

The timestamp links each label to the process data recorded at that moment. Recurring bearing damage with a clear vibration signature is another case.

Supervised models reach a high hit rate on these known patterns. Any failure type missing from the training data stays invisible to them. Many teams therefore combine a supervised model for known faults with an unsupervised model for everything else.

When Does Semi-Supervised Anomaly Detection Pay Off?

Semi-supervised anomaly detection trains only on data from verified normal operation. You select periods where the machine’s state topic reports normal production and maintenance logs confirm fault-free running, then use them as the baseline. Any later reading that deviates strongly counts as an anomaly.

This method pays off when you can identify clean periods with confidence. Hidden faults in the history stay out of the baseline, so the model typically produces fewer false positives than an unsupervised model trained on unfiltered data.

How Does AI Anomaly Detection Work Step by Step, From Sensor to Alert?

AI anomaly detection works in six steps that turn raw sensor readings into an alert a maintenance technician acts on. Each step produces a concrete artifact, from the live data stream to the baseline model, the anomaly score and the final alert message.

  1. Capture readings at the source: Sensors, PLCs or edge gateways read values such as temperature, vibration or current and attach a timestamp. Artifact: a timestamped reading per signal.
  2. Publish over an MQTT broker: The gateway publishes each reading to a topic on the MQTT broker. Artifact: a live data stream that any subscriber consumes.
  3. Structure data in the Unified Namespace: The topic hierarchy places every signal under its plant, line and machine. Artifact: a contextualized data model.
  4. Train the baseline: A data engineer subscribes a historian or database to the relevant topics, exports several weeks of normal operation and trains the model. Artifact: training dataset and baseline model.
  5. Score live data in real time: The model subscribes to the same topics and calculates an anomaly score per reading or time window. Artifact: a stream of anomaly scores.
  6. Hand over the alert with context: When a score exceeds the alert limit, the model publishes an alert to a dedicated topic. The control room, a dashboard or the ticketing system subscribes to it. Artifact: the alert message.

A technician acts on an alert only if it answers the obvious questions right away. Put the anomaly score, the affected topic, the time window and the signals that contributed most into the message, each with its normal value next to the current one.

{
  "topic": "plant1/line2/pump03",
  "score": 0.91,
  "window": "2026-10-19T06:00Z/2026-10-19T08:00Z",
  "drivers": [
    {"signal": "bearing_temp", "value": 66.2, "normal": 58.5, "unit": "°C"},
    {"signal": "motor_current", "value": 19.1, "normal": 17.2, "unit": "A"}
  ]
}

Once this chain runs, automated anomaly detection watches thousands of signals around the clock with no manual maintenance of per-signal limits. The anomaly detection system surfaces the few readings that deserve an engineer’s attention.

Flow from a sensor or PLC through an edge gateway and an MQTT broker into a historian for training and an anomaly model for live scoring, with the alert published back to dashboard, control room, and ticketing
Figure 2: From sensor to alert. The broker feeds training, live scoring, and the alert topic.

Why Does AI Anomaly Detection Need a Real-Time Data Pipeline Like MQTT?

AI anomaly detection needs a real-time data pipeline such as MQTT because a model can only evaluate the data it receives. Latency, gaps and missing context in the data connection cap detection quality, whatever algorithm you choose. A strong model fed with delayed or incomplete readings produces late or false alerts.

MQTT fits this job through its publish-subscribe model. The edge gateway publishes each reading once to the broker. The broker delivers it to every subscriber in parallel, whether that is the anomaly model, the historian or a dashboard. Only the gateway reads the PLC and no consumer polls it individually, which keeps load on the network and the PLC low.

What Does an Anomaly Detection Model Need From Streaming Machine Data?

An anomaly detection model needs four properties from streaming machine data. Each one prevents a typical source of false alerts.

Consistent timestamps: Set the timestamp at the source and synchronize all gateways via NTP or PTP. The arrival time at the broker hides network delays.

Stable sampling rate: Publish each signal at a fixed interval or on change with a defined deadband. Document which rule applies to which signal.

Gap-free delivery: Buffer readings on the gateway during network outages and send them once the connection returns.

Matching QoS level: Use MQTT QoS 1 or 2 for signals that feed the model. Reserve QoS 0 for high-frequency values where a single lost reading has no effect.

Missing data from a disconnected gateway is one of the most frequent sources of false alerts. The model reads the silent signal as a sudden change in behavior and alerts on a machine that runs perfectly.

The MQTT Last Will (LWT) handles this case. The broker publishes the gateway’s last will message to a status topic once it detects an unexpected disconnect, at the latest after 1.5 times the keep-alive interval.

With MQTT retained messages on that status topic, every new subscriber instantly knows whether a source is online. Your pipeline pauses scoring for the affected signals until the source is back. Both mechanisms are defined in the MQTT 5.0 specification.

How Does a Unified Namespace Give Anomaly Models Their Context?

A Unified Namespace gives anomaly models context by placing every signal in a hierarchy of enterprise, site, area, line, machine and signal. The model reads from the topic path which machine a value belongs to and which signals share the same line. This structure makes contextual and collective anomalies much easier to detect.

acme/berlin/bottling/line2/filler/pressure
acme/berlin/bottling/line2/filler/temperature
acme/berlin/bottling/line2/filler/state
acme/berlin/bottling/line2/capper/temperature
acme/berlin/bottling/line2/labeler/temperature
acme/berlin/utilities/cooling/chiller1/supply_temp

From this tree, the model derives two kinds of context. The state topic turns a raw power or pressure reading into a check against the current state, whether producing, cleaning or stopped. The shared line2 path groups filler, capper and labeler, so a common temperature drift shows up as a collective anomaly. The utilities/cooling branch points to the cooling supply as a likely cause.

For anomaly detection, a consistent naming scheme and one state topic per machine are the minimum. The full Unified Namespace architecture depends on your plant structure.

Host Your Unified Namespace on a Production-Ready MQTT Broker

Pro Mosquitto hosts your Unified Namespace and delivers readings to models, historian and dashboards in real time.

Which Benefits Does AI Anomaly Detection Deliver in Production?

AI anomaly detection delivers four benefits in production. It catches slow drifts earlier, detects failure patterns nobody has seen before, cuts alarm noise and scales to thousands of signals with no per-signal limit tuning.

Earlier detection of slow drifts: A pressure line that loses 0.05 bar per shift never crosses its fixed limit until a seal fails. A model trained on normal pressure curves can flag the trend within the first days.

Detection of unknown failure patterns: Rules describe failures someone has already seen. An unsupervised model flags any strong deviation, including a failure mode that appears for the first time on a new line.

Less alarm noise: Context from the operating state silences alerts during planned startups, cleaning cycles and changeovers. Operators see fewer alerts and are more likely to act on the ones that remain.

Scale with no per-signal limit tuning: A plant with 20,000 signals carries 20,000 limits that someone has to maintain. Automated anomaly detection learns these ranges from data. A model that subscribes to a wildcard topic such as plant1/+/+/temperature also picks up every new machine as soon as it publishes.

Missing signals, gaps and inconsistent timestamps restrict what any model finds, which leads straight to the limits of the method.

Where Does AI Anomaly Detection Reach Its Limits?

AI anomaly detection reaches its limits when data quality breaks down, when teams cannot trace why an alert fired and when normal behavior keeps shifting. In distributed industrial setups with several brokers, data quality is one of the most frequent causes of poor results.

How Do Multi-Broker Setups Distort an Anomaly Baseline?

Edge-to-Cloud architectures often run one MQTT broker per site and bridge selected topics to a main broker in the cloud. Each hop adds three risks for the baseline.

Lost messages over bridges: If a bridge forwards with QoS 0, readings from an outage are gone. The model then learns these gaps as part of normal behavior.

Time offset between sites: Gateways in two plants with unsynchronized clocks shift readings by seconds. That offset is enough to break correlations across sites.

Duplicate delivery: QoS 1 delivers at least once, so the same reading can arrive twice after a reconnect. Deduplicate by source timestamp and signal name or by a sequence number in the payload, or the model sees artificial spikes.

Track bridge status, message rates per topic and client disconnects with MQTT monitoring. These metrics tell you whether a gap in the training data is a real process event or a transport problem.

Why Do OT Teams Need Traceable Alerts?

OT teams act on an alert only if they see what triggered it. A bare score of 0.91 quickly loses credibility after a few false alarms. Include score, topic, time window and contributing signals as the minimum and add a direct link to the trend chart of the affected signals, so operators can verify the deviation in seconds.

What Happens When Normal Operation Keeps Changing?

Normal operation changes with every recipe change, seasonal shift in ambient temperature, new tool or added machine. A baseline trained in winter flags summer cooling loads as anomalies.

Retrain after every planned process change and at fixed intervals. Track the alert rate per machine as an early sign of an outdated baseline.

Which Checks Come Before a Model Goes Live?

Run through this checklist before an anomaly model scores live production data.

  • All gateways sync time via NTP or PTP and set timestamps at the source
  • Every signal the model uses has a topic in the namespace, plus one state topic per machine
  • QoS levels are defined per signal class
  • Last Will and retained status topics mark offline data sources
  • Bridges buffer data during outages and duplicates get removed
  • Training data covers all regular operating states
  • Alerts carry score, topic, time window and contributing signals
  • A retraining trigger exists for process changes

Where Is AI Anomaly Detection Used Across Industries?

AI anomaly detection runs wherever machines and assets stream sensor data. Manufacturing, energy, logistics, data centers and the process industry are the most common anomaly detection use cases, each with its own data sources and typical anomalies.

IndustryData sourceTypical anomalyBenefit
ManufacturingVibration, temperature and current on pumps, motors, spindlesBearing wear drifting across shiftsRepair planned into a scheduled stop
Energy and utilitiesTransformer temperature, grid frequency, turbine vibrationHot spot in a substation at normal loadFewer unplanned outages
Logistics and fleetTelematics, engine data, cold chain temperatureReefer temperature rising on one routeFewer spoiled goods
Data centersPower draw, cooling, rack temperatureRising cooling load at constant IT loadOverheating caught early
Water and process industryFlow, pressure, pH, pump powerPressure drop pointing to a leakLeak detected before losses grow

Cybersecurity and fraud detection are further anomaly detection applications that apply the same baseline principle to network logs and payments.

Anomaly detection reports that a machine deviates from its normal state. Predictive maintenance forecasts when a component will fail. Many teams start with anomaly detection because it works without failure history and runs on the same machine monitoring data.

What Should Anomaly Detection Software for Machine Data Offer?

Good anomaly detection software for machine data reads live MQTT streams, handles data gaps and explains each alert. Use the following criteria when you compare any anomaly detection tool for OT data.

CriterionWhat to check
Streaming inputNative MQTT subscription or a Kafka connector, support for Sparkplug B payloads
Data gap handlingReads online and offline status topics, pauses scoring during outages
ExplainabilityShows contributing signals and normal values for every alert
RetrainingScheduled and event-based retraining with versioned baselines
DeploymentRuns at the edge, on premises or in the cloud next to your broker

Delivering clean, timestamped and contextualized data to the tool is the job of the MQTT infrastructure underneath.

Give Your Anomaly Models Complete, Real-Time Machine Data

AI anomaly detection finds drifts, unknown failure patterns and combined deviations in machine data that fixed thresholds miss. The data pipeline behind the model decides most of the result. Models deliver far more reliable alerts once readings arrive complete, with consistent timestamps and structured by plant, line and machine.

Start by defining the signals and topics that matter. Secure their transport over a production-ready MQTT broker and build a topic hierarchy that gives every value its context. Cedalo provides the MQTT infrastructure for exactly this step.

Build Your MQTT Data Backbone for AI Anomaly Detection

Pro Mosquitto keeps machine data flowing through Active-Active Clustering when a broker node fails, so your anomaly models train on complete data and your team gets alerts it can trust.

AI Anomaly Detection – Frequently Asked Questions

How Much Historical Data Does an AI Anomaly Detection Model Need?

The training period has to cover every regular operating state, including startups, shift changes, recipe changes, cleaning cycles and planned stops. For most production lines that means several weeks of data. A shorter period of verified normal data beats a long history full of undetected faults.

Can AI Anomaly Detection Run at the Edge?

Yes, lightweight models such as Isolation Forest or small autoencoders run on industrial edge gateways. Edge scoring pays off when you need alerts within milliseconds or when bandwidth to the cloud is limited. Training usually happens in the data center or cloud.

How Do You Reduce False Positives in an Anomaly Detector?

Tune the alert limit on the anomaly score with feedback from operators on past alerts. Filter out data gaps before scoring and pass the machine state as an extra input so startups and cleaning cycles stay quiet. Fire an alert only when the deviation persists over several consecutive time windows.

Which MQTT Payload Structure Works Best for AI Anomaly Detection?

Use structured payloads with timestamp, unit, signal name and quality flag, identical across all machines. MQTT Sparkplug B standardizes this with defined metrics and birth and death certificates that mark devices online or offline. Many UNS setups map its topic structure into the ISA-95 hierarchy.

How Does Pro Mosquitto Forward Machine Data to an Anomaly Detection Model?

Pro Mosquitto delivers readings to any MQTT client, so a model subscribes directly to the relevant topics. For models on a data platform, native bridges and integrations forward the same topics to Kafka, databases such as PostgreSQL or MongoDB and cloud services on AWS, Azure or Google Cloud.

Can an Existing Eclipse Mosquitto Setup Feed an AI Anomaly Detection Pipeline?

Yes, Eclipse Mosquitto delivers machine data to any subscribing model out of the box. For production pipelines that need clustering and High Availability, SSO, audit trails and monitoring across brokers, you move to Pro Mosquitto and can reuse your existing Mosquitto configurations.

About the author

Vitalii Tutevych
Vitalii Tutevych

Software Engineer at Cedalo

Vitalii is a software engineer at Cedalo GmbH. He holds a background in computer engineering and is currently completing an M.Sc. in Computer Science at Universität Bonn, where his work has focused on computer vision, data annotation, and robot perception.

Prior to Cedalo, Vitalii worked as a research assistant on the NimbRo@Home and NimbRo Soccer robotics teams, contributing to award-winning RoboCup competition entries, and taught university courses on robotics and machine learning topics for several years.

View all articles by Vitalii Tutevych