Control loops

I have been getting lost of questions from readers about control loops, loop stability, specially relative to switching power supplies. And now one of him asked outright that I write a web page about this matter. Of course, control loops are amply and widely treated in electronic engineering books, but most of these books rely heavily on math, while most practical, hands-on electronicians seem to abhor math more strongly than nature abhors vacuum!

So I will try to explain these matters in physical terms most people can visualize and understand. I will have to use some math, unfortunately, but far less than most textbooks do.

The concept of a control loop

It's all about having some device with an input and an output, which has a certain behaviour: Give it some input, and it will produce a specific output that depends on this input in some way. And then, take a sample of that output, compare it to what you want that device to do, and calculate just the exact right input needed to force that device to produce the output you want.  As simple as that.

Not simple enough? Well, look around you! The world is full of control loops! For example, look at a car moving down the highway. The car and its dynamic behavior is such a device. The input is the position of the steering wheel, while the output is the direction the car actually goes. The transfer function from the input to output is a complicate one, not linear at all! It may be close to linear while the car is moving slowly, without any wind. It will turn to whatever side the steering wheel is turned. But when there is some side wind, the car will tend to move sideways with the wind, and the steering wheel needs to be turned slightly just to keep the car going straight! The same happens when the road isn't perfectly level. When you drive over gravel roads, the tires tend to slip significantly, and you need more rotation of the steering wheel to produce a certain change of travel direction. And as the car goes faster, things get really weird! In a turn at high speed, the car might follow the steering wheel input up to a certain amount of rotation, and then suddenly the tires start sliding, the car simply stops following steering wheel input! At that point, a totally different strategy is needed to recover control, like moving the steering wheel in the opposite direction, until control is re-gained , and then moving it more moderately.

With the above, it's clear that to make a car go straight, it isn't sufficient to tie the steering wheel in a fixed position. Instead, some feedback is needed, that closes the loop. This feedback usually these days is still a human being, sitting behind that steering wheel. It senses what the car is doing, mainly through its eyes, but a good driver also feels what the car does, through, well, the part of his body he is sitting on. He processes all the information, and constantly makes little corrections to the steering wheel position. If this human feedback system is working properly, the car stays well centered on the road, and follows all turns. If the human feedback system is still in the learning phase,  and thus is too slow in processing the sensed information, the car will likely go in slalom lines, but still stay on the road, hopefully. And if the human feedback system is processing the information far slower than normal, for example because of having drunk several whiskeys, the usual outcome is that the car ends up off the road, against a tree, lightpole, or stuck in a building.

This teaches you that control loops need to be fast enough for the process they are controlling. Remember this. As a circuit designer, your task is designing control loops that don't behave like they have drunk whiskey. Or at least not too much!

Characterizing the power section

The first thing we need to know, to design a control loop, is exactly how the device we want to control behaves! And that's very often far harder than it initially seems. Let's consider the following basic switching voltage regulator, a simple buck regulator whose duty is to keep the ouput voltage constant, at, say, 12V:

Figure 1--------------------------------------------------------------------
 

We have an oscillator that runs at 50kHz, feeding a Pulse Width Modulator, which produces a 50kHz square wave output with a duty cycle proportional to the input voltage. This wave is used to control a power MOSFET, through a driver circuit. The MOSFET switches on and off, applying 20V from the primary supply to the ouput filter when it is on, and leaving that output filter floating when it is off.

Until here the behavior is simple. But what the filter does is not very simple at all! To simplify it, for a first approach, I will assume that the load resistance is inside the range that will result in clean continuous current operation. This means that the current in the inductor never stops, but only changes value. Further down I will add what happens when this is not the case.

So, in continuous mode, whenever the MOSFET is off, the inductor current can only flow through the diode. So, the voltage at the node of the MOSFET, inductor and diode will be about -0.7V (one diode drop) whenever the MOSFET is off, and of course it will be very close to 20V when the MOSFET is on. This gives us a square wave at this junction, that has the same duty cycle as that coming from the PWM, only at other voltage levels.

If you look at this variable duty cycle square wave on a spectrum analyzer, you will see that it has (of course!) strong contents at 50kHz and its harmonics, but also has a DC component and lower frequencies. The DC and low frequencies present are an amplified copy of the signal presented to the input! 

The inductor, capacitor, together with the load resistance, form a low pass filter. This filter does two things:

- It passes DC and low frequency components, while increasingly attenuating higher ones. Normally it's designed for a cut-off frequency much lower than the oscillator frequency, a 1:10 ratio between them being quite usual. So it will block the 50kHz signals pretty well, and its harmonics even better, while passing the amplified copy of the PWM's input signal to the output.

- It will affect the phase of all AC components passing through it. While the effect on low frequency components is very small, even negligible, the effect of high frequencies (50kHz, for example) is dramatic, approaching a complete phase reversal! That means, simply, that while the MOSFET is switching on, and the voltage at the input of the filter is going up, the voltage at its output will be going down!
 

 

Back to homo ludens electronicus.