grokkingstuff Home Blog Projects Wiki Calculators About

The Plant: Actuators, Encoders & IMUs

date2026-07-24tags:ele: :control:

The Plant: What the Controller Actually Moves and Measures

A controller is an algorithm, and an algorithm lives in the Platonic realm of signals — but the plant is iron and copper, and iron and copper have opinions. The achievable closed-loop performance is bounded, often brutally, by three hardware limits: the actuator bandwidth (how fast it can change force/torque), the sensor noise floor (the smallest resolvable change), and the quantization granularity (the smallest resolvable increment). No amount of loop-shaping, LQR weighting, or clever Smith-predictor design can recover information that the sensor never captured, nor produce a torque the actuator cannot deliver.[fn:: This is the control-theoretic version of the data-processing inequality: the closed-loop performance is a contraction of the open-loop hardware capability, never an expansion. The gap between "what the controller computes" and "what the plant does" is exactly where the best engineers spend their time, and where mediocre engineers blame the loop gains. The honest loop is bounded by \( \min(\text{actuator BW}, \text{sensor BW}) \) in a rough sense — the closed-loop bandwidth cannot comfortably exceed the lesser of the two without phase-margin collapse.]

There is a familiar trilemma here, the "good fast cheap" of the plant: you can tune around a slow actuator (with aggressive compensation and the phase-margin risk it entails), or you can tune around a noisy sensor (with aggressive filtering and the lag it introduces), but you cannot tune around both at once.[fn:: Because the slow-actuator fix is lead compensation (phase advance), and the noisy-sensor fix is lag filtering (phase retard), and applying both simultaneously tends to cancel the phase you just bought while leaving the gain structure worse. This is one of those engineering truths that is obvious in hindsight and expensive in practice — a great deal of unstable servo loops are unstable precisely because someone reached for both fixes at once.] The plant sets the ceiling; the controller only decides how close you get to it, and at what cost in robustness.

DC Motors: The Two-Pole Electro-Mechanical Plant

The brushed DC motor is the canonical control plant because it is linear (over its useful range), well-modeled, and its dynamics factor cleanly into an electrical pole and a mechanical pole. The armature circuit is \( R_a \) in series with \( L_a \); the mechanical side is rotor inertia \( J \) against viscous friction \( b \). The two are coupled by the back-EMF constant \( k_e \) and the torque constant \( k_t \) (which, in SI units, are numerically equal in the ideal motor — a fact that still surprises people who first meet it).[fn:: The equality \( k_t = k_e \) is a consequence of energy conservation, Lorentz force and Faraday induction being the same phenomenon viewed from the electrical vs. mechanical port. In real motors they differ by a few percent due to iron losses, cogging, and the fact that "torque constant" is defined at the shaft while "back-EMF constant" is defined at the terminals. The distinction matters at high precision and is invisible at the level of a first course.]

The transfer function from armature voltage \( V_a \) to shaft angular velocity \( \omega \) is:

$$ G(s) = \frac{\omega(s)}{V_a(s)} = \frac{k_t}{(L_a s + R_a)(J s + b) + k_t k_e} $$

This is second-order, with one electrical pole near \( \tau_e = L_a / R_a \) (typically sub-millisecond) and one mechanical pole near \( \tau_m = J / b \) (typically tens to hundreds of milliseconds). Because \( \tau_m \gg \tau_e \) in almost every practical motor, the electrical dynamics are routinely neglected and the plant reduces to a single dominant pole:[fn:: The neglect is defensible when \( \tau_e / \tau_m < 0.01 \), which covers most fractional-horsepower DC motors. It breaks down for low-inductance designs (coreless, printed-circuit armature) where \( L_a \) is tiny and the electrical pole pushes up toward the mechanical resonance of the load — at which point you have a genuinely two-pole plant and the loop design must respect both. Disk-drive voice-coil actuators live in this regime, which is partly why head-positioning servo is its own subfield.]

$$ G(s) \approx \frac{k_t / (R_a J)}{s + (b + k_t k_e / R_a)/J} = \frac{K}{s + a} $$

A worked example: a small DC motor with \( R_a = 2\,\Omega \), \( L_a = 0.5\,\text{mH} \), \( J = 1\times10^{-5}\,\text{kg}\cdot\text{m}^2 \), \( b = 2\times10^{-6}\,\text{N}\cdot\text{m}\cdot\text{s} \), \( k_t = k_e = 0.05\,\text{N}\cdot\text{m/A} \). Then \( \tau_e = L_a/R_a = 0.25\,\text{ms} \), \( \tau_m = J / (b + k_t k_e / R_a) \approx 10^{-5}/(2\times10^{-6} + 0.00125) \approx 8\,\text{ms} \). The mechanical pole dominates by more than an order of magnitude; treat the motor as a first-order plant at \( a \approx 125\,\text{rad/s} \).

The armature-controlled vs. field-controlled distinction matters for the model: in armature control the field is held constant and the armature voltage is the input, giving the linear transfer function above; in field control the armature current is held constant and the field winding is driven, which is nonlinear (torque scales with field flux, which saturates) and is now largely historical except in large industrial drives where it survives for efficiency reasons at constant-power operating points.

BLDC: Commutation by Computation

The brushless DC motor removes the mechanical commutator and replaces it with electronic commutation of three phases. The rotor is a permanent magnet; the stator carries three windings 120° apart; an inverter (typically a three-phase H-bridge of MOSFETs or IGBTs) sequences the phase currents. The payoff is twofold: efficiency (no brush friction, no commutator sparking, lower \( I^2 R \) loss because heat dissipates from the stator directly) and bandwidth (no mechanical commutator lag, and the current loop can run into the kilohertz).

Field-oriented control (FOC) is the modern standard. The trick is to transform the three phase currents into a rotating \( d\text{-}q \) frame aligned with the rotor flux via the Clarke and Park transforms, so that the \( q \)-axis current produces torque and the \( d \)-axis current produces (or counteracts) flux — decoupling the two as in a separately-excited DC machine.[fn:: FOC is sometimes presented as "fancy," but it is conceptually a coordinate trick that turns a three-phase AC machine into a DC machine in a rotating frame. The mathematics is the Clarke transform (3-phase to 2-axis stationary, \( \alpha\text{-}\beta \)) followed by the Park transform (2-axis stationary to 2-axis rotating, \( d\text{-}q \)). The control law is then ordinary PI on \( i_d \) and \( i_q \), with the inverse transforms synthesizing the PWM duty cycles. The whole thing runs at 10–20 kHz on a $2 microcontroller, which would have been a research-grade result in 1985.] FOC requires rotor position at every instant — from Hall sensors (coarse, six-step), a magnetic encoder (fine, continuous), or sensorless estimation via back-EMF integration (cheap, fails at standstill and low speed where the back-EMF vanishes into the noise). The sensorless variant is the reason cheap drones fly at all; the reason they wobble at low throttle is the sensorless estimator losing lock.

BLDC bandwidth exceeds brushed DC for the same reason: the current loop is not bounded by mechanical commutator inductance and arcing limits, and the torque response to a current command is limited by the inverter's voltage headroom and the winding inductance — typically a few hundred microseconds, well above the mechanical pole.

Stepper Motors: Open-Loop and Its Failure Mode

The stepper is the actuator of choice for low-cost positioning — 3D printers, desktop CNC, flatbed scanners — because it offers discrete positional steps without a feedback sensor. The rotor aligns to one of a large number of detent positions; the controller sequences the windings and counts steps. The torque-speed curve falls off with speed (because at high step rates the winding current cannot fully establish in the available time, and back-EMF grows), so there is a pull-out torque below which the motor follows and above which it stalls.

The defining failure mode is step loss: under load exceeding the available torque at the current speed, the rotor skips a step, and because the controller is counting steps open-loop, the position error is now permanent and unnoticed for the rest of the move.[fn:: There is a deep irony here. Steppers are chosen specifically to avoid the cost and complexity of a feedback encoder — the whole value proposition is "open-loop positioning." But step loss is, in control terms, a closed-loop failure: the plant did not track the reference, and the controller has no measurement of the discrepancy. The fix is to add an encoder — yielding the so-called "closed-loop stepper" — which recovers robustness at the cost of the very simplicity that motivated the stepper in the first place. Engineering dialectics are rarely kind.] The standard mitigations are over-current (drive the motor hot and loud), microstepping (reduces resonance but does not increase holding torque), and acceleration limiting (stay below the pull-out curve everywhere). None of these guarantees against step loss from a sudden disturbance.

Encoders: Measuring Position and the Noisy Velocity

Encoders close the loop. The two families are incremental and absolute.

Incremental encoders produce two square waves (channels A and B) 90° out of phase — quadrature. Direction is the sign of the phase relationship (A leads B or B leads A); position is the count of edges. The resolution is multiplied by decoding modes: x1 counts one edge per cycle, x2 counts both rising edges, x4 counts every edge of both channels, quadrupling the apparent resolution. A third channel, the index (Z), pulses once per revolution and provides a homing reference for re-establishing absolute position after power loss.[fn:: The quadrature scheme is a small masterpiece of robustness: it is indifferent to the absolute voltage level (only edges matter), self-clocking (no separate clock line), and direction-recoverable from any two adjacent samples. It is also immune to single-bit errors in the sense that a glitch on one channel cannot flip direction without a matching glitch on the other within a quarter-period — a property that absolute encoders, with their parallel buses, must buy with Gray coding instead.]

Absolute encoders output a unique digital word per shaft position, typically in Gray code so that a single-bit transition never straddles two states. Multi-turn absolute encoders add a reduction gear train and a second code wheel to count revolutions, surviving power loss with no re-homing.

The bandwidth limit is real and underappreciated: at high RPM the encoder pulse rate can exceed the decoder's maximum count frequency. A 10,000-line encoder at 6000 RPM produces \( 10000 \times 4 \times (6000/60) = 4\,\text{MHz} \) of edges in x4 decoding — within range of dedicated hardware quadrature decoders, but well above what a software interrupt-driven decoder on a modest microcontroller can sustain. Missed edges mean silent position drift.[fn:: The deeper problem is velocity estimation, not position. Position is recovered exactly (up to missed edges) by integration of the count; but velocity estimated by differencing position over a fixed sample period is quantization-dominated at low speed, where the motor moves only a few counts per sample and the velocity estimate is either zero or a step. The standard fixes — a tachometer (analog, noisy in its own way), a phase-locked-loop on the encoder pulse train (great at steady state, slow to acquire), or an observer (Kalman or otherwise fusing the encoder with a motor model) — each trade one pathology for another. The "encoder tick velocity" noise at low speed is one of the persistent annoyances of servo design, and the reason why low-speed smoothness is so often achieved by model-based observers rather than by naive differentiation.]

IMUs: Three Sensors, Three Failure Modes

An inertial measurement unit is three sensors packaged together, and each has a distinct and complementary failure mode — which is the entire reason for fusing them.

The accelerometer measures specific force, not acceleration: it reports the difference between the body's acceleration and gravitational acceleration, so at rest it reads \( 1g \) upward (the normal force resisting gravity). This is the gravity ambiguity — you cannot distinguish "tilted relative to gravity" from "accelerating" without external information.[fn:: The distinction between specific force and acceleration is taught in every introductory navigation course and forgotten in every introductory robotics course, with predictable consequences for anyone who naively integrates an accelerometer to get velocity. A free-falling accelerometer reads zero, not \( -g \), because there is no support force. This is the basis of Einstein's elevator thought experiment and the reason an accelerometer alone cannot, even in principle, provide inertial navigation without an external attitude/position reference.]

The gyroscope measures angular velocity and integrates (in firmware) to attitude; the trouble is bias drift — a constant offset of, say, \( 0.01\,\text{deg/s} \) integrates to \( 0.6\,\text{deg/min} \), which is \( 36\,\text{deg/hour} \), rendering the attitude estimate useless over minutes without correction.[fn:: MEMS gyro drift is partly random walk (integrable but unbounded) and partly bias instability (correlated, sometimes temperature-compensable). The Allen-variance curve is the standard characterization. A consumer-grade MEMS gyro might drift a degree per minute; a tactical-grade fiber-optic gyro might drift a degree per hour; a ring-laser gyro in a strategic-grade INS might drift a degree per day. The price scales by roughly four orders of magnitude between each step, which is why your phone does not navigate by dead reckoning for more than a few seconds.]

The magnetometer measures the Earth's field vector and provides an absolute heading reference — but it is disturbed by any ferromagnetic material or current-carrying conductor nearby, which is to say by essentially every robot chassis and every motor. Hard-iron (constant offset) and soft-iron (distortion of field direction) calibration is mandatory and only locally valid; move the device to a new environment and the calibration is stale.

Attitude estimation fuses the three. The complementary filter is the elegant minimal solution: high-pass the gyro (trusting it short-term, where drift is small) and low-pass the accelerometer-magnetometer pair (trusting them long-term, where their noise averages out). The Kalman filter is the optimal (under linear-Gaussian assumptions) solution and generalizes to fusing additional sensors and to estimating bias states. In practice, for quadcopters and similar, a well-tuned complementary filter is within a few percent of a Kalman filter at a fraction of the computational cost and tuning effort — the Kalman filter's advantage appears mainly when the noise statistics are time-varying or when the sensor suite is heterogeneous.[fn:: The complementary-vs-Kalman debate is one of those recurring arguments that generates more heat than light. The honest summary: a complementary filter is a steady-state Kalman filter for a particular problem structure, so the disagreement is not about optimality but about whether the extra generality of the Kalman filter is worth the modeling and tuning cost in a given application. For a hobby quadcopter, no; for an autonomous vehicle fusing IMU + GPS + wheel odometry + vision, yes.]

The critical failure mode of the accelerometer for attitude is sustained acceleration: during a coordinated turn, the centripetal acceleration is indistinguishable from a tilt of the gravity vector, so an accelerometer-based attitude estimate will lean into the turn by exactly the bank angle that produces the centripetal force. This is why aircraft attitude must come from the gyro, with the accelerometer as a slow long-term reference that is explicitly distrust during maneuvering — a lesson relearned in every generation of drone flight controllers that tries to use accelerometer-only leveling and finds the drone "leaning" in fast forward flight.

The Sensor-Actuator Seam

This note sits at the seam between the electrical control stack (signals, Laplace, PID) and the mechanical plant it drives and measures. The actuators here — DC, BLDC, stepper — are the electrical instances of the broader actuator taxonomy in Actuators, which also includes hydraulic and pneumatic drives with their own (slower, more nonlinear, but far higher force-density) dynamics. The load being moved — inertia, friction, compliance, vibration modes — is the subject of Dynamics & Vibrations, and the plant model used in any loop design is only as good as its account of that load. The sensor side continues in Sensors. Upward in the electrical stack: Electric Motors for the machine theory, Control Theory: Signals & Laplace for the analytical framework, and PID Control: Theory & Tuning for the loop-shaping that lives on top of all of this.

The seam is where most real control systems fail. A beautiful PID design on a linear plant model collapses when the actuator saturates, the encoder quantizes, the IMU drifts, and the load has an unmodeled resonance at 30 Hz. The loop was never the problem; the plant was.

Related