Sunday, October 4, 2020

A Ham Radio Series 15 – Control Loops and Radio Design - 1

Control loops, sometimes called Feedback and Control Loops, are very commonly used in radio design.  Receivers have Automatic Gain Control (AGC) loops; transmitters call the equivalent circuit Automatic Level Control (ALC), and both receivers and transmitters might have Phase Locked Loop (PLL) Frequency Synthesizers.  For many years, I was the PLL specialist where I worked, but I’ve designed all those and other control circuits.   I know that some of you are already really familiar with these things, in great and gory details.  Take the night off (unless you care to look for mistakes to correct).

I started writing this post this afternoon, went looking for one of the terms I use and found a post from 2017.  I'd written four paragraphs and they were substantially the same as the previous post.  Most of this is reused from that post. 

As a topic in the EE curriculum, control loops are a vast subject with a great deal of analytical models for their behavior.  This helps us design them so they work as intended from the start.  I won’t get into that sort of detail here.  I'm going to skip the math and try to explain things in words.  I'll also be the first to say that when you design your 10th or 15th PLL or AGC, there's not much theory involved.  It's pretty much you just solve a few equations (which you've probably stuck in a spreadsheet or other software) and you're done. 

For starters, let's define a feedback system.  It's a system that corrects itself by feeding back information on its state ("what we got") and comparing this to its desired state ("what we want it to be").  This diagram is a simple type of feedback system. 

For some folks, this is probably more confusing than helpful, so let's do a simple example of something that everyone knows: a thermostat in an air conditioner.  The thing we're controlling is the temperature at the thermostat, which we use as a proxy for the temperature everywhere under that air conditioning.  The feedback sampler is a thermocouple or something that measures the temperature – essentially a thermometer.  The heart of the loop is that circle with an X in it, which acts to compare the "what we want it to be" (the input; the temperature we set) to "what we actually got" (from the thermocouple).  It compares the two electrical signals and generates an error signal ("what we got" minus "what we wanted") which goes to something called the feedback controller here which makes the feedback correction.  In a thermostat, this is usually an on/off switch.    

It's important to notice that if the temperature is higher than we wanted, the control system turns it down, and if it's lower the system turns it up.  Since the correction is in the opposite direction of the measurement, this is called negative feedback.  If you think of the audio screams and howls that happen when a microphone is in front of a loudspeaker, there is no correction and the output gets louder until it can't go up any more.  This is a type of positive feedback, not a control system.  Perhaps you've heard of the term vicious cycle, where something happens and its result is to contribute to causing it again: that's a positive feedback situation.

As an example, I'm going to describe how my central air conditioner works.  I don't know how universal this is, but I've watched my thermostat and know that if I set some temperature, say to cool the house to 75 degrees, it won't turn the air conditioner on to reduce temperature until it measures 2 degrees above the desired temperature, 77.  The error has to be that big before it will turn on.  The air conditioner then comes on at full power until the temperature at the thermostat reaches the desired temperature.  There has to be some sort of difference (called hysteresis) in the temperature between when it turns on as the room is getting warmer and when turns off as it's cooling the room.  There's no way the system could know to both turn on and turn off when it's 75.

This is what's called a Bang-Bang controller.  It either turns on the cooling 100% or it turns it off (0%).  That's a pretty crude system, and lots of control systems you're familiar with don't work that way.  Consider cruise control in a car: if you had a Bang-Bang controller your accelerator would go full throttle or to idle.  A Bang-Bang controller works for a simple thermostat, but in a cruise control the demands for accuracy are higher, and we want something that doesn't continually speed you up and slow you down by a couple of MPH.  Your cruise control measures your speed, compares it to the setting and either increases or decreases the throttle.

There are much more elegant control systems available, and the smoothest response is generally the Proportional-Integral-Derivative or PIDcontroller.   A PID controller calculates three quantities and then combines them to create the error correction needed.  The three signals can be prioritized in this combining subcircuit.  Hopefully, this graphic will help explain it while I add some words.

Proportional to error means that the bigger the error, the harder it tries to correct.  Integration of errors over time is an averaging process - it means that the result is incorporating both how big the error is and how long it lasted; its output gets bigger if some error has lasted longer, not just if the error is larger.  Finally, Proportional to the rate of change term is determining if the error has gotten larger quickly or slowly.

The drawback of PID systems is that they're complex and can be hard to get running well; in many cases, an error signal that's proportional to the error is all that's needed.  I don't recall ever seeing an AGC, PLL, ALC or any other electronic control system that used a PID controller.  The vast majority are simply the middle box, proportional to an integration (summation) of the errors over time.  On the other hand, this is something that the continuing advancement of electronics has vastly improved, and for some control tasks, like the temperature of furnace, kiln or for some operation, you can buy a preprogrammed, ready-to-use PID controller for well under $100, and sometimes under $20.  

Proportional systems are starting to make their way into air conditioners.  We have a Mini Split system in the workshop and it behaves that way.  It cools the air it blows more when the temperature in the room is a couple of degrees higher than the set point - or proportional to the difference in temperature.  Instead of the unit turning off when it reaches temperature, it sets the cool air output warmer than it was when it was dropping the room temperature, saving energy.  The air coming out can be just a couple of degrees cooler than the air going in, so essentially no cooling goes on.  

A Fun Fact is that PID controllers were first developed for automatic steering systems of ships at sea in the 1920s.   


  1. This comment has been removed by a blog administrator.

  2. Long ago and far away, as a newly minted technician, one of the things I got to troubleshoot was three phase push-pull PLL hard drive spindle motor circuits. It was interesting.

    1. I've never seen a hard drive motor spindle control, so that sounds like it would be interesting to look up. There are probably some online somewhere.

      I can see a PLL for tight control of speed, like they're used for tight frequency control, but that's as far as I can get right now.

  3. "it sets the cool air output warmer than it was when it was dropping the room temperature". In HVAC school the instructor was asked what would the ideal cooling system be. To my surprise he said 'it would run all the time, only adding enough BTUs to replace what losses the building has'.
    I read you blog every day, Thanks. TeX

    1. Nice to hear from you TeX.

      The mini split took a little getting used to after a lifetime with bang-bang thermostats, but they are pretty slick.

  4. Well done, SiG!

    As an old Analog Guy who's been bloodied by the delicate dance of "Gain" and "Stability" in large mechanical systems, I'm more than bit familiar with these things.

    And then there's "Range" and "Span", which sound the same, but aren't....

  5. This brings back memories of "floobydust" and other RAP articles from days gone by....