MGU Computer Science Series — Computer Science Foundations
Part VI: Computing in the Modern World
Automation · Sensors · Actuators · Control Systems · Robotics · Embedded Systems
Chapter 24 of 28
MGU Computer Science Series  ·  Computer Science Foundations  ·  Library Textbook Edition

Chapter 24:
Automation, Robotics,
and Embedded Systems

How computers sense, decide, and act in the physical world — from thermostats to surgical robots, from microcontrollers to autonomous vehicles

■ Part VI: Computing in the Modern World ■

■ 10 Sections  •  Chapter 24 of 28 ■

Follows Chapter 23: Human-Computer Interaction  ·  Prepares for Chapter 25: Data Science Foundations

Purpose and Overview

Most students first experience computing through a screen. A person types, clicks, or taps — and a display responds. But a vast and consequential part of computing involves no screen at all. The thermostat on a wall reads temperature and controls a furnace. The antilock braking system in a car reads wheel speed forty times per second and adjusts brake pressure to prevent skidding. A pacemaker monitors heart rhythm and delivers precise electrical pulses when the rhythm is wrong. None of these systems display a web page. All of them run software.

This chapter introduces computing systems that operate in the physical world: systems that sense physical conditions, make computational decisions, and command physical actions. These systems automate tasks, control machines, enable robots, and run embedded inside everyday objects from washing machines to satellites.

By the end of this chapter, students will understand what automation is and how it works, how sensors translate physical quantities into data, how actuators translate instructions into physical effects, how control systems close the loop between sensing and acting, how feedback loops stabilize or destabilize systems, what robotics combines to build autonomous machines, what embedded systems are and how microcontrollers power them, and how safety and reliability concerns shape the design of physical computing systems. The chapter closes by examining automation as a social force — reshaping labor, raising questions about responsibility, and transforming the physical environment.

Opening Question

A greenhouse needs to water its plants automatically. How would a computing system know when to water? How would it turn the water on and off? What would happen if the sensor gave a wrong reading, or the valve stuck open? By the end of this chapter, you will be able to design the sensing, control logic, and safety features for exactly this kind of system — and understand why each piece matters.

10Sections
10Objectives
30+Key Terms
3Worked Examples

Learning Objectives

  1. 1Explain what physical computing is and why it differs from screen-based computing.
  2. 2Define automation and distinguish open-loop from closed-loop control.
  3. 3Describe what sensors do, what quantities they measure, and what characteristics matter when choosing one.
  4. 4Describe what actuators do and identify common actuator types and their applications.
  5. 5Explain how a proportional control system uses error to generate corrective output.
  6. 6Distinguish negative feedback (stabilizing) from positive feedback (amplifying) and give examples of each.
  7. 7Describe the main components of a robot and identify different types of robots and their applications.
  8. 8Explain what an embedded system is, what a microcontroller contains, and how embedded programming differs from general-purpose programming.
  9. 9Describe fail-safe design, redundancy, watchdog timers, and interlocks as safety engineering techniques.
  10. 10Evaluate the social effects of automation, including labor displacement, economic change, and questions of responsibility.

Sections at a Glance

Sections 24.1 – 24.2
Physical Computing and Automation
Computing in the Physical World · Automation · Forms of Automated Control

Computing in the Physical World

Most of the computing students interact with daily happens on screens. A person types a message, the computer processes text, and a display shows a response. Input is a keystroke or tap. Output is pixels.

But a large part of computing — arguably the majority of computing activity in the world — has nothing to do with screens at all. The elevator listens for floor buttons, tracks position, opens and closes doors, and manages multiple competing requests. The washing machine checks water temperature, spin speed, and vibration while running through a programmed sequence of fill, wash, spin, and rinse. The traffic light cycles through states based on timers, sensors, and sometimes signals from emergency vehicles. None of these systems show a web page. All of them run software.

This is physical computing — computation embedded in things, operating on sensors, commanding motors and switches, running in real time, often without a human watching. It is one of the oldest and most widespread forms of computing in existence.

Special Challenges of Physical Computing

ChallengeDescriptionWhy It Matters
TimingResponses must occur within strict time limitsA late response in a braking system can mean a crash
Limited resourcesMany physical computers have kilobytes of memory, not gigabytesEvery byte must be used carefully
Physical failureSoftware crashes have physical consequencesA bug in a medical device can injure a patient
Unpredictable environmentTemperature, vibration, humidity, and interference affect hardwareSoftware must survive real-world conditions
Key Idea

The number of embedded processors in the world vastly exceeds the number of desktop and laptop computers. Physical computing is not a specialty — it is the dominant form of computation by volume.

Automation

Automation is the use of machines and programs to perform tasks with little or no direct human involvement at the moment of execution. The word has roots in the Greek autos, meaning self, carrying the sense of self-acting — a machine that acts on its own based on rules set in advance.

Automation is not new. Mechanical clocks automated time-keeping for centuries. Industrial looms used punched cards to control weaving patterns. What changed with digital computing was the scope, precision, and flexibility of automation. Digital computers can store complex programs, respond to varied inputs, adapt to changing conditions, and be reprogrammed without rebuilding hardware.

What Automation Requires

Every automated system requires three things. First, a defined goal or desired state — the system must know what it is trying to accomplish. Second, a way to observe conditions — the system must read the current state of the world; this is the role of sensors. Third, a way to act on conditions — the system must change the world to move toward the goal; this is the role of actuators.

If a system only observes without acting, it is monitoring. If a system only acts without observing, it is simple programmed control. True automation typically combines observation and action, closing the loop so the system can adjust its behavior based on what it measures.

Forms of Automation

FormBehaviorExample
FixedSame sequence every time, regardless of conditionsA timer-based sprinkler that runs at noon regardless of rainfall
ProgrammableDifferent programs for different tasks; hardware stays the sameA CNC milling machine given a new program to cut a different part
FlexibleAdapts in real time based on sensor inputA climate system that adjusts airflow based on occupancy sensors
IntelligentUses decision algorithms or machine learning to handle unanticipated situationsAn autonomous vehicle, an adaptive robot
Practice 24.1 – 24.2Concept Check
  1. Name three computing systems in everyday life that operate without a screen.
  2. What three things does every automated system require? Give a concrete example of each for a home heating system.
  3. Classify each as fixed, programmable, flexible, or intelligent automation: (a) a microwave set to run for 2 minutes; (b) a thermostat that adjusts based on temperature readings; (c) a robot that identifies and sorts packages by weight and shape.
Sections 24.3 – 24.4
Sensors and Actuators
Sensors · ADC · Sensor Characteristics · Actuator Types · PWM

Sensors

A sensor is a device that measures a physical quantity and converts it into a signal — usually an electrical signal — that a computing system can read. Sensors are the eyes and ears of automated systems. Without them, a computer has no information about the physical world and can only execute fixed instructions blindly.

What Sensors Measure

Physical QuantitySensor TypeExample Application
TemperatureThermistor, thermocoupleClimate control, medical devices
LightPhotodiode, phototransistorAutomatic lighting, cameras, scanners
SoundMicrophone, piezoelectric sensorVoice assistants, industrial monitoring
PressurePressure transducer, barometerWeather stations, tire pressure systems
DistanceUltrasonic sensor, LiDARParking sensors, obstacle detection
AccelerationAccelerometerSmartphones, airbag systems, robotics
RotationEncoder, gyroscopeMotor control, navigation, drones
HumidityCapacitive humidity sensorHVAC, weather stations
ChemicalGas sensor, pH sensorAir quality monitors, industrial safety

Analog Signals and the ADC

Most sensors produce an analog signal — a continuously varying voltage that represents the measured quantity. As temperature rises, a temperature sensor produces a rising voltage. Digital computers, however, process binary numbers — discrete values. They cannot directly read a continuously varying voltage.

An analog-to-digital converter (ADC) solves this problem. It samples the sensor voltage at regular intervals and converts each sample to a binary number. The precision of this conversion is measured in bits. A 10-bit ADC produces values from 0 to 1023 (2¹⁰ − 1). A 12-bit ADC produces values from 0 to 4095. Higher bit depth means finer measurement resolution.

Sensor Characteristics

CharacteristicMeaningExample
RangeMinimum and maximum measurable values−20°C to 60°C for a room thermometer
ResolutionSmallest detectable change0.1°C means it can distinguish 37.1°C from 37.2°C
AccuracyHow close the reading is to the true value±0.5°C means the reading may be off by half a degree
Response timeHow quickly output changes after the quantity changesA 10-second response time will miss a 5-second temperature spike
NoiseSmall random variations in the signalAveraging multiple readings reduces noise
# Pseudocode: Reading a temperature sensor temperature = read_sensor(TEMP_SENSOR_PIN) if temperature > 25: activate(FAN) else: deactivate(FAN)

Actuators

An actuator is a device that converts a signal from a computing system into physical motion or physical change. If sensors are inputs from the world to the computer, actuators are outputs from the computer to the world. Together, sensors and actuators make computation visible and consequential in physical reality.

Common Actuator Types

ActuatorWhat It DoesApplication
DC motorSpins at a speed proportional to applied voltageFans, wheels, conveyor belts
Stepper motorMoves in precise increments for position control3D printers, CNC machines, telescopes
Servo motorHolds a precise angle via built-in position sensingRobotics, remote-controlled vehicles
SolenoidPushes or pulls a plunger when energizedDoor locks, valves, printer mechanisms
ValveControls flow of liquid or gasIrrigation, fuel injection, process control
Heating elementConverts electricity into heatOvens, water heaters, 3D printer hot ends
Speaker / buzzerConverts electrical signals into soundAlarms, voice output, notifications

Pulse-Width Modulation (PWM)

Microcontrollers are digital devices — they output only HIGH or LOW. But many actuators need analog-style variable control: a motor running at 60% speed, a heater at 40% power. Pulse-width modulation (PWM) bridges this gap by switching the actuator on and off very rapidly — hundreds or thousands of times per second. The ratio of on-time to off-time is the duty cycle. A 10% duty cycle motor runs slowly; 90% runs near full speed. The actuator's mechanical inertia smooths the switching into continuous behavior.

# Pseudocode: PWM motor control set_pwm(MOTOR_PIN, duty_cycle=70) # 70% — fast wait(2.0) set_pwm(MOTOR_PIN, duty_cycle=30) # 30% — slow
Practice 24.3 – 24.4Sensors and Actuators
  1. Classify each as a sensor or an actuator: (a) thermistor, (b) DC motor, (c) ultrasonic distance sensor, (d) solenoid valve, (e) LED light, (f) accelerometer, (g) speaker.
  2. A soil moisture sensor outputs 0V (dry) to 3.3V (saturated). A 10-bit ADC converts this to 0–1023. The current reading is 512. What percentage of maximum moisture does this represent? If the acceptable range is 40%–70%, is watering needed?
  3. Explain in plain language why a microcontroller uses PWM to control motor speed even though it can only output HIGH or LOW signals.
  4. A temperature sensor has range −40°C to 85°C and accuracy ±0.5°C. Can it measure boiling water (100°C)? If it reads 37.2°C, what is the range of possible actual temperatures?
Sections 24.5 – 24.6
Control Systems and Feedback Loops
Open-Loop vs. Closed-Loop · Proportional Control · Negative and Positive Feedback

Control Systems

A control system is a system that uses sensors and actuators together to maintain a desired state or execute a desired behavior. Control systems are the computational heart of automation — they read sensor values, compare them to goals, and command actuators to move the physical state toward those goals.

Open-Loop vs. Closed-Loop Control

Open-loop control executes actions without checking results. A toaster set to run for 2 minutes does not check the bread's color or temperature — it applies heat for the set time and stops. Open-loop control is simple and reliable but cannot compensate for variation or disturbances.

Closed-loop control reads sensor data to check whether the action is producing the intended result and adjusts accordingly. The thermostat is a closed-loop system: it reads temperature, compares it to the setpoint, and turns heating on or off to approach the goal. Closed-loop control can handle disturbances and variation. Most meaningful automation uses closed-loop control.

Diagram 24.1 — Open-Loop vs. Closed-Loop Control
Open-Loop Control:
──────────────────────────────────────────────────────
  Input → [ Program ] → Actuator → Physical Effect
           (No feedback from the physical effect)
──────────────────────────────────────────────────────

Closed-Loop Control:
──────────────────────────────────────────────────────
  Setpoint → (+) → [ Controller ] → Actuator → Physical Effect
              ↑                                       │
              └──────── Sensor ◄─────────────────────┘
                       (Feedback)
──────────────────────────────────────────────────────

The Basic Control Loop

A closed-loop control system follows a repeating cycle: Sense → Compute → Act → Sense → Compute → Act → ... At each iteration: read sensors to get the current state; compare to the desired state; compute the appropriate action; command actuators; wait briefly; repeat. This cycle may run many times per second.

The Proportional Controller

One of the most important control strategies is the proportional controller. The error is the difference between the desired setpoint and the actual measured value. The controller adjusts the actuator output proportionally to the error: when error is large, the response is strong; when error is small, the response is gentle.

Proportional Control Formula

error = setpoint − current_value

output = Kp × error

where Kp is the proportional gain — a constant that sets how strongly the system responds to error.

Example 24.5.1
Proportional control for a heating system
  • SetupSetpoint = 20°C. Kp = 10. Current temperature = 14°C.
  • Compute error = 20 − 14 = 6°C output = 10 × 6 = 60 units (full heating)
  • LaterAs room warms to 19°C:
  • Compute error = 20 − 19 = 1°C output = 10 × 1 = 10 units (gentle heating)
  • EffectThe heater reduces its effort as the room approaches the goal, preventing overshoot.
Result: The proportional controller naturally reduces output as error shrinks, converging smoothly on the setpoint.
Beyond Proportional: PID Control

Real-world control systems often extend proportional control to PID control (Proportional, Integral, Derivative), which also accounts for accumulated past error (integral term) and the rate of change of error (derivative term). PID controllers are standard in industrial automation, motor control, and robotics. The mathematics belongs in advanced control engineering; the concept — that a controller can learn from history and anticipate change — is the key idea.

Feedback Loops

The closed-loop control system is an instance of a feedback loop — one of the most fundamental structures in engineering, biology, economics, and everyday life. A feedback loop exists whenever the output of a system is fed back as input to influence future behavior.

Negative Feedback

Negative feedback (also called corrective feedback) reduces the difference between the current state and the desired state. When the system drifts away from the goal, the feedback signal produces a corrective response that pushes it back. Negative feedback is stabilizing — it is the foundation of most control systems.

SystemSensor InputActuator OutputFeedback Goal
ThermostatTemperatureHeater / coolerMaintain setpoint temperature
Cruise controlVehicle speedEngine throttleMaintain setpoint speed
AutopilotAltitude, headingControl surfacesMaintain flight path
Toilet tankWater levelFill valveMaintain water level
RefrigeratorInterior temperatureCompressorMaintain cool temperature
Blood glucoseGlucose levelInsulin / glucagonMaintain glucose range

Positive Feedback

Positive feedback amplifies a deviation. Instead of correcting, it reinforces. When output increases, the feedback signal causes further increase; when output decreases, the feedback causes further decrease. Positive feedback can be useful when rapid change is desired — electronic oscillators and some biological processes use it. But in control systems, unwanted positive feedback causes instability: the system spirals away from the desired state. A microphone held too close to its speaker produces the classic screech of audio feedback — positive feedback in an acoustic system.

Instability Warning

A proportional controller set with too high a gain (Kp) can cause oscillation: the controller overcorrects, the value jumps above the setpoint, the error reverses, the controller corrects in the other direction, and the system bounces back and forth without ever settling. This oscillation is the key failure mode of poorly tuned proportional control.

Practice 24.5 – 24.6Control and Feedback
  1. A cruise control system has setpoint 65 mph. Current speed is 62 mph. Kp = 2. Calculate output. If the car then accelerates to 65.5 mph on a downhill, what does the controller do?
  2. A watering system runs for 20 seconds every morning at 7 AM regardless of soil conditions. Is this open-loop or closed-loop? What one change would make it closed-loop?
  3. For each: state whether the feedback is negative (stabilizing) or positive (amplifying). (a) A screech from a microphone near its speaker. (b) A thermostat turning off heat when the room reaches the setpoint. (c) A bank run: people hear a bank may fail, withdraw money, which makes the bank more likely to fail, causing more withdrawals.
  4. Draw a flowchart of a thermostat control loop. Show what the system does when temperature is 18°C, 20°C, and 23°C (setpoint is 20°C).
Section 24.7
Robotics
Robot Components · Degrees of Freedom · Robot Types · Path Planning

Robotics

Robotics is the field that designs, builds, and programs machines — robots — that can sense their environment, make decisions, and perform physical actions. A robot is typically defined as a machine that can sense, process information, and act. This distinguishes robots from simple automated machines, which follow fixed sequences without sensing.

The Robot System

ComponentRoleExamples
Mechanical structureThe physical body: arms, joints, wheels, legsArm links, chassis, end effectors
SensorsThe robot's ability to observe its environment and own stateCameras, lidar, encoders, force sensors, IMUs
ActuatorsMove the robot's bodyServo motors, hydraulics, pneumatics
ControllerThe computing system that receives data and generates commandsMicrocontroller, embedded computer, ROS
SoftwarePrograms that interpret sensor data and generate actuator commandsControl loops, path planners, vision algorithms
Power supplyProvides energyBatteries, cables, fuel cells

Degrees of Freedom

A robot's degrees of freedom (DOF) is the number of independent ways it can move. A simple arm with one rotating joint has 1 DOF. A human arm has approximately 7 DOF — shoulder (3), elbow (1), wrist (3). Higher DOF enables more dexterous manipulation but requires more complex sensing and control. Most industrial robot arms have 6 DOF, which is sufficient to reach any position and orientation in space.

Types of Robots

Industrial robots are fixed robotic arms in factories that weld, paint, assemble, pack, and move materials. They operate in carefully structured environments where every object's position is known in advance. They are fast, precise, and tireless, but poorly adapted to unpredictable environments.

Mobile robots move through space using wheels, legs, or tracks. Warehouse robots navigate grid floors to retrieve items. Research robots traverse rough terrain. Mobile robots must solve navigation: Where am I? Where am I going? How do I avoid obstacles?

Collaborative robots (cobots) work alongside humans. They include force-sensing systems that detect accidental contact with a person and immediately stop, preventing injury. Cobots are used in medical settings, light manufacturing, and laboratory automation.

Aerial robots (drones) use differential motor speeds across multiple rotors for balance and steering. Flight control requires gyroscopes, accelerometers, altimeters, GPS, and fast control loops running many times per second.

Surgical robots assist surgeons with enhanced precision, filtered tremor removal, and minimally invasive tool articulation. The surgeon controls the robot through a remote console; the robot translates commands into fine, precise movements at the surgical site.

Path Planning

A mobile robot navigating from point A to point B must solve a path planning problem: find a route that reaches the destination while avoiding obstacles. Simple approaches include grid-based search (represent the environment as a grid; use a search algorithm such as A* to find the shortest path through open cells) and potential fields (treat the goal as attracting the robot and obstacles as repelling it, then follow the computed force field). Path planning becomes far more complex in three dimensions, with moving obstacles, or with robots of complex geometry.

Practice 24.7Robotics
  1. A robot arm has 6 degrees of freedom. Explain in plain language what this means physically. How does more DOF make the robot more capable, and what makes it more complex?
  2. For each robot type, identify one application and one technical challenge: (a) industrial robot arm, (b) mobile warehouse robot, (c) surgical robot, (d) autonomous drone.
  3. Why can't a fixed industrial robot arm be used effectively in an unstructured environment like a home kitchen? What would need to change?
Sections 24.8 – 24.9
Embedded Systems, Microcontrollers, and Safety
Embedded Characteristics · Microcontrollers · IoT · Fail-Safe Design · Safety Standards

Embedded Systems and Microcontrollers

An embedded system is a computing system designed for one specific task or a narrow set of tasks, usually built into a larger device, and typically optimized for size, cost, and energy efficiency. Embedded systems run inside cars, appliances, medical devices, toys, industrial machines, consumer electronics, and office equipment. The number of embedded processors in the world vastly exceeds the number of desktops and laptops.

Characteristics of Embedded Systems

CharacteristicDescription
Single purposeA washing machine controller does not run a spreadsheet. Specialization enables radical optimization.
Real-time operationMust respond within predictable time limits. Hard real-time (airbag) means missed deadline = failure. Soft real-time (video) tolerates occasional delays.
Constrained resourcesMay have 4KB–256KB of flash and 256 bytes–8KB of RAM. Every byte matters.
Low powerA wireless sensor may run for two years on two AA batteries using careful sleep/wake cycles.
Physical durabilityMust survive temperature extremes, vibration, humidity, and electromagnetic interference.

The Microcontroller

The heart of most embedded systems is the microcontroller (MCU) — a single integrated circuit containing a processor, program memory, data memory, and peripheral controllers (ADCs, PWM generators, serial interfaces, timers) all on one chip. This differs fundamentally from a general-purpose computer, which uses separate chips for each function. The integration makes microcontrollers small, cheap, and energy-efficient.

Diagram 24.2 — Microcontroller Internal Structure
┌─────────────────────────────────────────────────────┐
│                  MICROCONTROLLER                    │
│                                                     │
│  ┌──────────┐  ┌─────────┐  ┌──────────────────┐   │
│  │ CPU Core │  │  Flash  │  │      SRAM        │   │
│  │(Execute) │  │(Program)│  │    (Runtime)     │   │
│  └──────────┘  └─────────┘  └──────────────────┘   │
│                                                     │
│  ┌─────────┐  ┌──────┐  ┌───────┐  ┌──────────┐    │
│  │  GPIO   │  │ ADC  │  │  PWM  │  │  Timers  │    │
│  │  Pins   │  │      │  │       │  │          │    │
│  └────┬────┘  └──┬───┘  └──┬────┘  └────┬─────┘    │
└───────┼──────────┼──────────┼─────────────┼──────────┘
        │          │          │             │
     Digital   Analog      PWM          Timer
     I/O       Sensors    Motors        Events

Programming Microcontrollers

Microcontrollers are traditionally programmed in C or C++, which produce efficient compiled code that runs directly on the hardware. Programming a microcontroller differs markedly from programming a general-purpose computer: there is often no operating system abstraction; memory is explicitly managed with no garbage collection; timing is the programmer's responsibility; and debugging may involve an LED blinking patterns rather than a display.

Arduino is a popular educational platform that simplifies embedded programming through a high-level library. The structure is a setup() function that runs once, followed by a loop() function that runs repeatedly — an infinite loop that is the heartbeat of the embedded system.

// Arduino-style C++: blink an LED void setup() { pinMode(13, OUTPUT); // Set pin 13 as output } void loop() { digitalWrite(13, HIGH); // LED on delay(1000); // Wait 1 second digitalWrite(13, LOW); // LED off delay(1000); // Wait 1 second }

The Internet of Things

The Internet of Things (IoT) refers to physical devices — sensors, controllers, appliances — connected to the internet, enabling remote monitoring, control, and data collection. A smart thermostat is an IoT device: it has temperature sensors, a control program, wireless connectivity, and cloud integration that lets the homeowner adjust settings from a phone app.

IoT creates significant benefits — energy efficiency, remote infrastructure monitoring, smart medical devices — and significant risks. A connected camera with a weak password is an internet-accessible surveillance device. A connected medical device with a software vulnerability could theoretically be attacked. Security and privacy concerns around IoT are active and serious topics in cybersecurity research.

Safety and Reliability

When computing controls physical systems, software failures can cause physical harm. Engineers systematically analyze what can go wrong and design systems to minimize consequences when something does.

Failure Modes

Failure TypeDescriptionConsequence Example
Sensor failureReading incorrectly, failing silent, or producing erratic dataA temperature sensor reading 1000°C shuts off heating permanently
Actuator failureStuck open, stuck closed, or stuck in placeA valve stuck open floods a system
Software failureBugs, unhandled exceptions, integer overflow, infinite loopsAn overflow turns a small positive command into a huge one, driving actuator to extreme position
Power failureLoss of power to the control systemActuators stay in their current state, which may be hazardous
Communication failureLoss of signal between distributed componentsA subsystem continues on stale data or stops responding

Safety Engineering Techniques

Fail-safe design means that when a failure occurs, the system goes to a state that minimizes harm. A crosswalk signal that loses power should show red, not green. A pressure relief valve that fails should fail open, releasing pressure rather than trapping it. A robotic arm that loses sensor data should stop moving, not continue blindly.

Redundancy means having backup systems that take over when primary systems fail. Aircraft flight control computers are typically triplicated — three separate computers compute the same answer from the same sensor data. If one disagrees, it is assumed faulty and ignored. This majority-voting design protects against single-component failures.

Watchdog timers are hardware timers that reset a system if the software does not periodically send an "I am still running correctly" signal. If the software crashes or hangs, the watchdog fires and restarts the system, preventing it from being stuck in a failed state indefinitely.

Interlocks are hardware or software conditions that prevent dangerous operations unless safety conditions are met. A machine guard interlock requires the safety door closed before motors can run. An elevator interlock prevents doors from opening unless the elevator is level with the floor.

Safety Engineering Summary

Fail-safe design — failure goes to a harmless state

Redundancy — backup systems take over from failed primaries

Watchdog timer — hardware restart if software becomes unresponsive

Interlock — dangerous action blocked unless safety conditions are met

FMEA — systematic enumeration of every failure mode and its effect

Practice 24.8 – 24.9Embedded Systems and Safety
  1. A microcontroller has 32KB of flash and 2KB of RAM. Explain in practical terms what constraints these limits impose. What kinds of data structures or program structures might be difficult or impossible?
  2. Compare an Arduino microcontroller to a Raspberry Pi. What types of tasks would each be better suited for? Give one example application for each.
  3. An IoT-connected baby monitor streams video to a parent's phone and stores recordings in the cloud. Identify (a) two sensors it needs, (b) two actuators it needs, and (c) two privacy or security concerns it raises.
  4. A hospital uses an automated gate to control access to a secure area. The gate motor fails. Should the gate fail open (allowing all entry) or fail closed (blocking all entry)? Argue both sides. Then state which choice is correct for a hospital fire emergency scenario and why.
  5. What is a watchdog timer, and what failure mode does it protect against? Give a scenario where a watchdog timer would prevent a stuck embedded system from causing a problem.

Two Worked Examples

Worked Example 24.1
Designing a Simple Automatic Plant Watering System
  • GoalWater plants when soil moisture falls below 40%; stop when moisture rises above 70%.
  • SensorsCapacitive soil moisture sensor (outputs analog voltage 0–3.3V; ADC converts to 0–1023). Flow sensor on the water line to verify flow when valve is open.
  • ActuatorsSolenoid valve (normally-closed — springs shut if power is lost, safe fail-state). Small pump if pressure is insufficient.
  • Control Logic LOOP every 10 minutes: moisture = read_sensor(MOISTURE_SENSOR) if moisture < 40: open(WATER_VALVE) flow = read_sensor(FLOW_SENSOR) if flow == 0: trigger_alert("Valve open but no flow") wait(30 seconds) close(WATER_VALVE) else if moisture > 70: close(WATER_VALVE) # ensure closed
  • Failure Modes
    FailureSafety Design
    Sensor reads 0% alwaysLimit daily watering time; alert if valve open > 5 min
    Sensor reads 100% alwaysAlert if moisture at maximum for 3+ consecutive days
    Valve fails openFlow sensor detects unexpected flow when valve should be closed
    Power failureNormally-closed solenoid springs shut automatically
    Software crashWatchdog timer restarts system within 24 hours
Key Insight: Every component failure is anticipated. The system defaults to safe behavior (no water) on power loss, and alerts flag sensor anomalies before plants are damaged.
Worked Example 24.2
Tracing a Proportional Feedback Control Loop
  • SetupCruise control setpoint = 65 mph. Current speed = 62 mph. Kp = 2. Each iteration, actual speed change = output × 0.5 mph.
  • Iteration 1 error = 65 − 62 = 3 output = 2 × 3 = 6 speed change = 6 × 0.5 = 3 mph new speed = 62 + 3 = 65 mph
  • Iteration 2 error = 65 − 65 = 0 output = 2 × 0 = 0 speed change = 0 speed stays at 65 mph
  • ReflectionIn this ideal model the system converges in one step. In reality, mechanical inertia and engine response time mean multiple iterations are needed. A too-high Kp causes the controller to overcorrect: speed jumps above setpoint, negative error causes backing off, speed falls below, and the pattern repeats — oscillation around the setpoint.
Key Insight: Proportional control converges naturally when gain is properly tuned. Excessively high gain causes oscillation rather than stable convergence.
Section 24.10 + Back Matter
Automation in Society, Summary, Key Terms, and Review
Social Effects · Labor · Responsibility · Chapter Summary · Key Terms · Practice · Preview

Automation in Society

Automation is one of the most significant forces shaping modern economies and daily life. It is worth stepping back from technical details to consider its broader consequences.

What Automation Has Made Possible

Automation enables production at scales impossible with hand labor. Pharmaceutical manufacturing requiring exact proportions, semiconductor fabrication at nanometer scales, and GPS positioning accurate to centimeters are all possible only through automation. Automation also enables work in environments dangerous to humans — robots now handle explosives, enter collapsed buildings, work in extreme heat, dive to crushing ocean depths, and operate in radioactive environments.

What Automation Displaces

Every wave of automation has displaced human labor from some tasks while creating demand for labor in new tasks. Industrial automation displaced factory assembly workers. Agricultural automation displaced much farm labor. Office automation displaced clerical workers. The pattern is consistent: automation is most effective against tasks that are repetitive, predictable, and well-defined. The tasks automation displaces tend to be economically significant to the people performing them, and transitions cause genuine hardship even when the aggregate economy benefits.

Automation anxiety — fear that machines will permanently eliminate the need for human work — has recurred throughout industrial history. Historically, automation has transformed work rather than eliminated the need for it. Whether this pattern will continue with advanced AI and robotics is an active and genuinely uncertain question.

Automation and Responsibility

When an automated system causes harm, determining responsibility is complex. Was the fault in the sensor? The algorithm? The engineer who designed the system? The company that deployed it? The regulator who approved it? The operator who maintained it? These questions become especially acute with autonomous vehicles, automated medical devices, and AI-assisted decision systems. Automated systems are not neutral — they encode assumptions, design choices, and value judgments made by people. Responsibility for their effects — intended and unintended — belongs to the humans who create, deploy, and govern them.

Chapter 24 Summary

Key Terms

actuator
A device that converts a computing signal into physical motion or physical change.
ADC
Analog-to-digital converter. A circuit that converts a continuously varying voltage into a binary number a digital system can process.
automation
The use of machines and programs to perform tasks with minimal direct human involvement during execution.
closed-loop control
A control system that reads sensor data to check whether its actions produce the intended result, and adjusts accordingly.
control system
A system that uses sensors and actuators together to maintain a desired state or execute a desired behavior.
degrees of freedom
The number of independent ways a robot or mechanical system can move.
duty cycle
In PWM, the fraction of each time period during which the signal is HIGH; determines the effective average output level.
embedded system
A computing system built into a device and designed for one specific task or a narrow set of tasks.
error
In control systems, the difference between the desired setpoint and the current measured value: error = setpoint − current.
fail-safe design
A design philosophy in which system failures cause the system to enter a state that minimizes harm.
feedback loop
A structure in which the output of a system is fed back as input to influence future behavior.
interlock
A hardware or software condition that prevents a dangerous operation from occurring unless specified safety conditions are met.
IoT
Internet of Things. Physical devices connected to the internet, enabling remote monitoring, control, and data collection.
microcontroller
A single integrated circuit containing a processor, program memory, data memory, and peripherals — the core of most embedded systems.
negative feedback
Feedback that corrects deviation from a desired state. Stabilizing.
open-loop control
A control system that executes actions without checking the results.
path planning
The problem of finding a route from a starting position to a goal while avoiding obstacles.
physical computing
Computation embedded in physical devices that sense and act in the real world.
PID controller
A control strategy using proportional, integral, and derivative terms to reduce error more precisely than proportional-only control.
positive feedback
Feedback that amplifies deviation from a state; potentially destabilizing.
proportional control
A control strategy where the corrective output equals a constant (Kp) times the error.
PWM
Pulse-width modulation. A technique for simulating variable output from digital signals by rapidly switching at varying duty cycles.
real-time operation
Operation in which responses must occur within predictable time deadlines. Hard real-time: missed deadline = failure.
redundancy
The use of backup systems that take over when primary systems fail.
robot
A machine that can sense its environment, process information, and perform physical actions.
sensor
A device that measures a physical quantity and converts it into a signal a computing system can read.
setpoint
The desired target value that a control system attempts to maintain.
watchdog timer
A hardware timer that resets a system if the software does not periodically signal correct operation.

Diagram Review

Diagram 24.3 — The Sense-Compute-Act Loop
┌──────────────────────────────────────────────────────┐
│                  Physical World                      │
│                                                      │
│   [Temperature / Position / Pressure / Speed / ...]  │
│          ↓                          ↑                │
│      SENSOR                     ACTUATOR             │
│    (Read world)               (Change world)         │
│          ↓                          ↑                │
│   ┌──────────────────────────────────────┐           │
│   │         CONTROLLER                   │           │
│   │   1. Read sensor value               │           │
│   │   2. Compare to setpoint             │           │
│   │   3. Compute error                   │           │
│   │   4. Compute output = Kp × error     │           │
│   │   5. Command actuator                │           │
│   │   6. Wait                            │           │
│   │   7. Repeat                          │           │
│   └──────────────────────────────────────┘           │
└──────────────────────────────────────────────────────┘

Concept Check

  1. What is the difference between a sensor and an actuator?
  2. What is the difference between open-loop and closed-loop control? Give one example of each.
  3. What does a microcontroller contain that makes it different from a separate CPU chip connected to separate memory chips?
  4. What is negative feedback? What is its role in control systems?
  5. What is pulse-width modulation, and why is it used to control motor speed?
  6. What does "fail-safe design" mean? Give one example from a physical system.
  7. What is a watchdog timer, and what failure mode does it protect against?
  8. Name three types of robots and one application and one distinct technical challenge for each.

Practice Questions

Section AVocabulary and Classification
  1. Classify each as sensor, actuator, or neither: (a) thermistor, (b) DC motor, (c) microprocessor, (d) pressure transducer, (e) solenoid valve, (f) LED light, (g) ADC, (h) rotary encoder.
  2. A control system for an aquarium heater has setpoint 26°C and Kp = 5. Current temperature is 23°C. Calculate controller output. Then recalculate when temperature rises to 25.5°C. How does the output change, and why is this useful?
  3. Explain in your own words why a proportional controller reduces its output as the system approaches the setpoint.
Section BControl Systems and Feedback
  1. For each system, identify: (a) sensor input, (b) actuator output, (c) feedback goal, (d) negative or positive feedback.

    — A refrigerator compressor cycling on/off to maintain temperature
    — A microphone near its speaker producing a screech
    — A car's cruise control maintaining highway speed
  2. Why might a very high proportional gain cause a system to bounce back and forth rather than settle? Describe what you would observe, without using the word "oscillation."
  3. A robot uses a proportional controller (Kp = 0.5) to drive to a target 100 cm away. Each iteration moves the robot by (output × 0.5) cm. Trace five iterations. After 20 iterations the robot is still 3.7 cm from the target. What does this reveal about purely proportional control?
Section CSafety and Design
  1. An automated robotic arm unexpectedly strikes a worker while still in motion. Identify at least three design failures that may have contributed: one sensor failure, one actuator failure, and one software/control failure.
  2. Design a smart street lighting system. Lights should: turn on at dusk and off at dawn; dim to 30% when no motion is detected within 50 meters; brighten to 100% when a pedestrian approaches. (a) List sensors needed. (b) List actuators. (c) Write pseudocode for the control logic. (d) Identify one fail-safe behavior. (e) Identify one privacy concern and how you would address it.

Debugging and Error Analysis

Error Problem 1
temperature = read_sensor(TEMP_SENSOR) error = temperature - setpoint # subtraction order output = Kp * error set_heater(output)

Setpoint is 22°C. Temperature is 18°C. Calculate what error evaluates to with this code. What does output equal with Kp = 3? What does the heater do with a negative output? Identify the bug and write the corrected line.

Error Problem 2
A student designs an open-loop irrigation system: water for 5 minutes every day at noon. Summer: plants drown. Winter: plants die. Student's fix: water for 10 minutes instead of 5.

Explain why changing the watering duration does not solve the fundamental problem. What architectural change to the system is needed?

Error Problem 3
A connected pacemaker has no password protection. The manufacturer says: "No one would know our device API. Security through obscurity is sufficient."

Identify the security reasoning error. What principle does this violate? What two security measures should be implemented instead?

Real-World Applications

  1. Self-driving vehicles must solve three core problems: sensing the environment, deciding what to do, and controlling the vehicle. For each problem, identify the types of sensors, algorithms, or actuators involved. What is one reason fully autonomous vehicles in all conditions remain technically difficult?
  2. Surgical robotics allows surgeons to perform minimally invasive procedures with robotic assistance. From the perspective of control systems, explain why robotic assistance is useful in surgery. What role does haptic feedback — force and touch sensation transmitted back to the surgeon — play in the control loop?
  3. Mars rovers face an extreme reliability challenge: a radio signal takes up to 24 minutes to travel from Earth, making real-time remote control impossible. (a) What does this require the rover's software to be able to do independently? (b) What is one fail-safe behavior especially important for a rover with no human nearby? (c) Why is pre-launch testing even more critical than for ordinary software?
  4. Warehouse robots: Large online retailers use hundreds of robots navigating warehouse floors to retrieve items. Identify (a) sensors these robots likely use, (b) actuators they need, (c) what happens if one robot's sensor fails and it cannot detect others, and (d) how a central control system might prevent collisions.

Mixed Review

  1. (Chapter 3 + 24) Decompose the problem of designing a fire suppression system for a server room into subproblems. For each subproblem, identify whether it is a sensor problem, an actuator problem, a control logic problem, or a safety design problem.
  2. (Chapter 8 + 24) Translate the following control loop description into pseudocode using a while loop: "While the current water temperature is below the setpoint of 38°C, activate the heater. Check the temperature every 5 seconds. Once the temperature reaches or exceeds 38°C, deactivate the heater and exit the loop."
  3. (Chapter 21 + 24) An IoT-connected insulin pump monitors blood glucose and automatically delivers insulin. Identify two cybersecurity threats this device faces that a non-connected pump does not. For each threat, describe one defensive measure.
  4. (Chapter 13 + 24) A traffic simulation models each car as following one rule: maintain a 2-second gap from the car ahead; accelerate if the gap is larger, brake if smaller. What aspects of real driving does this abstraction capture well? What does it leave out? How might missing elements affect simulation accuracy?

Chapter 24 Checkpoint

Chapter 24 Checkpoint
Complete without assistance — assesses all key concepts, calculations, and design skills from Chapter 24
Section 1 — Vocabulary and Concepts
  1. Define sensor, actuator, and feedback loop. Give a real-world example of each.
  2. What distinguishes open-loop from closed-loop control? Which is used in a thermostat and why?
  3. What three things does every automated system require?
  4. What is an embedded system, and what makes a microcontroller different from a general-purpose computer?
Section 2 — Calculation and Tracing
  1. A temperature controller has setpoint 20°C, current temperature 16°C, and Kp = 4. Calculate the controller output. If temperature then reaches 19°C, calculate the new output. Explain why the output decreases.
  2. A 10-bit ADC is connected to a pressure sensor with range 0–200 kPa. A reading of 700 is returned. What pressure in kPa does this represent? (Hint: 700/1023 × 200.)
  3. A motor is controlled at 80% duty cycle, then reduced to 25%. Describe the change in motor behavior and explain why PWM works for speed control.
Section 3 — Design
  1. Design a closed-loop system to maintain a fish tank at exactly 26°C. List the sensor, actuator, setpoint, error formula, and one fail-safe behavior.
  2. A factory robot door must not open while the robot arm is moving. What safety mechanism prevents this? What should the door do if the robot's position sensor fails?
Section 4 — Analysis and Society
  1. A student claims: "Positive feedback is always bad in a control system." Do you agree? Explain with one example where positive feedback is intentionally useful and one where it is harmful.
  2. Identify two types of work that are most vulnerable to automation and explain why. Identify one type of work that is relatively resistant and explain why.
  3. An autonomous delivery drone drops a package on a car. Identify three parties who might share responsibility for the damage, and explain what each party's responsibility might be.
Looking Ahead
Chapter 25: Data Science Foundations

Chapter 24 showed how computing acts in the physical world — sensing, controlling, and automating. Many of the systems described in this chapter generate enormous quantities of data as they run. Sensor networks, embedded systems in cities and vehicles and factories, and IoT devices continuously produce streams of measurements. Chapter 25 introduces data science: the use of data, computation, statistics, and domain knowledge to ask and answer questions. Students will learn about datasets, features, data collection, cleaning, visualization, descriptive statistics, correlation and causation, prediction, and the bias and responsibility that come with data-driven decisions. The sensing work of Chapter 24 connects directly to the data work of Chapter 25.

MGU Library Connection
  • Appendix G: Computer Systems Reference — hardware components and embedded processors
  • Chapter 15: Hardware and Computer Architecture — CPU, memory, and processing foundations
  • Chapter 21: Cybersecurity Foundations — security for connected embedded and IoT systems
  • Chapter 26: Artificial Intelligence and Machine Learning Foundations — intelligent automation and autonomous systems
  • MGU Robotics Engineering Series — for deeper study of robot kinematics, path planning, and control systems
  • MGU Glossary entries: sensor, actuator, embedded system, control system, feedback loop, microcontroller, PWM, IoT