A closed-loop system is a control circuit that continuously measures its actual output, compares it to a desired target (setpoint), and automatically adjusts its input to minimize the error between the two. Unlike a simple timer or fixed-resistor setup that blindly applies power, a closed-loop architecture uses real-time sensor feedback to fight off environmental disturbances, component drift, and load variations. Whether you are designing a switch-mode power supply, tuning a 3D printer hotend, or stabilizing a DC motor, understanding feedback mechanics is the bridge between a circuit that "sort of works" and one that performs reliably under stress.
The Core Mechanics: Setpoints, Sensors, and Error Signals
Every closed-loop architecture relies on four physical or logical blocks working in a continuous cycle. If any single block fails or introduces excessive delay, the entire system degrades or oscillates.
- The Setpoint (SP): The target value you want to achieve (e.g., 5.00V output, 60°C temperature, 3000 RPM).
- The Sensor: The transducer measuring the actual Process Variable (PV). This could be an NTC thermistor, a shunt resistor with an op-amp, or a quadrature encoder.
- The Error Calculator: The comparator or microcontroller math that generates the error signal. e(t) = SP - PV
- The Controller & Actuator: The logic (often a PID algorithm) that decides how much to drive the actuator (a MOSFET, a relay, or a linear pass transistor) to force the error toward zero.
Where You Meet This in Practice (And What It Changes)
What it changes: A closed loop transforms a dumb, drifting open-loop circuit into a self-correcting system that actively rejects external disturbances. A simple resistive voltage divider sags unpredictably when a load is attached; a closed-loop LDO regulator senses that sag via a feedback pin and drives its internal pass transistor harder to maintain exactly 3.3V regardless of the load.
You will encounter closed-loop systems constantly on the workbench and in the field:
- Switch-Mode Power Supplies (SMPS): Chips like the UC3842 use a feedback (FB) pin to monitor the output voltage via a resistor divider. If the output rises, the chip reduces the PWM duty cycle driving the primary MOSFET, regulating the output tightly against AC line fluctuations.
- 3D Printer Hotends: Firmware like Marlin uses a closed-loop PID controller to pulse a 12V/24V heater cartridge. Without the loop, the thermal mass of the aluminum block would cause massive overshoot, melting your filament.
- BLDC Motor Commutation: Brushless motors use Hall-effect sensors (or back-EMF zero-crossing detection) to form a closed loop that tells the ESC exactly when to fire the next stator coil pair. Without this position feedback, the motor simply stutters and stalls.
Worked Numeric Example: Sizing a Closed-Loop Heater Controller
Let’s build a closed-loop temperature controller for a small aluminum heating block. We need to hold 60°C in a 20°C ambient room.
The Hardware:
- Heater: 12V, 50W silicone pad (Draws 4.16A at full power).
- Sensor: 10kΩ NTC thermistor (B-value = 3950) embedded in the block.
- Actuator: IRLZ44N logic-level MOSFET driven by an ESP32 hardware PWM pin.
The Math & Tuning:
At 60°C, our 10kΩ NTC drops to approximately 1.98kΩ. We place it in a voltage divider with a 10kΩ pull-up to 3.3V. The ESP32 ADC reads this junction. If the temperature drops to 58°C (a 2°C error), the ADC voltage shifts by roughly 45mV.
We implement a basic Proportional (P) controller in the ESP32 firmware. Let’s set our Proportional Gain (Kp) to 15% duty cycle per 1°C of error.
Error = 60°C (SP) - 58°C (PV) = +2°C.
PWM Adjustment = Error × Kp = 2 × 15% = 30% duty cycle increase.
The ESP32 immediately bumps the PWM output, driving the MOSFET harder to inject 15W of heat back into the block until the error returns to zero.
According to National Instruments' PID Theory Explained, while a purely proportional loop will get you close, it will likely leave a steady-state error (offset). To force the temperature to exactly 60.0°C, you must add an Integral (I) term to accumulate that stubborn 0.2°C offset over time and eliminate it.
Real-World Scenario Walkthrough: When the Loop Goes Unstable
Closed-loop systems are not magic; if tuned poorly, they will violently oscillate and destroy hardware. Here is a real-world debugging scenario from the bench.
The Setup: A 24V DC motor speed control project using a quadrature encoder for feedback and an Arduino Mega running a PID library. Target speed: 3000 RPM.
The Numbers: The encoder outputs 600 pulses per revolution. The Arduino polls the encoder interrupts every 10ms. The initial Proportional gain (Kp) was set aggressively high at 50 to achieve a "fast response."
The Outcome: Upon powering up, the motor shrieked, violently oscillating between 1500 RPM and 4500 RPM. It drew peak currents of 8A (rated for 3A continuous), instantly tripping the bench power supply's Over-Current Protection (OCP) and resetting the Arduino via brownout.
What Went Wrong (and the Fix):
- Sampling Aliasing: Polling a 600-PPR encoder at 3000 RPM every 10ms meant the microcontroller was missing rapid speed changes. The feedback data was jagged and delayed.
- Derivative Windup & High Kp: The high Kp saw a small error and slammed the PWM to 100%. By the time the 10ms poll registered the speed increase, the motor had already overshot. The controller then slammed the brakes (0% PWM), causing massive undershoot.
- The Fix: We lowered Kp to 12, added a hardware 100nF low-pass RC filter on the encoder lines to debounce electrical noise, and moved the encoder reading to a hardware timer interrupt polling at 2ms. The loop stabilized, holding 3000 RPM ± 15 RPM under varying mechanical loads.
Open vs. Closed Loop: Clearing Up the Confusion
The most common confusion for beginners is mixing up a closed-loop control system with a closed electrical circuit. When you flip a light switch, you have completed a closed electrical circuit (current flows from the panel, through the bulb, and back to the neutral bar, satisfying Kirchhoff’s laws). However, that light switch is an open-loop control system because it has no sensor to measure the room's brightness and adjust the bulb accordingly.
| Feature | Open-Loop Control | Closed-Loop Control |
|---|---|---|
| Feedback Path | None. Output is not measured. | Continuous. Output is measured and compared to input. |
| Disturbance Rejection | Poor. Output drifts if environment changes. | Excellent. Controller automatically compensates. |
| Stability Risk | Always stable (cannot oscillate). | Can oscillate or become unstable if poorly tuned. |
| Example | A toaster on a mechanical timer. | A sous-vide cooker with a PID and thermocouple. |
For a deeper theoretical dive into the mathematics governing these systems, Wikipedia's entry on Closed-loop controllers provides an excellent breakdown of the transfer functions and Laplace transforms used in advanced analog design.
Frequently Asked Questions
Do I need a microcontroller to build a closed-loop system?
No. While microcontrollers (like an ESP32 or Arduino) are great for digital PID loops, you can build purely analog closed-loop systems using operational amplifiers. A classic op-amp integrator and differentiator circuit can perform PID math in real-time using capacitors and resistors, completely independent of software or clock speeds. Even a simple mechanical bimetallic strip in a thermostat acts as a closed-loop bang-bang controller.
What is "hunting" in a closed-loop circuit?
Hunting is when the system continuously oscillates slightly above and below the setpoint without ever settling. This is usually caused by excessive Proportional gain (Kp) or a sensor that reacts too slowly relative to the actuator, causing the controller to constantly overcorrect. Adding a derivative (D) term to the PID algorithm or slowing down the actuator's maximum slew rate usually cures hunting.
Is a relay-based thermostat considered a closed loop?
Yes, but it is a specific type called a "bang-bang" or hysteresis controller. It only has two states: 100% ON or 100% OFF. To prevent the relay from clicking on and off rapidly (short-cycling) when the temperature hovers right at the setpoint, a closed-loop bang-bang controller intentionally introduces a deadband (hysteresis), such as turning on at 58°C and off at 62°C.






