Chapter 11
Embedded, Real-Time, IoT, Edge, and Cloud Computing
Bachelor Program in Mechatronics Engineering
Introduction to Computing
•
Bachelor
Embedded, Real-Time, IoT, Edge, and Cloud Computing
Introduction and Context
Mechatronic products increasingly combine mechanical structures, sensors, actuators, electronic control, communication networks, and software. A modern robot, automated conveyor, autonomous vehicle, or smart pump is therefore not merely a mechanical machine with an electronic controller. It is a computational system that senses its environment, makes decisions, acts on the physical world, communicates with other systems, and often improves through analysis of historical data.
This chapter develops the computing foundations required to design such systems. It distinguishes embedded computing from general-purpose computing; explains real-time behavior; introduces microcontrollers and embedded software; and connects physical devices to the Internet of Things (IoT), edge platforms, cloud services, and digital twins. The central engineering challenge is to place computation in the right location. A safety-critical motor-control loop may need to execute locally within milliseconds, while long-term predictive-maintenance analysis may be more suitable for a cloud platform.
The discussion is directed toward introductory mechatronics applications, but it also introduces professional concerns including reliability, cybersecurity, privacy, maintainability, energy consumption, and responsible use of data.
Learning Objectives
By the end of this chapter, you should be able to:
Explain the structure and purpose of an embedded computing system.
Distinguish hard, firm, and soft real-time requirements.
Select suitable sensors, actuators, microcontrollers, interfaces, and communication methods for a basic application.
Analyze sampling, latency, timing, power, and resource constraints.
Describe IoT architectures and the roles of device, edge, network, and cloud layers.
Explain how digital twins support monitoring, diagnosis, and optimization.
Design a basic connected mechatronic system while considering cybersecurity, safety, privacy, and lifecycle management.
1. Embedded Computing in Mechatronics
An embedded system is a computer integrated into a larger product or process to perform a dedicated function. It commonly contains a processor, memory, input/output interfaces, software, power circuitry, and communication facilities. Unlike a desktop computer, it is usually designed around a physical task, constrained resources, and a defined operating environment.
A typical mechatronic embedded system follows this chain:
physical process → sensors → signal conditioning and conversion → computation → actuator commands → physical process
Sensors convert physical variables such as temperature, position, pressure, force, acceleration, or light into electrical signals. Signal conditioning may amplify, filter, isolate, or linearize those signals. An analog-to-digital converter (ADC) represents a measured voltage as a digital number. The processor executes control and monitoring software, while output interfaces and power electronics drive actuators such as motors, solenoid valves, heaters, and pneumatic devices.
The processor does not directly “understand” a temperature or position. It receives a representation whose scale, resolution, calibration, noise, and timing must be understood by the designer. A sensor reading is meaningful only when its units, reference, sampling time, and uncertainty are known.
Microcontrollers and embedded computers
A microcontroller unit (MCU) integrates a processor core, memory, timers, digital input/output, communication peripherals, and often ADCs and pulse-width-modulation (PWM) outputs on one chip. MCUs are widely used for motor control, instrumentation, appliances, and small robots because they are inexpensive, energy-efficient, and deterministic enough for many control tasks.
A single-board computer or embedded application processor generally provides greater computing capacity, memory, and operating-system support. It is useful for machine vision, graphical interfaces, networking, and complex data processing, but it may consume more power and introduce less predictable timing. Many products combine both: an MCU runs fast control loops while a higher-level processor handles networking, user interfaces, and analytics.
Component
Main function
Typical design concern
Sensor
Measures a physical variable
Range, accuracy, noise, calibration
Signal conditioner
Filters or adapts a signal
Bandwidth, isolation, loading
ADC
Converts analog signal to digital form
Resolution, sampling rate, reference
MCU
Executes control and monitoring logic
Timing, memory, power
Actuator driver
Supplies controlled power
Current, voltage, protection
Actuator
Produces physical action
Force, speed, efficiency, failure mode
Network interface
Exchanges data
Range, bandwidth, security, reliability
Digital representation and ADC resolution
For an ideal ADC with N bits and an input range from V_min to V_max, the nominal quantization step is approximately
q = (Vmax − Vmin) / 2N
where q is in volts and N is the number of bits. This relation assumes an ideal converter and ignores offset, gain error, noise, and nonlinearity. For a 10-bit ADC spanning 0 to 5 V, q ≈ 5/1024 V = 4.88 mV. The actual measurement uncertainty may be larger than q because of sensor error and electrical noise. Increasing resolution does not automatically improve accuracy.
2. Embedded Software and Hardware Interfaces
Embedded software is commonly organized into initialization, acquisition, computation, communication, diagnostics, and fault-handling functions. A simple system may use a main loop:
Read inputs.
Check validity and safety conditions.
Calculate control actions.
Update outputs.
Communicate status.
Repeat.
A more complex system uses interrupts, timers, tasks, queues, and an operating system. An interrupt temporarily transfers execution to an interrupt service routine when an event occurs, such as a timer expiration or incoming data. Interrupt routines should be short and predictable; lengthy processing can delay other important activities.
A real-time operating system (RTOS) provides scheduling, task synchronization, timers, communication mechanisms, and often priority management. It does not guarantee that every program is real-time. Real-time performance depends on the complete system, including interrupt behavior, worst-case execution time, scheduling, memory allocation, drivers, and hardware.
Common interfaces include:
GPIO: simple binary inputs and outputs.
UART: asynchronous serial communication, often used for debugging or modules.
I²C: two-wire address-based communication for nearby integrated circuits.
SPI: fast synchronous communication, commonly used for displays, sensors, and memory.
CAN: robust multi-node bus widely used in vehicles and industrial equipment.
USB and Ethernet: higher-level connectivity with greater protocol complexity.
Interface selection should reflect distance, noise, data rate, topology, cost, and safety requirements. A short connection between a microcontroller and an inertial sensor differs fundamentally from a network connecting controllers across a factory.
Safety and fault handling
A professional embedded design assumes that components and communications can fail. Appropriate measures include range checks, plausibility checks, watchdog timers, redundant sensing, safe-state outputs, brownout detection, current limiting, and event logging. For example, a motor controller may disable power when position feedback becomes invalid, rather than continuing to operate using an unsafe stale value.
A watchdog timer resets or places a processor into a defined state if software fails to service it within a specified interval. It is useful against certain software failures, but it cannot replace testing, fault analysis, or an independent safety mechanism.
3. Real-Time Computing
A real-time system is one in which correctness depends on both the computed value and the time at which it is produced. A late command may be as harmful as an incorrect command. Real-time computing is therefore concerned with deadlines, latency, jitter, scheduling, and predictability.
Hard real-time: missing a deadline is unacceptable or potentially dangerous.
Firm real-time: a late result has no useful value, but occasional misses may not cause catastrophic failure.
Soft real-time: late results reduce quality but remain useful.
For a periodic task, the period T is the time between releases, and the deadline D is the latest acceptable completion time. The execution time C is the processor time required by one invocation. A basic feasibility condition for an isolated task is C ≤ D, but concurrent tasks require scheduling analysis. In a simple single-processor system, utilization is
U = ∑(Ci / Ti)
where C_i and T_i are the execution time and period of task i. U is dimensionless. This sum is a useful workload indicator, not a universal schedulability guarantee. Context switching, interrupts, blocking, communication, and scheduling policy must also be considered.
Worked example. A controller executes three periodic tasks:
sensing: C₁ = 1 ms, T₁ = 10 ms;
control: C₂ = 2 ms, T₂ = 10 ms;
communication: C₃ = 3 ms, T₃ = 100 ms.
Thus,
U = 1/10 + 2/10 + 3/100 = 0.33
The nominal processor utilization is 33%. This does not prove that all deadlines will be met, but it indicates available capacity for overhead and additional tasks. The designer must still measure worst-case execution time and examine priority interactions.
Sampling and latency
A sampled-data controller observes a continuous process at discrete times. If a signal contains significant frequency components up to f_max, a basic sampling requirement is
fs > 2fmax
where f_s is sampling frequency. This is the Nyquist condition for avoiding idealized aliasing of band-limited signals. Real systems require an anti-aliasing filter, and designers often sample substantially faster than the minimum to accommodate filter roll-off, control design, and noise.
Latency is the time from a physical event to the corresponding useful response. It may include sensor response, sampling delay, computation, communication, scheduling, actuator dynamics, and mechanical motion. Jitter is variation in latency or task release time. For high-performance motion control, predictable latency and jitter can be more important than average latency.
4. Internet of Things Architectures
The Internet of Things describes networks of physical objects that sense, compute, communicate, and sometimes act. An IoT system is not simply a sensor connected to the Internet. It includes device identity, data semantics, connectivity, processing, security, storage, user interaction, and lifecycle management.
A practical layered architecture is:
Device layer: sensors, actuators, MCUs, local control, and device diagnostics.
Edge or gateway layer: protocol translation, aggregation, filtering, local analytics, and local decision-making.
Network and service layer: secure transport, identity, device management, message brokers, APIs, and data storage.
Application and enterprise layer: dashboards, maintenance systems, production planning, optimization, and reporting.
Figure: A layered IoT architecture in which local control remains near the physical process while data and services may extend to the cloud.
Common IoT communication patterns include request–response, publish–subscribe, and streaming. In publish–subscribe systems, a device publishes messages to named topics and interested subscribers receive them through a broker. This decouples producers and consumers, but it requires careful topic naming, authorization, retained-message behavior, and handling of disconnected devices.
Data should be described using meaningful metadata: timestamp, unit, sensor identity, location, calibration state, quality flag, and operating context. A value such as “72” is not useful without knowing whether it represents degrees Celsius, degrees Fahrenheit, pressure, or an encoded status.
5. Edge Computing and Cloud Computing
Edge computing places processing near the source of data or the user. A gateway may reject invalid measurements, calculate a local average, detect an anomaly, or continue controlling equipment when the wide-area network is unavailable. Edge processing reduces bandwidth and can improve response time and privacy.
Cloud computing provides elastic computing, storage, managed databases, message brokers, analytics, visualization, and machine-learning services through networks. It is valuable for fleet-level comparison, long-term storage, remote access, software distribution, and computationally intensive analysis.
The choice is not binary. A robust architecture distributes functions:
Function
Suitable location
Reason
Emergency shutdown
Device or local controller
Must operate despite network loss
Fast motion loop
Device or edge
Low and predictable latency
Data compression
Edge
Reduces traffic
Fleet trend analysis
Cloud
Combines many machines
Operator dashboard
Edge and/or cloud
Depends on availability needs
Model training
Cloud or on-premises server
Requires substantial data and computation
Safety interlock
Independent local hardware where required
Avoids dependence on general-purpose software
Cloud dependence introduces risks: network outages, service changes, recurring cost, data sovereignty concerns, and vendor lock-in. An engineering design should define what happens when connectivity is lost. Local buffering, store-and-forward transmission, and degraded operating modes are common solutions.
6. Digital Twins
A digital twin is a digital representation of a physical asset or process that is connected to the asset over its lifecycle. The representation may include geometry, configuration, state, sensor history, physical models, maintenance records, and simulation capabilities. A static computer-aided design model is not necessarily a digital twin because it may have no live data connection or lifecycle relationship.
A useful digital twin has four elements:
Physical entity: the machine, product, or process.
Digital representation: models, parameters, state, and history.
Data connection: measurements and commands exchanged between the two.
Purpose: monitoring, diagnosis, prediction, optimization, training, or maintenance.
Digital twins vary in fidelity. A simple twin may display temperature and operating hours. A more advanced twin may estimate unmeasured variables, simulate energy use, compare measured and expected behavior, and recommend maintenance. Model outputs must be validated; a visually impressive dashboard does not establish physical accuracy.
A basic residual for fault detection is the difference between a measured value y and a model-predicted value ŷ:
r(t) = y(t) − ŷ(t)
The residual has the same units as y. It is informative only when model uncertainty, sensor noise, operating conditions, and time alignment are considered. A fixed threshold can produce false alarms if normal operating conditions vary. More advanced systems use statistical thresholds, adaptive models, or machine learning, but these require representative data and careful validation.
7. Applied Case: Connected Predictive Maintenance for a Conveyor Motor
This is an illustrative case, not a report of a specific company.
Background
A small manufacturing line uses a conveyor driven by an induction motor and gearbox. Unexpected bearing failure stops production. The engineering team wants earlier warning without replacing the existing local motor controller.
Problem
The system must detect abnormal vibration and temperature while preserving local safety and control. The plant network is occasionally unavailable, and maintenance personnel need both immediate alarms and long-term trend information.
Analysis
A three-axis accelerometer mounted near the bearing can provide vibration measurements, while a temperature sensor measures housing temperature. The local controller already regulates conveyor speed. High-frequency raw vibration data would consume substantial network bandwidth, and a cloud-only alarm could arrive too late. Therefore, immediate feature extraction and threshold evaluation should occur at the edge.
Relevant features may include temperature, root-mean-square vibration, peak vibration, operating speed, and runtime. A generic root-mean-square measure for n sampled values x_k is
xRMS = √[(1/n) ∑(xk²)]
where x_k is the kth sample in a selected window and n is the number of samples. If x_k represents acceleration, x_RMS has acceleration units. The feature must be interpreted with speed, load, sensor mounting, and calibration information.
Approach and solution
The proposed architecture is:
An MCU samples temperature and motor status and retains local safety logic.
An edge gateway collects vibration windows, calculates features, timestamps them, and stores data during network outages.
A secure message service transfers features and selected raw windows to a cloud database.
A cloud dashboard displays trends by asset and compares the motor with similar equipment.
A digital twin stores the motor identity, configuration, operating hours, maintenance events, sensor calibration, and expected operating envelope.
A rule-based alarm initially identifies sustained temperature elevation or vibration above a validated baseline.
The system uses two levels of action. A severe local condition causes a controlled stop according to the machine’s safety design. A lower-confidence anomaly generates a maintenance inspection request rather than an immediate shutdown. This distinction prevents an uncertain analytic result from overriding a safety-critical controller.
Outcome
The illustrative system reduces transmitted data by sending features continuously and raw vibration windows only when an anomaly is detected. It continues collecting data during network outages and synchronizes later. Maintenance staff receive trend information, but the system does not claim to predict failure until sufficient labeled evidence has been collected and independently evaluated.
Learning points
Fast and safety-critical decisions should not depend on cloud availability.
Data quality and contextual metadata are as important as algorithms.
A digital twin supports lifecycle understanding, not merely visualization.
Predictive maintenance requires validation against real failure and nonfailure cases.
Human maintenance expertise remains important when evidence is incomplete.
8. Cybersecurity, Ethics, and Governance
Connecting a physical device creates both digital and physical consequences. A compromised command may change motor speed, disable alarms, or expose production information. Security must therefore be designed into the lifecycle rather than added after deployment.
Important practices include:
unique device identities rather than shared default passwords;
encrypted communication and authenticated endpoints;
least-privilege authorization;
secure boot and signed firmware where feasible;
protected key storage and credential rotation;
network segmentation between control and office networks;
logging, monitoring, backup, and incident response;
vulnerability assessment and a documented update process;
physical protection of debug ports and gateways.
Security controls must be balanced with availability and safety. A firmware update should be authenticated, recoverable, and tested; an interrupted update must not permanently disable a critical controller. Safety engineering and cybersecurity engineering should cooperate because a cyber event can become a physical hazard.
IoT data may reveal worker behavior, production rates, building occupancy, or equipment usage. Organizations should collect only necessary data, define retention periods, control access, and explain legitimate purposes. Data ownership, cloud location, third-party processing, and regulatory obligations should be clarified contractually and technically.
Artificial intelligence can support anomaly detection, vision inspection, adaptive control, and maintenance forecasting. However, AI models may fail under distribution shift, sensor drift, unusual loads, or adversarial conditions. A model should have a defined operating envelope, monitored performance, fallback behavior, and human review where consequences are significant. An AI prediction must not be treated as a safety proof unless it has been engineered and certified for that purpose.
9. Design Method and Best Practices
A disciplined design process for a connected mechatronic system is:
Define the physical function and hazards.
Identify variables to measure and actions to control.
Establish timing, accuracy, availability, power, and environmental requirements.
Select sensors, actuators, processor, interfaces, and power stages.
Partition functions among device, edge, and cloud layers.
Define data semantics, units, timestamps, quality flags, and ownership.
Analyze failure modes, unsafe states, cybersecurity threats, and recovery behavior.
Build a small prototype and test under nominal, boundary, and fault conditions.
Measure timing, energy, network behavior, and resource use rather than relying on assumptions.
Plan calibration, diagnostics, updates, documentation, and end-of-life disposal.
A useful requirement is testable: “The local controller shall disable motor torque within 20 ms of a valid emergency-stop signal under specified operating conditions.” It is stronger than “The system shall respond quickly.” Requirements should identify conditions, measurable limits, and verification methods.
Challenges and Limitations
Embedded and connected systems face several enduring limitations:
Resource constraints: memory, processor time, energy, and storage are finite.
Physical uncertainty: sensors drift, actuators wear, and environments change.
Timing complexity: average performance can conceal deadline misses.
Connectivity dependence: wireless links have interference, loss, and variable delay.
Integration complexity: incompatible data models and protocols create hidden costs.
Security exposure: every interface can become an attack surface.
Maintenance burden: devices may remain deployed for many years.
Model limitations: a digital or AI model is an approximation, not the physical asset.
Lifecycle concerns: electronic waste, energy consumption, and cloud infrastructure have environmental impacts.
Contemporary Developments
Current engineering practice increasingly combines tiny machine-learning models at the edge, time-sensitive industrial networks, open device-management standards, containerized edge applications, remote software updates, and simulation-based commissioning. These developments can improve flexibility but also increase software complexity. The fundamental principles remain unchanged: define the physical requirement, preserve local safety, verify timing, protect identities and data, and validate performance under realistic conditions.
Chapter Summary
Embedded computing integrates processors and software into physical products. In mechatronics, sensors provide measurements, embedded software interprets them, and actuators influence the physical process. Microcontrollers are efficient for dedicated control, while higher-level computers support networking and complex computation.
Real-time systems require correct results at the correct time. Hard, firm, and soft deadlines have different consequences. Sampling frequency, execution time, utilization, latency, and jitter must be considered together; a high average speed does not guarantee deterministic behavior.
IoT architectures connect devices through edge, network, cloud, and application layers. Local controllers should retain safety-critical and time-critical functions. Edge computing reduces latency and bandwidth, while cloud computing supports storage, fleet analytics, remote access, and model training. Digital twins connect physical assets with data, models, history, and lifecycle purposes.
Successful systems engineering also requires cybersecurity, privacy, safety analysis, data governance, fault handling, maintainability, and human judgment. The best architecture is not the one that sends everything to the cloud, but the one that places each function where its timing, reliability, security, and computational requirements can be satisfied.
Key Terms
Embedded system: A computer integrated into a larger product to perform a dedicated function.
Microcontroller: An integrated device containing a processor, memory, and peripheral interfaces for control applications.
Sensor: A device that measures a physical variable and produces a usable signal.
Actuator: A device that converts a control signal into physical action.
ADC: An analog-to-digital converter that represents an analog signal numerically.
PWM: Pulse-width modulation used to control average power or represent a timed output.
Interrupt: An event that temporarily transfers processor execution to a service routine.
RTOS: A real-time operating system that provides scheduling and timing services.
Hard real-time: A timing regime in which missing a deadline is unacceptable.
Latency: Time between an event and the corresponding response.
Jitter: Variation in timing or latency.
IoT: A network of physical objects capable of sensing, computing, communicating, or acting.
Edge computing: Processing performed near the data source or physical process.
Cloud computing: Network-provided computing, storage, and services that can scale across shared infrastructure.
Publish–subscribe: A communication pattern in which publishers send messages to topics and subscribers receive selected topics.
Digital twin: A connected digital representation of a physical entity across its lifecycle.
Residual: Difference between a measured value and a model-predicted value.
Watchdog timer: A timer that detects software failure and initiates a recovery action.
Telemetry: Measurement data transmitted from a device to another system.
Firmware: Software stored in or closely associated with an embedded device.
Review Questions
Short Answer Questions
What distinguishes an embedded system from a general-purpose desktop computer?
Define hard real-time, firm real-time, and soft real-time systems.
Why should safety-critical motor control usually remain local rather than cloud-dependent?
What roles can an edge gateway perform in an IoT architecture?
Why is a static CAD model not necessarily a digital twin?
Long Answer Questions
Explain the complete sensor-to-actuator chain in a mechatronic embedded system, including signal conditioning and computation.
Discuss how sampling frequency, latency, jitter, and execution time influence the design of a motion-control application.
Compare device, edge, and cloud computing in terms of timing, bandwidth, availability, and computational capacity.
Explain the cybersecurity and privacy measures required for a connected industrial device.
Describe how a digital twin can support condition monitoring and maintenance while avoiding unjustified claims.
Analytical / Application Questions
A controller has periodic tasks with execution times and periods of 1 ms/10 ms, 2 ms/20 ms, and 4 ms/100 ms. Calculate nominal processor utilization using U = ∑(Ci/Ti). Explain why the result alone does not prove schedulability.
Design a device–edge–cloud architecture for a robotic arm that must stop locally when a limit switch is activated but must also provide long-term maintenance analytics. Justify the location of each function.
An IoT temperature sensor reports values without units, timestamps, calibration status, or quality flags. Analyze the risks and propose a minimum data record for reliable engineering use.
Multiple Choice Questions with Answers
Question 1
Which component most directly converts a physical measurement into an electrical signal?
A. Sensor
B. Actuator
C. Message broker
D. Cloud database
Correct Answer: A. Sensor
Question 2
For an ideal 10-bit ADC with a 0–5 V input range, the nominal quantization step is closest to:
A. 0.49 V
B. 48.8 mV
C. 4.88 mV
D. 0.488 mV
Correct Answer: C. 4.88 mV
Question 3
Which task is most appropriately kept in a local controller?
A. Fleet-wide monthly energy analysis
B. Emergency motor shutdown
C. Long-term cloud data archiving
D. Training a maintenance model
Correct Answer: B. Emergency motor shutdown
Question 4
What is the defining feature of a hard real-time system?
A. It always uses a cloud server
B. It has unlimited processor capacity
C. A missed deadline is unacceptable
D. It requires wireless communication
Correct Answer: C. A missed deadline is unacceptable
Question 5
What is a principal benefit of edge computing?
A. It eliminates the need for sensors
B. It can reduce response latency and network traffic
C. It guarantees perfect model accuracy
D. It removes all cybersecurity risks
Correct Answer: B. It can reduce response latency and network traffic
Question 6
In a publish–subscribe system, a subscriber generally:
A. Provides electrical power to the publisher
B. Receives messages from selected topics
C. Converts analog signals into digital values
D. Controls the ADC reference voltage
Correct Answer: B. Receives messages from selected topics
Question 7
A digital twin is best described as:
A. A static drawing with no operational data
B. A connected digital representation of a physical entity
C. A replacement for every physical safety mechanism
D. A type of serial cable
Correct Answer: B. A connected digital representation of a physical entity
Question 8
If three isolated periodic tasks have C/T ratios of 0.10, 0.20, and 0.03, their nominal utilization is:
A. 0.033
B. 0.30
C. 0.33
D. 3.30
Correct Answer: C. 0.33
Question 9
Which practice most directly supports secure device updates?
A. Using a shared default password
B. Disabling all diagnostics permanently
C. Accepting unsigned firmware from any source
D. Authenticating and verifying firmware packages
Correct Answer: D. Authenticating and verifying firmware packages
Question 10
Why must vibration features in predictive maintenance be interpreted with operating context?
A. The same vibration level can have different meanings at different speeds or loads
B. Vibration has no measurable units
C. Cloud storage changes the laws of mechanics
D. Temperature sensors cannot be calibrated
Correct Answer: A. The same vibration level can have different meanings at different speeds or loads