56  Feedback Mechanisms

In 60 Seconds

A feedback loop continuously measures output, compares it to a setpoint, and adjusts input to minimize the difference – creating a self-correcting system. Negative feedback (used in 99% of IoT control) stabilizes systems; positive feedback amplifies changes and is used only for threshold detection like smoke alarms.

56.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Explain how feedback loops create self-correcting systems from simple IoT devices
  • Distinguish between negative feedback (stabilization) and positive feedback (amplification) with real-world examples
  • Identify the key components of a closed-loop system: sensor, comparator, controller, and actuator
  • Compare open-loop and closed-loop architectures for IoT sensing and control applications
  • Design distributed feedback systems that operate across device, edge, and cloud tiers

This chapter covers foundational concepts for designing IoT systems at scale. Think of IoT system design like city planning – you need to consider where devices go, how they communicate, where data is stored, and how everything stays secure. Reference architectures and design principles help you create systems that work reliably and can grow over time.

56.2 Feedback in Electronic Systems

⏱️ ~12 min | ⭐⭐ Intermediate | 📋 P04.C22.U02

Difficulty: Foundational

MVU: Feedback Loops

Core Concept: A feedback loop continuously measures output, compares it to a desired setpoint, and adjusts the input to minimize the difference - creating a self-correcting system that maintains stability without constant human intervention. Why It Matters: Feedback transforms “dumb” devices into smart systems - a simple heater becomes a thermostat, a motor becomes a servo, and an irrigation pump becomes a precision agriculture system. Key Takeaway: The key components are: sensor (measures output), comparator (calculates error), controller (decides action), and actuator (makes changes) - break any link and the system loses its self-regulating ability.

Feedback is a fundamental concept where a portion of the system’s output is routed back to influence the input. This creates a self-regulating mechanism that can improve system performance, stability, and accuracy.

56.2.1 Everyday Feedback Examples

We encounter feedback constantly in daily life:

  • Thermostat: Room temperature (output) is measured and compared to the desired temperature (input), adjusting heating/cooling accordingly
  • Cruise control: Vehicle speed (output) is monitored and throttle (input) is adjusted to maintain set speed
  • Refrigerator: Internal temperature (output) controls compressor on/off cycles (input)

In IoT systems, feedback enables autonomous operation and adaptation to changing conditions.

The “useless box” demonstrates basic feedback in action:

Useless box negative feedback loop: user flips switch, sensor detects change, microcontroller activates servo to reverse switch position
Figure 56.1: Useless box negative feedback: switch triggers self-reversal

Useless Box Feedback Loop: User input triggers sensor detection, microcontroller processing activates servo motor, which mechanically reverses the switch position, creating negative feedback that opposes the user’s action.

This simple system demonstrates negative feedback where the output (switch position) directly counteracts the input (user action), restoring the system to its original state.

56.2.2 Feedback in IoT Applications

IoT devices leverage feedback for various purposes:

Environmental Control
Smart thermostats, greenhouse automation, HVAC systems
Process Monitoring
Industrial sensors adjusting manufacturing parameters in real-time
Safety Systems
Automatic shutoffs when dangerous conditions detected
Energy Management
Battery monitoring systems adjusting charging rates
Distributed Feedback
Water quality monitoring where local sensors trigger remote actuators
Distributed IoT feedback system for water quality monitoring with sensor nodes transmitting data to cloud platform controlling remote actuators
Figure 56.2: Water quality monitoring with cloud-based control loop

Distributed IoT Feedback System: Sensor nodes transmit water quality data to cloud platform, where rule engine evaluates conditions and sends commands to remote actuator nodes, creating a closed feedback loop across network boundaries.

This distributed feedback system demonstrates how IoT architectures can implement control loops across multiple devices and network boundaries, with cloud-based decision-making coordinating local sensor and actuator nodes.

56.3 Electronic Feedback Systems

⭐⭐ Difficulty: Intermediate

Feedback systems are classified based on whether they monitor and respond to their outputs. The two primary categories are closed-loop and open-loop systems, each with distinct characteristics and applications.

56.3.1 Closed-Loop Feedback Systems

Block diagram of closed-loop feedback system with setpoint input, comparator calculating error signal, controller processing error, plant producing output, and feedback sensor creating regulation loop by measuring output and feeding it back to comparator
Figure 56.3: Closed-loop feedback system diagram showing the continuous cycle of sensing, comparing to setpoint, and adjusting output to maintain desired state

In a closed-loop system, a portion of the output is fed back to the input and either added to (positive feedback) or subtracted from (negative feedback) the input signal. This creates a self-regulating system that continuously updates based on current output conditions.

Closed-loop feedback system block diagram with setpoint input, comparator generating error signal, controller, plant, and feedback sensor path
Figure 56.4: Closed-loop feedback with setpoint, error, and controller

Closed-Loop Feedback System Block Diagram: Set point is compared with measured output, generating error signal. Controller processes error and adjusts system input. Feedback sensor creates continuous regulation loop.

Key Components:

  1. Set Point (SP): The desired target value
  2. Error Signal: Difference between set point and measured output
  3. Controller: Processes error and determines corrective action
  4. Process/Plant: The system being controlled
  5. Feedback Sensor: Measures actual output
  6. Comparator (Σ): Computes error = SP - measured value

For a smart refrigerator maintaining 4°C with current temperature at 7°C:

  • Error signal: \(e = SP - measured = 4 - 7 = -3°C\) (negative means too warm)
  • Controller activates compressor at full power
  • After 10 minutes, temp drops to 5°C: \(e = 4 - 5 = -1°C\) (still negative, reduced cooling)
  • At 3.5°C: \(e = 4 - 3.5 = +0.5°C\) (positive means too cold, compressor off)
  • System oscillates 3.5-4.5°C with 1°C hysteresis band

If setpoint changes to 2°C (freezer mode) while temp=4°C: new error \(= 2 - 4 = -2°C\), triggering immediate cooling until error approaches zero.

Smart home heating system closed-loop example showing user setting target temperature 22°C, temperature sensor measuring actual room temperature 21°C, controller calculating +1°C error and activating heating system, warm air raising room temperature, and continuous feedback loop monitoring temperature to maintain setpoint
Figure 56.5: Smart home heating system as a closed-loop feedback example, showing thermostat sensor, controller, heater actuator, and room temperature feedback
Smart thermostat closed-loop control: comparing target 22 degrees C with measured 21 degrees C, calculating error, and activating heater
Figure 56.6: Smart thermostat: compare target 22C with actual 21C

Smart Home Heating Control Loop: Thermostat compares target (22°C) with measured temperature (21°C), calculates error (+1°C), activates heater, and continuously monitors room temperature to maintain setpoint.

Operation:

  1. User sets desired temperature: 22°C
  2. Temperature sensor measures actual temperature: 21°C
  3. Error = 22°C - 21°C = +1°C
  4. Controller activates heating system
  5. Room temperature rises toward 22°C
  6. As error decreases, heating output adjusts
  7. System maintains temperature within tolerance

Negative vs Positive Feedback:

Comparison of negative feedback stabilizing output toward setpoint versus positive feedback amplifying changes away from equilibrium
Figure 56.7: Negative vs positive feedback: stabilization vs amplification

Negative vs Positive Feedback Comparison: Negative feedback opposes changes to stabilize the system (thermostat reducing heat as temperature approaches target). Positive feedback amplifies changes, leading to runaway growth or oscillation.

Negative Feedback (most common in IoT): - Opposes changes from the set point - Provides stability and regulation - Example: Thermostat reducing heat as temperature approaches target

PID control loop diagram showing setpoint input compared with measured output to generate error signal which feeds into parallel P I and D calculations that sum together to produce control output driving the plant or process with feedback from sensor measurement

PID Control Loop Architecture
Figure 56.8: PID control loop with proportional integral and derivative components

Positive Feedback (less common, specialized uses): - Reinforces changes from the set point - Can cause instability or rapid state changes - Example: Schmitt trigger with hysteresis for noise immunity

56.3.2 Open-Loop Control Systems

Block diagram of open-loop control system showing input command flowing to controller, then to process/plant producing output, with no feedback path measuring or returning output information to controller for adjustment
Figure 56.9: Open-loop control system diagram showing controller and process without feedback - system operates based on predetermined inputs without sensing output

An open-loop system does not monitor or measure its output. It executes a predetermined action based solely on the input, without feedback. This is also called a non-feedback system.

Open-loop control system block diagram with timer input driving controller and process without any output measurement or feedback path
Figure 56.10: Open-loop timer dryer: no feedback, fixed 60-minute cycle

Open-Loop System Block Diagram: Input (timer setting) determines controller action without measuring output state. System executes predetermined sequence with no knowledge of actual results (clothes may be over-dried or under-dried).

Characteristics:

  • No feedback path from output to input
  • Cannot self-correct for disturbances or errors
  • Simpler and less expensive to implement
  • Suitable when output is predictable and disturbances are minimal

56.4 Example: Automatic Clothes Dryer

Automatic clothes dryer open-loop example showing user setting timer for 60 minutes, timer controller starting heating element and drum rotation for fixed duration, dryer running for preset time without measuring moisture content, and stopping after 60 minutes regardless of whether clothes are actually dry, demonstrating limitation of no feedback
Figure 56.11: Automatic clothes dryer as an open-loop system example - timer-based operation without moisture sensing feedback
Clothes dryer open-loop operation: user sets 60-minute timer, dryer runs for preset duration, stops without measuring moisture content
Figure 56.12: Clothes dryer: timer-based stop without moisture sensing

Clothes Dryer Open-Loop Operation: Timer runs for preset duration without measuring moisture content. Clothes may be over-dried (energy waste, fabric damage) or under-dried (ineffective) with no adaptive adjustment.

Operation:

  1. User sets timer for 60 minutes
  2. Dryer runs heating element and drum for 60 minutes
  3. Timer expires, dryer stops
  4. No measurement of whether clothes are actually dry

Problem: Clothes might be over-dried (wasted energy, fabric damage) or under-dried (ineffective), but the system has no way to know or adjust.

Modern IoT Enhancement: Adding a humidity sensor creates a closed-loop system that stops when clothes are dry, regardless of time elapsed.

56.4.1 Open-Loop in IoT Sensing Applications

Open-loop architectures are increasingly common in IoT data collection scenarios where:

  • Device only senses and transmits data
  • No local actuation required
  • Analysis and decision-making occur remotely
  • Feedback loop exists at system level, but not device level
IoT sensor node open-loop data collection: device senses and transmits readings periodically without local actuation or feedback
Figure 56.13: Sensor node open-loop: transmit data, no local feedback

IoT Sensor Node Open-Loop Data Collection: Device only senses and transmits data periodically without local actuation. No device-level feedback loop, but human operators or cloud systems may take action based on reported data.

Characteristics:

  • Node transmits sensor readings periodically
  • No local feedback or control
  • Simple, low power consumption
  • Suitable for remote monitoring applications

However, at the system level, there may be feedback:

System-level closed-loop IoT architecture: individual open-loop sensor and actuator nodes coordinated by cloud platform creating feedback loop
Figure 56.14: Cloud-coordinated irrigation: system-level closed loop

System-Level Closed-Loop with Device-Level Open-Loop: Individual sensor and actuator nodes operate open-loop (no local feedback), but cloud platform creates system-level feedback by coordinating remote sensing and actuation based on rules.

This architecture demonstrates that while individual devices operate open-loop, the overall IoT system implements closed-loop control through cloud-based coordination.

Feedback is like playing “Hot and Cold” – someone tells you if you’re getting closer or farther from your goal!

56.4.2 The Sensor Squad Adventure: The Treasure Hunt

The Sensor Squad was on a treasure hunt in the park! They had to find a hidden box, and the only help they got was Sammy the Sensor, who could tell them how close they were.

“Walk forward!” said Max the Microcontroller. They took 10 steps.

“WARMER!” shouted Sammy. (That is feedback – information about how they’re doing!)

Max turned left. “COLDER!” said Sammy.

“Okay, go back right and keep going straight!” said Max, using the feedback to make better decisions.

Step by step, with Sammy saying “warmer” or “colder” after each move, the team found the treasure in just 2 minutes!

“Now imagine doing this WITHOUT feedback,” said Lila. “Just walking randomly with no clues!”

They tried it. Without Sammy’s help, they wandered around for 20 minutes and STILL couldn’t find it!

“That’s the difference feedback makes!” said Bella the Battery. “With feedback, you LEARN from each step. Without it, you’re just guessing!”

Negative feedback is like ‘colder’ – it tells you to CHANGE direction,” explained Sammy. “Positive feedback is like ‘keep going faster!’ – it makes you do MORE of the same thing. For most things, negative feedback is safer because it helps you stay on track!”

56.4.3 Key Words for Kids

Word What It Means
Feedback Information about how well you’re doing
Negative feedback “You’re going the wrong way – change course!” (keeps things stable)
Positive feedback “More! More! More!” (can get out of control)
Error How far you are from your goal

56.4.4 Try This at Home!

The Hot and Cold Game: Hide an object and guide a friend using only “warmer” and “colder.” Count how many steps it takes WITH feedback. Then try blindfolding your friend and giving NO hints – count the steps. Feedback makes finding the target MUCH faster!

56.5 Interactive: Hysteresis Band & Relay Cycling Calculator

See how hysteresis band width affects relay cycling frequency and equipment lifespan. Wider bands mean fewer cycles but coarser temperature control.

56.6 Worked Example: Greenhouse Temperature Feedback Control

Scenario: A commercial greenhouse (2,000 m^2) grows tomatoes requiring 22-26C daytime and 16-18C nighttime temperatures. The greenhouse uses a 50 kW gas heater, motorized roof vents, and an evaporative cooling pad. An ESP32 controller reads 8 temperature sensors distributed across the growing area.

Feedback loop design:

  • Sensor: 8 x DS18B20 digital temperature sensors (0.5C accuracy), averaged
  • Setpoint: 24C (day) / 17C (night), switched by photoresistor
  • Comparator: Error = Setpoint - Average Temperature
  • Controller: On-off with hysteresis (not PID, to keep it simple)
  • Actuators: Heater relay, vent motor, cooling pad pump

Control logic with hysteresis bands:

Condition Error Action Why Hysteresis
Temp < Setpoint - 2C > +2C Heater ON, vents CLOSED Prevent rapid cycling
Temp < Setpoint - 0.5C > +0.5C Heater ON (if already on) Maintain heating
Temp within +/- 0.5C of setpoint ~0C Hold current state Dead band prevents oscillation
Temp > Setpoint + 0.5C < -0.5C Vents OPEN (if already open) Maintain cooling
Temp > Setpoint + 2C < -2C Vents OPEN, cooling pad ON Aggressive cooling

Without hysteresis (the problem):

If the controller uses simple on/off at exactly 24C, the heater would cycle rapidly: - 23.9C -> Heater ON -> 24.1C -> Heater OFF -> 23.9C -> Heater ON (every 30 seconds) - This causes: 48 heater relay cycles/hour, premature relay failure (rated for 100,000 cycles = 87 days), gas valve wear, temperature oscillation stresses plants

With 1C hysteresis band:

  • 23C -> Heater ON -> heats to 25C -> Heater OFF -> cools to 23C -> Heater ON
  • Cycle time: ~15 minutes (depends on external temperature)
  • Relay cycles: 4/hour = 12x fewer, relay lasts 2.9 years

Real-world performance data (one growing season):

Metric No Feedback (timer) On-Off (no hysteresis) On-Off (with hysteresis)
Avg temp deviation +/- 8C +/- 0.3C +/- 1.2C
Heater relay cycles/day 2 1,152 96
Gas consumption 100% (baseline) 85% 78%
Tomato yield (kg/m^2) 5.2 7.8 7.4
Equipment failures/season 0 3 relays, 1 valve 0
Annual energy cost $18,000 $15,300 $14,040

Key insight: The hysteresis band sacrifices 0.4 kg/m^2 yield (5%) compared to tight on-off control, but eliminates equipment failures that cost $400 each and cause hours of uncontrolled temperature. The wider dead band is the better engineering choice. For tighter control without the cycling problem, upgrade to PID control (covered in the next chapter).

Key Takeaway

Feedback is the fundamental mechanism that transforms simple IoT devices into self-regulating systems. A closed-loop feedback system continuously measures output (sensor), calculates error (comparator), decides on corrective action (controller), and adjusts the system (actuator) – breaking any link in this chain disables self-regulation. In distributed IoT systems, feedback can operate at the device level (local PID loops), the edge level (gateway coordination), or the system level (cloud-based rules). The most robust architectures implement critical feedback locally while using cloud feedback for optimization and analytics.

MVU: Open-Loop vs Closed-Loop Control

Core Concept: Open-loop systems execute predetermined actions without measuring results (like a timer), while closed-loop systems continuously measure output and adjust to maintain desired state (like a thermostat). Why It Matters: Closed-loop costs more but adapts to disturbances - choose open-loop for predictable, cost-sensitive applications; choose closed-loop when accuracy matters more than simplicity. Key Takeaway: Ask yourself: “Will the environment change unpredictably?” If yes, use closed-loop. If the process is highly repeatable with minimal disturbances, open-loop may suffice and save cost.

56.7 What’s Next

If you want to… Read this
Learn about control types and cascade control Open vs Closed Loop Control Types
Implement PID control Processes and Systems: PID Control
Study the processes overview Processes and Systems Overview
Explore PID feedback fundamentals PID Feedback Fundamentals
Practice with the PID simulation lab PID Simulation Lab

Key Concepts

  • Negative Feedback: A feedback connection where the measured output is subtracted from the setpoint to produce an error signal — the fundamental mechanism of self-correcting control systems, stabilizing the output toward the desired value
  • Positive Feedback: A feedback connection where the measured output reinforces the input — inherently destabilizing but useful in specific applications (oscillators, Schmitt triggers, biological memory) requiring two stable states
  • Error Signal: The difference between the desired setpoint and the measured process variable (e = r - y), driving the controller to take corrective action — zero error means the system has reached its target
  • Closed-Loop Transfer Function: The mathematical description of a feedback system’s input-output relationship, G(s)/(1+G(s)H(s)), showing how forward path gain and feedback path gain together determine system response
  • Gain and Phase Margin: Measures of how much gain increase or phase delay the system can tolerate before becoming unstable — adequate margins (gain margin >6 dB, phase margin >45°) ensure robust stability under parameter variation
  • Steady-State Error: The permanent offset between setpoint and output after transients settle — proportional control always has steady-state error; integral action eliminates it by accumulating error until the output matches the reference exactly

Common Pitfalls

Wiring a sensor with inverted polarity into a negative feedback loop, converting it to positive feedback. The system immediately saturates or oscillates. Verify the sign of feedback by checking that disturbances cause corrective action, not amplification.

Setting high loop gains for fast response without verifying phase margin. A loop with -10° phase margin will oscillate at any gain above the stability limit. Always measure or calculate phase margin before finalizing PID gains.

Inserting AC-coupling capacitors in a feedback path for noise reduction, introducing a zero at DC that prevents the system from tracking DC setpoints with zero steady-state error. Always use DC-coupled feedback for process control.

Tuning a feedback loop for fast setpoint tracking (aggressive gains) when the primary requirement is suppressing load disturbances (different optimal tuning). Characterize the system’s primary operating scenario and tune accordingly.