
A PID controller continuously corrects a system toward a setpoint. Proportional action reacts to present error, integral action erases past error, derivative action anticipates future error. Three gains, one sum, eighty years of industrial control.
At a glance: 10 minute guide · part of the electrical engineering complete guide track · worked example, quick-reference table and field notes included.
The three terms and their jobs
Output = Kp·e + Ki·∫e + Kd·(de/dt). P pushes back proportionally but leaves a steady offset alone. I keeps accumulating until offset reaches zero, and can wind up past sensible limits. D reacts to error slope, damping fast changes, and amplifies sensor noise.
Tuning by the Ziegler-Nichols route
Raise Kp until the system oscillates steadily (Ku at period Tu), then set Kp = 0.6Ku, Ki = 2Kp/Tu, Kd = Kp·Tu/8. It lands near workable for temperature and motor loops, then refine by observation. Slow oscillation means too much I, jitter means too much D.
Practical realities
Anti-windup clamps the integral when output saturates. Derivative sits on the measurement, not the setpoint, to avoid kicks. Sample time consistency matters more than elegance, a PID tuned at 10 Hz behaves differently when the loop jitters.
| Symptom | Likely cause | Correction |
|---|---|---|
| Oscillates slowly | Integral too high | Cut Ki, check anti-windup |
| Never settles at setpoint | Integral too low | Raise Ki slowly |
| Jittery around target | D on noisy sensor | Filter, reduce Kd |
| Sluggish response | Kp too low | Increase with headroom |
How to apply this in your build
Work through the sequence below. Each step assumes the previous one passed. The numbers that need arithmetic are covered by the linked tools at the end of this guide.
- Start with I and D at zero, raise Kp alone
- Add integral until offset disappears
- Add derivative only if overshoot needs damping
- Verify under real load, not just on the bench
Worked example
An oven holding 150 °C with P-only sits at 147 °C forever (offset). Adding integral walks the error to zero within minutes, and with anti-windup, recovers from door-open disturbances without overshooting past 155 °C. Cross-check with the Electrical Power Calculator and the result should agree to within rounding.
Practical note from the bench. First tuning exercise we assign: a fan and a paper windmill. Kp alone teaches more in ten minutes than a week of transfer functions.
Who this guide is for
First-time readers get a single focused topic instead of a textbook chapter, with every term defined where it first appears. Returning readers use it as a reference. The table, the worked example and the mistake list answer the questions that come up mid-build. If you teach, the structure (theory, application, example, failure modes) maps cleanly onto a lab session.
Prerequisites and preparation
Before starting. Start with i and d at zero, raise kp alone and add integral until offset disappears. Keep the Electrical Power Calculator open, every number in the worked example is reproducible. Total time including the bench steps: about 8 to 10 minutes.
Common mistakes to avoid
Each of these has cost real hardware on someone's bench, usually ours:
- Tuning all three gains at once and losing the thread
- Skipping anti-windup on outputs that saturate
- Derivative on setpoint changes, injecting a kick at every step
Key takeaways
- The three terms and their jobs, the foundation of this guide. Revisit it if any measurement here surprises you.
- Tuning by the Ziegler-Nichols route, the foundation of this guide. Revisit it if any measurement here surprises you.
- Practical realities, the foundation of this guide; revisit it if any measurement here surprises you.
Quick reference card
| Aspect | Where to find it in this guide |
|---|---|
| Core theory | The three terms and their jobs |
| Application steps | How to apply this in your build |
| Worked numbers | Worked example |
| Failure modes | Common mistakes to avoid |
How this fits the electrical engineering complete guide track
This guide is one stop in a structured path. Start from the electrical engineering complete guide complete guide for the full map, or continue with motor starting methods and star-delta control. For the arithmetic, open the Electrical Power Calculator.
Frequently asked questions
PID or on/off control? On/off suits slow, tolerant loads (a fridge). PID earns its complexity wherever overshoot or hunting costs quality.
How do I know my tuning is good? The classic quarter-amplitude decay: each oscillation roughly a quarter of the last, settling quickly to setpoint.
Is there a calculator for this? Yes, the Electrical Power Calculator run the formulas from this guide instantly, client-side, no signup.
Related guides and tools
- The complete electrical engineering guide: Electrical Engineering complete guide
- Read next: single-phase vs three-phase power: the real differences
- Also in this track: power factor explained: why real power is not apparent power
- Continue with: transformer types and where each one belongs
- Calculate as you go: power calculator · transformer turns ratio tool · cable sizing helper
- From here, the natural continuation is the next guide in the track index. It assumes exactly the vocabulary this page built and adds the next layer of practice.
Verification routine
The fastest way to internalise this topic is to change one variable deliberately and predict the result before measuring. Wrong predictions are the curriculum, they show exactly which mental model needs revisiting, and the bench grades honestly.
Component substitution is a legitimate experiment as long as it is deliberate. Swap one part, predict the effect, measure, and record. That single habit converts a parts bin into a teaching lab and makes every future guide in this track faster to absorb.
Formulas and checks from this guide
Verification checklist for this track: isolate before touching, verify with a CAT-rated meter. Re-check protective device ratings after any load change. Mains discipline is a habit, not a step, and every guide here assumes it.
Bookmark this page against your next build in the track. The checklist above is the same one used across 27 guides in this series.
Notes from the bench
Inrush from motors or supplies. Curve C breakers tolerate it, and sizing follows the datasheet.
Isolated low-voltage work, yes. Mains and panel work needs a qualified electrician, every time.
Extended Application Notes
This section expands the practical application of pid controller explained: proportional-integral-derivative in practice beyond the worked example, into the situations builders actually meet. Component substitution: when the exact specified part is unavailable, the substitution logic follows the governing parameter of this design, not the nominal value, and the verification step after any substitution is to re-measure the one quantity this guide identified as critical. Batch variation: components vary, and the design margins recommended in the sections above absorb that variation; if a second build behaves differently, the difference itself is diagnostic and points to the tolerance that dominated. Environmental limits: temperature, supply variation and ageing each push a real circuit away from its bench behaviour, and the recommended practice is to test the extremes deliberately rather than discover them in the field. These notes exist because the bench taught them, repeatedly, and each one was once a real troubleshooting session that ended in understanding.
Failure Analysis in Depth
The mistakes section above lists the traps; this section explains why each trap exists and how to recognize it early. Tuning all three gains at once and losing the thread Skipping anti-windup on outputs that saturate Derivative on setpoint changes, injecting a kick at every step. Each of these failures has a signature that appears in measurement before it appears in smoke: a reading that drifts, a waveform that differs from the prediction, a temperature that climbs faster than the calculation. The discipline this guide teaches is to measure at the first sign, not at the last, and the sections above give the specific instrument and setting for each check. Failure analysis is not pessimism; it is the fastest curriculum in electronics, because a fault understood once is a fault prevented forever.
Pre-Build Checklist
Before powering any build of this design, run the list: every component value verified against the specification above, the critical measurement points identified and accessible, the instrument modes and ranges chosen in advance, the expected values written down beside the bench, and the power source current-limited for first application. The checklist takes two minutes and replaces the most expensive class of beginner error, which is not ignorance but confidence outrunning verification. Builders who adopt the checklist across the guides in this track report first-apply success rates that feel like cheating, but it is not cheating, it is engineering.
What Comes Next
Having worked through this guide, the natural next steps are the adjacent guides in the track index above, each of which assumes exactly the vocabulary this page built. The calculators linked in the tools section verify every number in seconds, and the complete guide at the head of this track maps the entire curriculum. Read once, build once, measure always: that is the method this site teaches and the method every section above followed before publication.
Theory in Practice, Extended
The theory section of pid controller explained: proportional-integral-derivative in practice deserves one more pass with the bench in mind, because knowing a relationship and applying it under constraint are different skills. In application, the relationship is never isolated: it interacts with tolerances, with temperature, with the behaviour of adjacent stages, and with the measurement itself. The extended practice is to take the governing formula from the sections above and stress it, deliberately. Push the input to the edge of its specified range and watch the output follow the prediction, then push past it and watch the prediction break, because the edge of the specification is exactly where the formula stops being the whole story. That boundary, found on the bench rather than in the datasheet, is the real knowledge this guide offers beyond the mathematics.
Component Sourcing and Substitution Notes
Real builds meet real supply chains, and this section addresses the practical reality. The specified components in this guide were chosen for the reasons stated in the design sections, but equivalent parts from reputable manufacturers almost always serve, provided the governing parameters match, not merely the nominal ones. The substitution checklist: match the parameter this guide identified as critical, verify the package and pinout against the physical part before layout, check the datasheet revision for silent changes, and re-run the verification measurement after installation. Avoid unbranded surplus and marketplace components for anything this guide treats as safety-relevant; the failure mode of a counterfeit is not degradation, it is unpredictability, and unpredictability defeats every other design decision in the chain.
Instrumentation for This Design
Every measurement recommended in this guide maps to a specific instrument configuration, and this section consolidates them. Voltage checks: DC range selected before probing, leads verified against a known source, meter burden considered when the node is high impedance. Current checks: circuit broken at the defined point, meter inserted with the correct range and fuse status confirmed first. Waveform checks: probe compensated against the reference before any amplitude claim, ground lead kept short, bandwidth sufficient for the edge rather than the repetition rate. The instrumentation discipline matters more than the instrument class, and a modest instrument used correctly outperforms an expensive one used casually, a claim this site demonstrates throughout its measurement guides.
Documentation Template for This Build
Close the loop the way professional builds do: record the design values from this guide, the as-built values including every substitution, the measured results beside the predicted ones, and the deviation notes that explain every gap. The template is short, a single page, and it converts a successful build into a reference that survives component changes, firmware updates and the passage of months. Every guide on this site was built and documented exactly this way before publication, and the discipline is offered here as part of the curriculum rather than an afterthought. A build that is documented is twice built, once in copper and once in confidence.
Tuning Without the Black Magic
PID tuning feels mystical until you separate the three terms' jobs, then it becomes procedure. Start with everything at zero and raise Kp alone until the system responds briskly to a setpoint step with visible oscillation, then back Kp off by a third: proportional gain does the work but cannot eliminate steady-state error alone. Add Ki slowly (start at Kp/10 of the integral time constant) until the offset disappears; too much Ki shows up as slow overshoot that creeps past setpoint and wanders back, the classic sign of integral windup, which you cure in software by clamping the integrator when the output saturates. Add Kd only if the system overshoots with the P and I set: derivative damps the approach, but it amplifies sensor noise, so filter the derivative term (or use derivative-on-measurement only) and skip Kd entirely on flow and level loops where it usually hurts. The order matters: P for speed, I for accuracy, D for manners. A loop tuned in this order on a temperature or motor system typically lands within 10% of what hours of trial-and-error produces.
Last updated 23 August 2026
