Internet of Things in Mechatronics

Chapter 9
AI for Intelligent Mechatronic Systems

Bachelor Program in Mechatronics Engineering
Internet of Things in Mechatronics   •   Bachelor

AI for Intelligent Mechatronic Systems

Introduction and Context

An intelligent mechatronic system combines mechanical structure, sensors, actuators, embedded computation, communication, and control. Artificial intelligence (AI) extends this combination by enabling a system to infer operating condition, recognize patterns, predict future behavior, and adapt decisions from data. In practice, AI does not replace engineering models, safety logic, or human expertise. It complements them where physical processes are nonlinear, difficult to model completely, or affected by changing environments.

Typical applications include vibration-based condition monitoring, predictive maintenance of motors and gearboxes, fault diagnosis in hydraulic and pneumatic systems, camera-based inspection, adaptive control of robots, and energy or production optimization. These applications differ in their data, time constraints, risks, and acceptable error rates. A model that is suitable for detecting a cosmetic defect may be unsuitable for releasing a safety-critical brake.

The central engineering problem is therefore not simply to obtain a highly accurate model. It is to design a trustworthy cyber-physical system in which sensing, data management, model inference, control, maintenance decisions, cybersecurity, and human oversight operate coherently.

Learning Objectives

After studying this chapter, students should be able to:

  1. Explain the role of machine learning and edge AI in intelligent mechatronic systems.
  2. Select suitable learning paradigms for condition monitoring, diagnosis, vision, control, and optimization.
  3. Construct a valid data and model-development workflow, including leakage prevention.
  4. Calculate and interpret classification, regression, and maintenance-performance metrics.
  5. Compare cloud, edge, and hybrid AI architectures under latency and resource constraints.
  6. Evaluate explainability, uncertainty, drift, safety, cybersecurity, and human oversight.
  7. Propose an AI-enabled mechatronic solution and justify its engineering trade-offs.

1. From Connected Mechatronics to Intelligent Mechatronics

An IoT-enabled mechatronic asset typically follows the sequence:

physical process → sensing → communication → computation → decision → actuation or human action

AI can be placed at several points in this sequence. A sensor node may classify a bearing vibration locally; an edge gateway may fuse multiple sensors; a cloud service may train a fleet-wide model; and a supervisory controller may use a predicted state to optimize production.

AI-enabled mechatronic system architecture Physical plantmotor, robot, process Sensorsvibration, current, vision Edge AIfilter, infer, alarm Decision layercontrol or maintenance Cloud / fleet learningtraining, dashboards, governance
AI-enabled mechatronic system architecture
Figure: AI-enabled mechatronic system architecture

Figure: A hybrid architecture in which time-critical inference occurs at the edge and fleet learning occurs in cloud or enterprise systems.

The distinction between training and inference is fundamental. Training estimates model parameters from historical data. Inference applies a trained model to new observations. Training may require substantial computation, whereas inference must often satisfy strict latency, memory, and energy constraints.

2. Machine-Learning Foundations for Mechatronics

2.1 Learning paradigms

Supervised learning uses labelled examples. For classification, the target may be “healthy,” “misalignment,” or “bearing defect.” For regression, the target may be remaining useful life (RUL), temperature, torque, or dimensional error. Common models include linear and logistic regression, decision trees, random forests, support-vector machines, and neural networks.

Unsupervised learning uses data without fault labels. Clustering can reveal operating regimes, while dimensionality reduction can expose abnormal patterns. Autoencoders are often trained to reconstruct normal data; a large reconstruction error can indicate an anomaly. Such methods are useful when failures are rare, but an anomaly is not automatically a fault: a new product, speed, or environmental condition may also appear abnormal.

Semi-supervised and self-supervised learning exploit large quantities of unlabelled data together with limited labels. For example, a model may learn representations from ordinary machine operation and later be fine-tuned using a small set of confirmed failures.

Reinforcement learning (RL) learns actions through interaction with an environment and a reward function. It can support scheduling or energy optimization, but direct exploration on a physical machine is risky. A validated simulator, a constrained policy, or a supervisory human approval layer is normally required.

2.2 Features and representations

A feature is a measurable or computed property used by a model. For vibration, features may include root-mean-square (RMS) value, crest factor, kurtosis, spectral-band energy, and characteristic-frequency amplitudes. For motor current, features may include harmonic magnitudes and phase relationships. Images may be represented by edges, textures, or learned convolutional features.

For a sequence of n samples x₁, x₂, …, xₙ, the mean and RMS are:

μ = (1/n) ∑ᵢ₌₁ⁿ xᵢ
xRMS = √[(1/n) ∑ᵢ₌₁ⁿ xᵢ²]

Here xᵢ is a sampled signal value and n is the number of samples. The formulas assume equally weighted samples; RMS has the same physical units as x. For a zero-mean voltage or acceleration signal, RMS is commonly related to signal magnitude, but it is not itself a diagnosis.

Standardization is frequently used before training:

z = (x − μtrain) / σtrain

where μ_train and σ_train are the mean and standard deviation calculated from the training set only. Applying statistics calculated from the test set causes data leakage.

2.3 Time-series discipline

Mechatronic data are not independent random observations. Adjacent samples from one machine may be strongly correlated, and multiple windows may originate from the same failure event. Randomly distributing windows between training and test sets can therefore produce an overly optimistic result. A stronger design separates data by machine, production batch, or time period. The test set should represent future operation and remain untouched until final evaluation.

Operating context must also be recorded. Speed, load, temperature, tool type, product variant, and environmental conditions can affect sensor signals. A model that learns “high load” rather than “fault” may appear accurate in one experiment and fail in production.

3. AI Applications in Intelligent Mechatronics

3.1 Condition monitoring and predictive maintenance

Condition monitoring estimates the current health state from measurements. Predictive maintenance uses that information to schedule intervention before functional failure, while avoiding unnecessary maintenance. A useful pipeline is:

  1. acquire synchronized sensor and operating-context data;
  2. validate sensor quality and remove or flag corrupted records;
  3. segment signals into meaningful windows;
  4. extract engineered or learned features;
  5. classify health, estimate degradation, or detect anomalies;
  6. combine model output with maintenance rules and inspection evidence;
  7. record the outcome for later model improvement.

A classifier may output a probability p of a fault class. This probability should not be interpreted as a guaranteed frequency unless the model is calibrated and the deployment population is comparable to the validation population. In maintenance, the cost of a missed dangerous fault may be much larger than the cost of a false alarm. Therefore, the decision threshold should reflect consequences, not merely maximize accuracy.

RUL prediction is especially difficult because the definition of failure, operating profile, censoring, and maintenance policy affect the target. A model should provide an interval or confidence estimate where possible, not only a single number.

3.2 Fault diagnosis

Detection asks whether behavior is abnormal; diagnosis asks what fault explains it; prognosis asks how behavior may evolve. A practical diagnostic system combines model output with physical knowledge. For example, an increase in vibration at a shaft rotational frequency may suggest imbalance, whereas sidebands around a gear-mesh frequency may suggest gear modulation. AI can rank hypotheses, but a maintenance engineer should verify them against installation, lubrication, load, and inspection evidence.

A confusion matrix supports evaluation of a multiclass diagnostic model. For a binary fault detector:

Precision = TP / (TP + FP)
Recall = TP / (TP + FN)
F1 = 2 × (Precision × Recall) / (Precision + Recall)

TP, FP, FN, and TN denote true positives, false positives, false negatives, and true negatives. Precision answers “when the system alarms, how often is it correct?” Recall answers “how many actual faults did it find?” F1 is useful when both matter, but it does not express the economic or safety cost of errors. Specificity is TN/(TN+FP), and accuracy is (TP+TN)/(TP+TN+FP+FN). Accuracy can be misleading for rare faults.

3.3 Computer vision

Vision systems can inspect surface defects, verify assembly, measure pose, read labels, and monitor human-machine zones. The design must control illumination, camera geometry, focus, exposure, background, and product presentation before selecting a neural network. Many apparent AI problems are actually optical or process-control problems.

For object detection, intersection over union (IoU) between predicted box A and ground-truth box B is:

IoU = area(A ∩ B) / area(A ∪ B)

IoU ranges from 0 to 1 and measures spatial overlap. Precision–recall curves and mean average precision are generally more informative than simple image-level accuracy when defects are rare or multiple objects occur.

3.4 Adaptive control

Conventional feedback control uses a model or fixed controller designed for an operating range. AI may estimate unknown dynamics, tune controller parameters, compensate for friction, or select among validated control policies. A safe architecture commonly retains a conventional inner loop and permits AI to adjust supervisory references or bounded parameters.

A discrete state-space model illustrates the interface:

xₖ₊₁ = f(xₖ, uₖ, dₖ) + wₖ
yₖ = h(xₖ) + vₖ

Here xₖ is the system state, uₖ the control input, dₖ a disturbance, yₖ the measured output, and wₖ and vₖ process and measurement errors. Functions f and h may be nonlinear. AI can approximate an unknown part of f or infer xₖ, but stability, actuator limits, sampling time, and safety constraints must still be addressed.

A learned controller should be tested in simulation, hardware-in-the-loop, and constrained physical trials. It should have a fallback controller, input and output bounds, watchdog timing, and a defined safe state.

3.5 Optimization and scheduling

AI can assist production sequencing, energy management, path planning, and parameter optimization. A general constrained optimization statement is:

minimize J(θ) subject to gᵢ(θ) ≤ 0, i = 1, …, m

Here θ is the decision vector, J is the objective, and gᵢ are constraint functions. The objective may combine cycle time, energy, quality, and wear. Weights must be made explicit because changing them changes the operational meaning of “optimal.” A solution that minimizes energy but violates takt time or thermal limits is not an engineering solution.

4. Edge AI and Resource-Constrained Deployment

Edge AI places inference near the sensors or machine. Its advantages include low latency, reduced bandwidth, local operation during network outages, and improved control over sensitive data. Its limitations include restricted memory, compute capacity, energy, maintainability, and model-update complexity.

A simple end-to-end latency budget is:

Ttotal = Tsense + Tpreprocess + Tinfer + Tdecide + Tactuate

Each term is a nonnegative time component. If the control or alarm requirement is T_max, the design requires Ttotal ≤ Tmax under the specified workload and worst-case, or suitably high-percentile, conditions. Average latency alone is inadequate for hard real-time safety functions.

Compression methods include pruning, quantization, knowledge distillation, and reduced architectures. Quantizing a model from floating-point representation to integer representation can reduce memory and accelerate inference, but may reduce accuracy, especially for small or distribution-shifted data. Post-deployment testing must use representative sensor ranges and fault cases.

A hybrid design often works best: deterministic filtering and immediate alarms at the edge; model training, fleet analysis, visualization, and governance in a secure enterprise or cloud environment. Connectivity must never be assumed for a safety-critical response.

5. Evaluation, Explainability, and Trustworthiness

5.1 Evaluation beyond accuracy

Regression performance may be summarized by mean absolute error:

MAE = (1/n) ∑ᵢ₌₁ⁿ |yᵢ − ŷᵢ|

and root mean square error:

RMSE = √[(1/n) ∑ᵢ₌₁ⁿ (yᵢ − ŷᵢ)²]

yᵢ is the observed value, ŷᵢ the prediction, and n the number of observations. Both have the units of the target; RMSE penalizes large errors more strongly than MAE. Metrics should be reported by operating regime, machine, product type, and fault class rather than only as an overall average.

Calibration evaluates whether predicted probabilities correspond to observed frequencies. A model that assigns 0.8 probability to many cases should be correct approximately 80% of the time in a comparable population. Reliability diagrams, calibration error, and threshold analysis can reveal whether an alarm probability is suitable for decision-making.

5.2 Explainability

Explainability methods include feature importance, partial-dependence analysis, local surrogate explanations, saliency maps, and example-based reasoning. Explanations can reveal sensor leakage, dependence on irrelevant background pixels, or physically implausible behavior. They do not prove causality. A highlighted vibration feature may correlate with a fault while actually representing a change in load.

For engineering use, explanations should be linked to actionable evidence: the sensor channel, time window, frequency band, image region, or operating condition that influenced the decision. Human reviewers need uncertainty, trend information, and recommended verification steps—not merely a colored heat map.

5.3 Drift and monitoring

Data drift occurs when the input distribution changes; concept drift occurs when the relationship between inputs and targets changes. Causes include sensor replacement, tool wear, new materials, altered loads, software changes, and seasonal conditions.

A deployment monitor should track missing data, ranges, distributions, latency, confidence, alarm rate, confirmed fault rate, and performance after labels become available. Drift detection is not proof that the model is wrong; it is a trigger for investigation. Responses may include recalibration, threshold adjustment, retraining, rollback, or temporary human review. Every model needs version control, a data lineage record, and a defined retirement process.

6. Human Oversight, Safety, and Governance

The risk level determines the acceptable autonomy. In advisory mode, AI recommends an action and a person approves it. In supervised autonomy, the system acts within explicit limits and a person can intervene. In autonomous operation, the system acts without routine approval but must still satisfy safety constraints and escalation rules.

Safety-related functions should follow applicable machinery, functional-safety, cybersecurity, and data-protection requirements. The exact standard depends on jurisdiction and application; engineers must consult the current requirements rather than treating AI guidance as a substitute for certification. Safety integrity cannot be inferred from a high validation score.

Important governance practices include:

  • define the intended use, excluded use, and acceptable failure modes;
  • maintain traceability from sensor data to model version and decision;
  • protect models and update channels from unauthorized modification;
  • separate safety interlocks from probabilistic predictions where required;
  • provide manual override and a safe fallback state;
  • validate representative edge cases, including missing and adversarial inputs;
  • document who is accountable for alarm acceptance, maintenance, and retraining;
  • protect worker and production data through access control, minimization, and retention policies.

Cybersecurity is part of dependability. An attacker who alters a model, injects sensor values, or blocks updates may cause unsafe actuation or conceal degradation. Secure boot, signed firmware, authenticated communication, least privilege, network segmentation, and incident response are relevant controls.

7. Worked Example: Evaluating a Bearing-Fault Detector

An illustrative detector is tested on 1,000 machine windows. The results are: TP = 72, FP = 18, FN = 8, and TN = 902. The values sum to 1,000.

Precision is:

72/(72+18) = 0.80, or 80%.

Recall is:

72/(72+8) = 0.90, or 90%.

Specificity is:

902/(902+18) ≈ 0.980, or approximately 98.0%.

Accuracy is:

(72+902)/1000 = 0.974, or 97.4%.

The F1 score is:

2×(0.80×0.90)/(0.80+0.90) ≈ 0.847.

The result appears strong, but interpretation requires context. Of 90 alarms, 18 are false, so maintenance staff may experience nuisance alarms. Eight faults are missed, which may be unacceptable if the bearing supports a safety-critical axis. The evaluation must also confirm that windows from the same failure event were not split across training and test sets. Finally, the threshold should be selected using maintenance costs, machine criticality, and the possibility of confirmatory inspection.

8. Applied Case: Illustrative Smart Conveyor System

Background

A packaging plant operates conveyors driven by induction motors and gearboxes. Unplanned gearbox failures stop the packaging line. The plant already measures motor current, vibration, speed, temperature, and production state through an industrial IoT gateway.

Problem

Maintenance is calendar-based. Some gearboxes are replaced while still healthy, while other failures occur between inspections. The plant wants earlier warning without adding a permanent high-bandwidth connection to the cloud.

Analysis

Historical labels are incomplete: confirmed failures are few, and many interventions were preventive. Operating speed and product load vary substantially. A random window-level split would cause leakage because many windows come from the same machine and event. The team therefore defines machine-and-time-based validation and records operating context.

Approach and solution

The edge gateway computes synchronized vibration and current windows, rejects missing or saturated signals, and extracts RMS, kurtosis, spectral-band energy, temperature trend, and load. An anomaly model is first trained on verified healthy operation. A supervised classifier is then trained using confirmed examples and maintenance records. The edge device issues a graded warning only when the anomaly score persists for three consecutive windows and operating conditions are within the validated range.

A cloud service stores summaries rather than all raw signals by default. It supports fleet-level retraining, model comparison, calibration analysis, and engineer review. A conventional rule-based protection system remains independent of the AI model. The maintenance dashboard displays the trend, influential channels, confidence, operating context, and recommended inspection—not a replacement command.

Outcome

In a pilot, the system detects developing degradation earlier than calendar inspection, but it also identifies several “anomalies” caused by a newly installed sensor and a changed product load. Those cases demonstrate why drift monitoring and contextual features are essential. The plant adopts a staged deployment: advisory alarms first, periodic engineering review, and only then limited automation of work-order creation.

Learning points

The value comes from the complete sociotechnical system rather than the classifier alone. Data quality, labels, validation design, threshold economics, edge reliability, maintenance workflow, and human trust determine operational success. A model should be allowed to influence action only after its failure modes and fallback behavior are understood.

9. Best-Practice Development Workflow

A robust project begins with a measurable engineering decision, not with a preferred algorithm. Define the asset, hazard, users, response time, data rights, and success criteria. Establish a baseline using rules, physics, or a simple statistical model. Build a representative dataset and document its provenance. Split data by machine or time where appropriate. Train several models, including an interpretable baseline. Evaluate performance by regime and consequence-weighted error. Test latency, memory, energy, cybersecurity, missing data, and out-of-distribution inputs on the target device. Validate with domain experts and physical tests. Deploy in shadow or advisory mode, monitor drift, and maintain rollback capability.

Model cards, test reports, calibration records, and change logs support employability in roles such as controls engineer, reliability engineer, automation engineer, data engineer, and industrial AI engineer. The ability to explain why a model is safe enough for a particular decision is as important as the ability to train it.

Contemporary Developments

Current directions include federated learning for multi-site training without centralizing all raw data; physics-informed learning that embeds conservation laws or known dynamics; digital twins for simulation and what-if analysis; tinyML for ultra-low-power inference; event-driven sensing; uncertainty-aware models; and multimodal fusion of vibration, current, thermal, acoustic, and visual data. These developments do not remove the need for validation. They increase the importance of documenting assumptions, distribution limits, and the boundary between learned inference and verified engineering behavior.

Chapter Summary

AI enables mechatronic systems to detect abnormal behavior, diagnose faults, predict degradation, inspect products, adapt control, and optimize operations. Supervised, unsupervised, semi-supervised, self-supervised, and reinforcement-learning methods serve different data and risk conditions. Correct time-series splitting, contextual features, and leakage prevention are essential for credible evaluation.

Condition monitoring and diagnosis should be connected to maintenance decisions, not treated as isolated classification tasks. Precision, recall, F1, specificity, accuracy, MAE, RMSE, calibration, and latency each answer different questions. Edge AI reduces communication dependence and latency but introduces constraints in memory, computation, energy, updating, and cybersecurity. Explainability can support engineering review, but it does not establish causality. Drift monitoring, version control, secure deployment, fallback control, and human oversight are necessary for trustworthy operation. The most effective intelligent systems combine data-driven models with physical knowledge, deterministic safety mechanisms, and accountable engineering processes.

Key Terms

Artificial intelligence: Computational methods that perform tasks requiring inference, learning, or decision-making.

Edge AI: AI inference performed near the physical machine or data source.

Inference: Application of a trained model to new observations.

Training: Estimation of model parameters from data.

Condition monitoring: Assessment of equipment health using measured signals.

Predictive maintenance: Maintenance planned using predicted condition or degradation.

Fault detection: Identification that behavior differs from an accepted condition.

Fault diagnosis: Identification or ranking of the likely cause of abnormal behavior.

Prognosis: Prediction of future condition or remaining useful life.

Data leakage: Unintended use of information unavailable at real deployment time.

Concept drift: Change in the relationship between inputs and target outcomes.

Calibration: Agreement between predicted probabilities and observed frequencies.

Precision: Fraction of positive predictions that are correct.

Recall: Fraction of actual positive cases that are detected.

Explainability: Ability to provide understandable evidence for a model output.

Quantization: Representation of model values using reduced numerical precision.

Digital twin: A computational representation linked to a physical asset or process.

Human oversight: Defined human authority to review, approve, override, or stop an AI-supported action.

Review Questions

5 Short Answer Questions

  1. Distinguish training from inference in an edge-AI system.
  2. Why can random window-level splitting produce misleading time-series results?
  3. Define precision and recall and state when each is especially important.
  4. Identify two advantages and two limitations of edge AI.
  5. What is concept drift, and how should it be monitored?

5 Long Answer Questions

  1. Explain how AI can support condition monitoring, diagnosis, and predictive maintenance, including the role of operating context.
  2. Compare supervised, unsupervised, and reinforcement learning for mechatronic applications.
  3. Discuss how a learned controller can be integrated with a conventional safety architecture.
  4. Develop an evaluation plan for a camera-based defect-inspection system.
  5. Explain why explainability, calibration, cybersecurity, and human oversight are necessary for industrial AI.

3 Analytical / Application Questions

  1. A fault detector has TP = 45, FP = 15, FN = 5, and TN = 935. Calculate precision, recall, specificity, accuracy, and F1. Which metric would you prioritize if missed faults are substantially more costly than false alarms, and why?
  2. Design an edge/cloud architecture for a robotic cell requiring a 20 ms response for collision-related protective action but daily fleet-level model updates. Identify which functions must remain local and justify your decision.
  3. A deployed vibration model begins alarming after a sensor replacement, although confirmed mechanical failures do not increase. Propose a structured investigation covering data drift, calibration, physical inspection, rollback, and retraining.

Multiple Choice Questions with Answers

Question 1

Which statement best distinguishes inference from training?

A. Inference estimates model parameters from historical data.

B. Training applies a fixed model to a new sensor window.

C. Inference applies a trained model to new observations.

D. Training is performed only on an edge device.

Correct Answer: C. Inference applies a trained model to new observations.

Question 2

Why is machine-and-time-based splitting often preferred for predictive-maintenance data?

A. It always increases the number of training samples.

B. It reduces leakage from correlated windows and future information.

C. It eliminates the need for labels.

D. It guarantees that the model will be accurate.

Correct Answer: B. It reduces leakage from correlated windows and future information.

Question 3

A detector has TP = 80 and FP = 20. What is its precision?

A. 20%

B. 75%

C. 80%

D. 100%

Correct Answer: C. 80%

Question 4

Which metric answers the question “What fraction of actual faults were detected?”

A. Recall

B. Precision

C. Specificity

D. Latency

Correct Answer: A. Recall

Question 5

Which function is most appropriately kept local in a system requiring a very fast protective response?

A. Fleet-level model retraining

B. Historical dashboard generation

C. Cloud report formatting

D. Immediate safety-related inference and interlock logic

Correct Answer: D. Immediate safety-related inference and interlock logic

Question 6

What does concept drift mean?

A. The input data contain no noise.

B. The relationship between inputs and target outcomes changes.

C. The model uses fewer parameters after quantization.

D. A sensor samples at a higher frequency.

Correct Answer: B. The relationship between inputs and target outcomes changes.

Question 7

Which statement about explainability is correct?

A. An explanation proves that the model has identified a causal mechanism.

B. A saliency map always identifies the physically responsible component.

C. Explanations can reveal reliance on irrelevant or suspicious features.

D. Explainability eliminates the need for validation.

Correct Answer: C. Explanations can reveal reliance on irrelevant or suspicious features.

Question 8

For a regression model, which metric has the same units as the predicted target?

A. MAE

B. R² only

C. A classification accuracy percentage

D. A dimensionless IoU value

Correct Answer: A. MAE

Question 9

What is a primary purpose of model calibration?

A. To reduce sensor sampling frequency to zero.

B. To make predicted probabilities correspond more closely to observed frequencies.

C. To guarantee zero false positives.

D. To replace all physical safety mechanisms.

Correct Answer: B. To make predicted probabilities correspond more closely to observed frequencies.

Question 10

Which deployment practice is most appropriate for a learned controller in a safety-relevant mechatronic system?

A. Allow unrestricted exploration on the production machine.

B. Remove all conventional control logic after initial testing.

C. Use bounded actions, fallback control, and staged validation.

D. Evaluate only average inference latency.

Correct Answer: C. Use bounded actions, fallback control, and staged validation.

Internet of Things in Mechatronics
Chapter 9 of 15