Bachelor Program in Mechatronics Engineering
Internet of Things in Mechatronics
•
Bachelor
IoT Data Engineering and Analytics
Introduction
In a mechatronic system, sensors generate observations of temperature, vibration, pressure, position, current, speed, and other physical variables. These observations become useful only when they are acquired reliably, assigned trustworthy time and context, stored appropriately, analyzed correctly, and connected to operational decisions. IoT data engineering is therefore more than moving sensor readings to a dashboard. It is the disciplined design of a data lifecycle that preserves meaning, quality, traceability, and fitness for purpose.
A typical industrial pipeline begins at a sensor or controller and proceeds through acquisition, transport, validation, cleansing, contextualization, storage, analysis, visualization, and action. Errors at an early stage can propagate into misleading key performance indicators (KPIs), false alarms, or unsafe decisions. For example, a vibration value without a sensor location, sampling rate, engineering unit, or calibration status cannot be interpreted reliably.
This chapter develops the principles and practical methods needed to build IoT data pipelines for mechatronic applications. It emphasizes time-series data, data quality, KPI design, anomaly detection, statistical reasoning, and evidence-based operational decisions.
Learning Objectives
By the end of this chapter, a student should be able to:
Describe the architecture and lifecycle of an IoT time-series data pipeline.
Explain sampling, timestamps, synchronization, missing data, noise, and aliasing.
Apply practical methods for cleansing and contextualizing sensor data.
Select suitable storage models for operational and analytical workloads.
Calculate and interpret common manufacturing and maintenance KPIs.
Distinguish descriptive, diagnostic, predictive, and prescriptive analytics.
Apply basic statistical control and anomaly-detection techniques.
Evaluate analytical results in relation to uncertainty, safety, governance, and operational decisions.
1. The IoT Data Lifecycle
The data lifecycle can be represented as:
IoT data engineering lifecycle from physical process to operational decision
Figure: IoT data engineering lifecycle from physical process to operational decision
Figure: The IoT data lifecycle and its operational feedback loop.
Acquisition and transport
Acquisition includes sensor selection, signal conditioning, analog-to-digital conversion, sampling, timestamping, and transmission. The sampling frequency must reflect the dynamics of the measured process. A slowly changing tank level may be sampled every minute, whereas a vibration signal may require thousands of samples per second. Sampling below the required rate can cause aliasing, in which high-frequency behavior appears falsely as lower-frequency behavior. Anti-aliasing filters should be applied before digitization when the signal contains frequencies near or above half the sampling frequency.
A measurement should normally include a value, timestamp, device identifier, variable identifier, unit, quality flag, and sometimes location, operating mode, calibration version, and sequence number. Message protocols such as MQTT, OPC UA, and HTTP-based interfaces address communication, but they do not automatically guarantee correct semantics or data quality.
Time and synchronization
Time-series analysis depends on trustworthy temporal order. Systems should define whether timestamps represent measurement time, gateway receipt time, or cloud ingestion time. These are not interchangeable. Network delay may make receipt time unsuitable for calculating machine cycle duration. Clock synchronization using an appropriate time service is essential, particularly when events from several controllers are correlated.
A timestamp policy should specify time zone, daylight-saving treatment, clock precision, maximum tolerated clock drift, and behavior during communication outages. Sequence numbers and buffering help identify duplicated, delayed, or out-of-order messages.
2. Data Quality and Cleansing
Data cleansing should be governed by explicit rules rather than ad hoc deletion. Important dimensions include:
Quality dimension
Typical question
Example failure
Completeness
Are expected observations present?
A gateway loses 15 minutes of readings
Validity
Is the value within physical and logical limits?
Negative pressure in a sealed positive-pressure line
Accuracy
Does the value represent the true quantity?
Sensor drift after calibration expiry
Consistency
Do related signals agree?
Motor state is OFF while speed is 1,500 rpm
Timeliness
Did data arrive soon enough?
Alarm arrives after the machine has stopped
Uniqueness
Are records duplicated?
A retry creates two identical events
Lineage
Can the result be traced to source data?
KPI has no calculation version
Range and plausibility checks
Engineering limits should be distinguished from statistical limits. An engineering range is based on physical or equipment constraints; a statistical limit is inferred from observed behavior. A value outside an engineering range should generally be flagged, but replacing it automatically may hide a genuine hazardous condition. A quality flag such as valid, suspect, missing, or imputed should accompany the record.
Missing values and imputation
Missingness may be random, caused by a communication outage, or related to the process itself. A short gap in a slowly varying temperature signal may be linearly interpolated, but interpolation is inappropriate for a sudden fault or a rapidly changing vibration signal. Forward filling can be useful for a machine operating state, but it is dangerous for cumulative energy or a variable that changes continuously.
Linear interpolation between points [? can be expressed as:
x(t) = x1 + (x2 - x1) × (t - t1)/(t2 - t1)
Here, x₁ and x₂ are neighboring observations at times t₁ and t₂, and t lies between them. The method assumes approximately linear behavior during the gap and should not be used across a known event or mode transition. The imputation method, reason, and affected interval must be recorded for auditability.
Filtering and aggregation
A moving average reduces short-term variation:
mt = (1/k) ∑ᵢ₌₀ᵏ⁻¹ xt-i
where mₜ is the average at time t, x is the measured value, and k is the number of observations. The result has the same unit as x. A larger k produces stronger smoothing but also increases delay and may conceal short faults. Filtering should therefore be selected according to the decision being supported.
The arithmetic mean of n observations is:
x̄ = (1/n) ∑ᵢ₌₁ⁿ xᵢ
The sample standard deviation is:
s = √[(1/(n−1)) ∑ᵢ₌₁ⁿ (xᵢ − x̄)²]
The n−1 denominator provides an unbiased estimator of population variance under common random-sampling assumptions. Industrial sensor data often violate independence because consecutive readings are autocorrelated; interpretation must therefore consider sampling interval and process dynamics.
3. Contextualization and Data Models
Context transforms a numerical observation into operational information. A temperature of 78 °C is ambiguous without knowing whether it refers to a bearing, coolant, enclosure, or ambient environment; whether the machine is loaded; and whether the sensor is calibrated.
Semantic identity: standardized names, units, engineering definitions, and tags.
Events: starts, stops, alarms, maintenance, changeovers, and product batches.
Operating mode: idle, setup, production, cleaning, fault, or manual operation.
Provenance: source device, firmware, calibration record, transformation, and software version.
Time-series records are often stored in a wide model, in which each timestamp contains many columns, or a long model, in which each row contains timestamp, asset, variable, value, and quality information. Wide models can be efficient for fixed high-frequency signals; long models are flexible for diverse assets. A hybrid architecture is common.
Contextualization also prevents invalid comparisons. Comparing energy consumption during loaded production with energy during idle operation can produce a misleading efficiency conclusion. Analytics should segment data by comparable operating states.
4. Storage and Processing Architecture
A practical IoT architecture usually combines several storage roles:
Layer
Purpose
Typical content
Edge buffer
Continue operation during network loss
Recent raw readings and control events
Time-series store
Fast recent queries and dashboards
Timestamped measurements and tags
Event or relational store
Structured business and asset data
Work orders, products, shifts, inspections
Data lake/object store
Low-cost historical raw data
Original files, logs, high-resolution signals
Curated analytical store
Consistent reporting and models
Validated, contextualized datasets
Raw data should generally be retained when storage, privacy, and governance constraints permit. Curated data can be regenerated if transformation logic is versioned. Retention policies should distinguish high-resolution waveform data, summary statistics, alarms, and regulatory records.
Batch processing is suitable for daily reports and historical model training. Stream processing is suitable for alarms, near-real-time dashboards, and control-support applications. A system may use both: streaming for immediate detection and batch jobs for reconciliation and trend analysis.
Data integrity requires access control, encryption where appropriate, backups, schema management, validation tests, and monitoring of the pipeline itself. Pipeline KPIs include ingestion latency, missing-message rate, duplicate rate, failed transformations, and query performance.
5. Visualization and KPI Engineering
A visualization should support a decision, not merely display data. Effective dashboards identify the audience, decision frequency, threshold, time horizon, and response owner. A maintenance dashboard may emphasize asset health and alarm persistence; a production dashboard may emphasize throughput, quality, and availability.
Overall Equipment Effectiveness
A widely used manufacturing KPI is Overall Equipment Effectiveness (OEE):
OEE = Availability × Performance × Quality
The three factors are commonly defined as:
Availability = Operating time / Planned production time
Performance = (Ideal cycle time × Total units) / Operating time
Quality = Good units / Total units
Availability reflects losses such as breakdowns and setup, performance reflects speed losses and minor stops, and quality reflects rejects and rework. The definitions require a consistent treatment of planned stops, scheduled time, ideal cycle time, and counted units. OEE values are dimensionless and usually expressed as percentages.
Worked example: OEE
A cell has 480 minutes of planned production time. It operates for 420 minutes, produces 800 units, has an ideal cycle time of 0.45 minutes per unit, and produces 760 good units.
Availability = 420/480 = 0.875.
Performance = (0.45 × 800)/420 = 360/420 ≈ 0.857.
Quality = 760/800 = 0.950.
Therefore:
OEE = 0.875 × 0.857 × 0.950 ≈ 0.712, or 71.2%.
The result does not by itself identify the main intervention. The factors show that availability is 87.5%, performance 85.7%, and quality 95.0%; the improvement program should investigate the dominant losses and their economic consequences rather than pursue the OEE percentage alone.
Other useful KPIs include mean time between failures (MTBF), mean time to repair (MTTR), energy per good unit, first-pass yield, cycle-time variability, alarm rate, and schedule adherence. Every KPI should have a definition, numerator, denominator, time basis, inclusion rules, owner, and data-quality status.
6. Statistical Analysis and Anomaly Detection
Analytics can be classified as descriptive (what happened), diagnostic (why it happened), predictive (what may happen), and prescriptive (what should be done). These categories are not strictly separate; a reliable predictive model depends on descriptive and diagnostic foundations.
Control limits
For a stable process with approximately normal independent observations, estimated three-sigma limits for individual observations are often written:
UCL = x̄ + 3s LCL = x̄ − 3s
where UCL and LCL are upper and lower control limits. These are not specification limits. Specification limits come from engineering or customer requirements; control limits describe expected process behavior under a defined stable condition. Autocorrelation, changing operating modes, non-normal distributions, and small samples can make this simple method inappropriate.
Z-score and robust alternatives
A standardized score is:
z = (x − μ)/σ
where μ is a reference mean and σ is a reference standard deviation. A large absolute z-score may indicate an anomaly, but only if the reference population is appropriate and relatively stable.
For skewed or contaminated data, a robust score can use the median and median absolute deviation (MAD):
MAD = median(|xᵢ − median(x)|)
A robust standardized score is often approximated by:
zᵣ = 0.6745(x − median(x))/MAD
The constant 0.6745 makes the score comparable to a normal-distribution scale under standard assumptions. If MAD is zero, this formula cannot be used without a different scale estimate.
Multivariate and model-based detection
A bearing may be anomalous because temperature, vibration, and speed jointly form an unusual combination even when each individual value remains within its limit. Multivariate methods, classification models, autoencoders, and forecasting residuals can identify such patterns. However, model outputs are not automatically faults. They require validation against maintenance records, operating modes, sensor condition, and consequences of false alarms.
A simple residual approach forecasts a value x̂ₜ and computes:
et = xt − x̂t
An alert may be generated when residual magnitude persists beyond a threshold. Thresholds should be chosen using representative validation data and cost considerations. Alarm flooding reduces trust; alarm suppression should never remove safety-critical indications without formal hazard analysis.
7. Evidence-Based Operational Decisions
An analytical result becomes operationally valuable when it answers five questions:
What was measured, and how reliable is it?
What comparison or baseline was used?
How large and practically important is the deviation?
What alternative explanations remain?
What action, owner, deadline, and verification method follow?
Correlation does not establish causation. If motor current rises while vibration rises, possible explanations include increased load, misalignment, bearing damage, lubrication problems, or a measurement fault. A sound investigation combines sensor evidence with work orders, operator observations, process conditions, and controlled tests.
Decision thresholds should reflect risk. A low-cost, reversible inspection may justify action at a lower confidence level than an expensive shutdown. Safety-related decisions require documented engineering analysis and cannot rely solely on an opaque machine-learning score.
8. Illustrative Case: Predictive Maintenance for a Conveyor Drive
Background
The following is a fictional illustrative case. A packaging plant operates conveyor drives with electric motors, gearboxes, and bearings. Each drive reports motor current, speed, bearing temperature, and vibration RMS. The maintenance team performs corrective maintenance after failures and wants earlier warning without increasing nuisance work orders.
Problem
The existing dashboard displays live values but does not distinguish idle, loaded, and changeover conditions. Operators report that vibration alarms occur during high-speed operation even when no defect is found. Historical data also contain duplicate messages and gaps caused by wireless interference.
Analysis
The engineering team first establishes asset identifiers and links sensor readings to machine state, product, speed, and maintenance events. It discovers that approximately 4% of records are duplicated and that missing intervals are concentrated near a gateway with weak coverage. Vibration is strongly dependent on speed, so a single global threshold is unsuitable.
The team creates operating-state segments and calculates baseline median and MAD for vibration within each speed band. Records with invalid timestamps are quarantined; short temperature gaps are flagged and linearly interpolated only for visualization, not for failure-model training. Raw records remain unchanged.
Approach and solution
The pipeline performs the following steps:
Ingest readings with device time, gateway time, sequence number, unit, and quality flag.
Remove exact duplicates using asset, timestamp, variable, value, and sequence information.
Detect clock drift and out-of-order records.
Join readings with machine state and maintenance events.
Calculate speed-conditioned robust scores for vibration.
Require an elevated score for three consecutive valid intervals before issuing a maintenance recommendation.
Present the score with trend, operating state, last inspection, and data-quality status.
Record whether the recommendation was inspected, confirmed, rejected, or caused by sensor error.
Outcome
After a pilot period, the plant does not judge success by the number of alerts. It evaluates confirmed defect detection, false-alert rate, warning time, avoided downtime, inspection workload, and data completeness. The first model identifies two genuine lubrication problems but also reveals one poorly mounted sensor. The maintenance team therefore adds sensor installation checks and uses the analytical system as decision support rather than automatic shutdown control.
Learning points
The case illustrates that contextualization may improve detection more than a complex algorithm. It also demonstrates the importance of separating raw and transformed data, recording uncertainty, validating alerts against field evidence, and evaluating operational outcomes rather than model accuracy alone.
9. Governance, Ethics, and Professional Practice
IoT data may reveal production rates, worker activity, maintenance performance, or proprietary process conditions. Organizations should define legitimate purposes, access rights, retention periods, and responsibilities. Worker-related monitoring requires transparency, proportionality, and compliance with applicable labor and data-protection law.
Data governance should include a data dictionary, ownership, quality rules, lineage, change control, and incident response. Engineers must avoid presenting imputed values as measured values or using a KPI whose denominator is unstable or selectively chosen. Models should be tested for bias across assets, shifts, products, and operating conditions. Cybersecurity is part of data integrity: unauthorized changes to timestamps, thresholds, or asset identity can produce unsafe conclusions.
For safety-critical applications, analytics must be integrated with functional-safety processes, validated sensors, fail-safe behavior, and human accountability. An AI model may prioritize inspections, but it should not silently override a protective interlock.
10. Best Practices and Contemporary Developments
Effective IoT analytics programs commonly follow these practices:
Begin with a decision and measurable business or engineering outcome.
Define data semantics, units, time policy, and asset identity before scaling.
Preserve raw data and quality metadata.
Separate engineering limits, statistical limits, and alarm thresholds.
Segment analysis by operating mode and process context.
Monitor the pipeline as carefully as the physical equipment.
Version transformations, dashboards, thresholds, and models.
Test with historical incidents and prospective pilot data.
Combine automated detection with human domain expertise.
Measure false alarms, missed events, latency, and operational benefit.
Current developments include edge analytics for low-latency decisions, digital twins for contextual simulation, federated or privacy-preserving learning, and multimodal models combining sensor streams, maintenance text, images, and process logs. These developments increase capability but also increase the need for traceability, computational discipline, cybersecurity, and clear human oversight. A sophisticated model cannot compensate for poor timestamps, incorrect units, or an undefined decision process.
Chapter Summary
IoT data engineering converts physical measurements into reliable operational evidence. A complete pipeline includes acquisition, synchronized timestamps, transport, validation, cleansing, contextualization, storage, analysis, visualization, and feedback. Time-series quality depends on sampling, anti-aliasing, clock management, missing-data treatment, duplicate detection, engineering plausibility, and provenance.
Context is essential: asset hierarchy, operating mode, product, events, and maintenance history determine whether comparisons are meaningful. Storage architectures commonly combine edge buffers, time-series databases, event stores, data lakes, and curated analytical stores. KPIs such as OEE are useful only when their definitions and denominators are consistent.
Statistical tools—including moving averages, standard deviation, control limits, z-scores, robust scores, and residual analysis—must be applied under appropriate assumptions. An anomaly is not automatically a fault, and a correlation is not automatically a cause. Evidence-based decisions require reliable data, relevant baselines, alternative-explanation testing, risk-aware thresholds, and defined actions.
Professional practice also requires governance, cybersecurity, ethical handling of worker and process data, model validation, and human accountability. The strongest IoT solutions are not necessarily the most complex; they are the ones that connect trustworthy data to verified and beneficial decisions.
Key Terms
Data pipeline: A sequence of processes that acquires, transforms, stores, analyzes, and delivers data.
Time-series data: Observations indexed by time, often generated repeatedly by sensors.
Sampling frequency: The number of measurements acquired per unit of time.
Aliasing: Misrepresentation of high-frequency behavior caused by inadequate sampling.
Timestamp: A recorded time associated with a measurement or event.
Data lineage: The traceable history of a datum and its transformations.
Contextualization: Addition of asset, process, operating-state, and event meaning to raw data.
Imputation: Estimation or replacement of missing observations.
Quality flag: A label indicating the validity or condition of a data record.
Time-series database: A database optimized for timestamped observations.
KPI: A defined measure used to evaluate performance against an objective.
OEE: The product of availability, performance, and quality factors.
Availability: The proportion of planned production time during which equipment operates.
Anomaly: An observation or pattern that differs from expected behavior.
Control limit: A statistically derived boundary for expected process variation.
Specification limit: An engineering or customer requirement boundary.
Residual: The difference between an observed value and a predicted value.
False positive: An alert indicating a condition that is not actually present.
Data governance: Policies and responsibilities controlling data quality, access, use, and retention.
Edge analytics: Processing performed near the data source rather than exclusively in a central cloud.
Review Questions
Short Answer Questions
Why must measurement time be distinguished from gateway receipt time?
State two reasons why a sensor value should carry a quality flag.
What is the purpose of contextualizing a time-series observation?
Distinguish a control limit from a specification limit.
Name the three factors used in the common OEE definition.
Long Answer Questions
Explain the complete lifecycle of an IoT data pipeline for a mechatronic production cell.
Discuss how missing data, duplicates, out-of-order messages, and sensor drift should be managed.
Explain why operating-mode segmentation is important in KPI calculation and anomaly detection.
Compare batch processing and stream processing, including suitable industrial applications for each.
Discuss the governance, cybersecurity, ethical, and safety issues associated with industrial IoT analytics.
Analytical / Application Questions
A machine produces 1,200 units during 600 minutes of operating time. Its ideal cycle time is 0.4 minutes per unit, 1,140 units are good, and planned production time is 720 minutes. Calculate availability, performance, quality, and OEE. Explain which factor should be investigated first.
A vibration signal increases whenever rotational speed increases, but no failures occur at high speed. Design a data-analysis method that distinguishes speed-related normal behavior from a genuine anomaly.
An anomaly model produces many alerts during network outages. Propose pipeline-quality checks and decision rules that reduce false alerts without concealing a genuine equipment fault.
Multiple Choice Questions with Answers
Question 1
Which information is most important for interpreting a raw temperature reading in an industrial IoT system?
A. The dashboard color
B. The asset identity, unit, operating state, and timestamp
C. The number of users viewing the dashboard
D. The brand of the visualization software
Correct Answer: B. The asset identity, unit, operating state, and timestamp
Question 2
What is the principal danger of sampling a signal below the required rate?
A. Data encryption
B. Aliasing
C. Data contextualization
D. Asset duplication
Correct Answer: B. Aliasing
Question 3
A machine has 480 minutes of planned production time and operates for 420 minutes. What is its availability?
A. 0.875
B. 0.857
C. 0.950
D. 1.143
Correct Answer: A. 0.875
Question 4
Which statement correctly distinguishes a control limit from a specification limit?
A. A control limit is always set by the customer
B. A specification limit describes expected statistical variation in a stable process
C. A control limit is statistically derived, while a specification limit comes from engineering or customer requirements
D. They are identical terms
Correct Answer: C. A control limit is statistically derived, while a specification limit comes from engineering or customer requirements
Question 5
Why is linear interpolation unsuitable across a known machine fault event?
A. It changes the unit of measurement
B. It may invent smooth values across a discontinuity and hide the event
C. It always increases sampling frequency
D. It removes timestamps
Correct Answer: B. It may invent smooth values across a discontinuity and hide the event
Question 6
What does OEE commonly equal?
A. Availability + Performance + Quality
B. Availability × Performance × Quality
C. Availability ÷ Performance × Quality
D. Performance − Availability − Quality
Correct Answer: B. Availability × Performance × Quality
Question 7
In the residual equation et = xt − x̂t, what does the residual represent?
A. The difference between observed and predicted values
B. The sampling frequency
C. The asset hierarchy
D. The average of all sensor values
Correct Answer: A. The difference between observed and predicted values
Question 8
Which practice best reduces misleading comparisons between production periods?
A. Ignoring operating mode
B. Combining all products into one baseline
C. Segmenting data by comparable operating state
D. Deleting all low values
Correct Answer: C. Segmenting data by comparable operating state
Question 9
What is a false positive in anomaly detection?
A. A real fault that is not detected
B. An alert when the suspected condition is not actually present
C. A duplicated timestamp
D. A valid measurement outside a sensor range caused by calibration
Correct Answer: B. An alert when the suspected condition is not actually present
Question 10
Why should raw IoT data normally be retained when feasible?
A. To prevent all future data transformation
B. To allow traceability, auditing, and regeneration of curated results
C. To eliminate the need for quality flags
D. To guarantee that every model is accurate
Correct Answer: B. To allow traceability, auditing, and regeneration of curated results
Internet of Things in Mechatronics
Chapter 8
of 15