Simple on-off (bang-bang) sensors pose a control challenge, but this approach offers an alternative that avoids sustained oscillation.
The introduction of inverse feedback and control loops incorporating it was a brilliant advance in the history of engineering, but it was soon followed (probably on that very same day!) by the appearance of dark terms connoting confusion, frustration, and failure — like time lag, undamped overshoot, instability, and oscillation. Over the years a large cookbook of feedback techniques and control strategies accrued to tame the stability-destroying gremlins that inhabit servo loops. One of the most powerful and popular of these techniques is the proportional-integral-differential (PID) controller (see The Art of Electronics 3rd Edition, Horowitz and Hill, p1074).
Although widely and successfully used, however, PID is not without its limitations (ibid. p.1075). One particular challenge for the PID controller is working well with single-bit (i.e., “high/low” or “bang-bang”) feedback sensors. Such sensors are problematic for PID because their output contains neither proportional (the P) nor derivative (the D) information for PID to work with, leaving only integration (the I) available by which to extract a control signal. Pure integration, unfortunately, presents a serious stability problem in the controlled variable.
A “straight-integration” algorithm samples the controlled variable and subtracts it from the setpoint, multiplies that difference by a gain factor, then integrates the result to produce the feedback (output) signal. The resulting servo loop offers nice features that include simplicity and zero steady-state error. Unfortunately, it also exhibits an undesirable tendency to persistent oscillation that never allows final convergence to setpoint. Such persistent oscillation is all but inevitable because, by the time that the controlled variable corrects from a deviation and struggles back to setpoint, feedback has grossly overcorrected. In fact, the resulting overshoot is likely to grow as large as the original perturbation, causing opposite undershoot as large as the initial overshoot, and so on.
In the example illustrated in Figure 1, a relative humidity control application, the red curve shows the relative humidity achieved in an environmental chamber with a simple bang-bang sensor and a straight integration algorithm – obviously unsatisfactory.
Figure 1 System instability with pure integration of bang-bang sensor feedback
So, several decades ago, I worked to devise an alternative that is simpler, and easier to tune than the PID, with only one gain factor needing adjustment instead of PID’s three. I call it a “take back half” (TBH) controller, and described it in an EDN Design Idea in 2005.
Acting on intuition, you might attempt to fix the problem of using straight integration with a bang-bang sensor by adopting, whenever the system crosses the setpoint, a better estimate of the required feedback than the simple integration has produced. The TBH controller does exactly that by taking deliberate advantage of straight-integration’s undamped overshoots and undershoots being approximately equal. To do so, you introduce variable HO, which is the value of the feedback term H at the prior transition. You then run the modified servo loop, except for the moments when the system passes through the setpoint. Whenever a setpoint crossing occurs, replace the feedback term (H) by the average of its current value and the value it had at the previous setpoint crossing (HO). This action takes back half of the adjustment accumulated between crossings, inspiring the moniker: TBH.
While not always equal in dynamic performance (e.g., speed of settling) to an expertly tuned PID loop, TBH’s basic stability and inherent zero steady-state error are easy to achieve and robust despite having to cope with various difficult process non-idealities.
Happily, stable control from pure integration is TBH’s specialty, as explained in the references cited above. The result of modifying pure integration with TBH is shown in Figure 2 – clearly better performance.
Figure 2 Improved convergence and stability with TBH integration
To provide a working example of this approach, consider the details of the TBH solution to humidity control. We must logically begin with a description of the bang-bang humidity sensor: the Vishay 691, which has capacitance that changes from ~112pF to ~144pF as ambient relative humidity (RH%) changes from 10% to 90% (i.e., ~0.36pF/%RH). See Figure 3 for the parametric curve.
Figure 3 Vishay 691 relative humidity detector response, capacitance vs RH%
The full control system using this sensor is shown in Figure 4. The circuit topology utilizes the RS flip-flop IC3A as a capacitance ratio comparator relating the Vishay detector’s CX to reference capacitor CREF, with VR2 setting the setpoint ratio, and thus the setpoint RH%. The comparator will indicate only whether the sensor’s reading is above or below the setpoint.
IC2B (pin 7) produces a simple clock operating at about 22Hz. The controller’s comparison cycle begins with the clock’s positive transition, which drives both R and S inputs on IC3A, high. This situation places the RS flip/flop into a quirky, logically anomalous state that sets both Q and –Q outputs simultaneously (and oxymoronically!) high. When the clock signal subsequently returns low, IC3A’s S and R inputs follow, but at different rates that depend on their respective RC time constants.
The exit of IC3A from its logically anomalous state, and the stable 0/1 state it ultimately settles to, depends on which input — R or S — is driven by the longer RC time constant. Because the time constant on the S pin depends on CX, and thus on the prevailing RH%, Q = 0 if RH% < setpoint, Q = 1 if RH% > setpoint. IC3B captures the result of IC3A sorting itself out into a stable binary state at the beginning of the next clock cycle, as the Figure 5 timing diagram shows.
The controller’s proportional output signal comes from integrator IC2A, which receives its signal from IC3B after scaling by VR1 — the TBH (one and only) feedback gain factor. Meanwhile, the switches of IC1 combine the outputs of IC3A and IC3B with the clock (IC2B) to generate a low-going pulse whenever the sensed RH signal crosses the setpoint in either direction This –TBH setpoint crossing pulse is when take-back-half occurs, essential to feedback convergence and stability. The resulting output signal is shown in Figure 5.
Figure 5 RH sensor and TBH algorithm timing diagram
—W. Stephen Woodward is one of EDN’s most prolific and innovative Design Ideas authors, with dozens of contributions to his credit.