[HN Gopher] Deep dive: the instability of op-amps
       ___________________________________________________________________
        
       Deep dive: the instability of op-amps
        
       Author : lapnect
       Score  : 80 points
       Date   : 2024-10-26 14:38 UTC (8 hours ago)
        
 (HTM) web link (lcamtuf.substack.com)
 (TXT) w3m dump (lcamtuf.substack.com)
        
       | dragontamer wrote:
       | It's almost criminal that all of these bode plots are missing
       | their phase diagrams.
       | 
       | Phase diagrams + OpAmp phase shift specs / phase margin are what
       | you need to predict instability.
       | 
       | -------
       | 
       | EDIT: IMO it's also a lot easier to explain in the frequency
       | domain. At 180-degree phase shift, all your negative feedback
       | turns into positive feedback, causing instability. You need your
       | amplifier to stay as far away from 180-degree phase shift as
       | possible.
       | 
       | I get that what the author was trying to get to with the 'Tape
       | Delay OpAmp' example. But it should be double downed upon and the
       | starting point of the discussion rather than something brought up
       | later IMO.
        
         | FunkyDuckling wrote:
         | I agree.
         | 
         | Phase Margin (How far away you are from 180 Phase Shift) is a
         | critical parameter used whenever designing any kind of feedback
         | loop and testing for stability.
         | 
         | This is very to measure at the 0dB gain he pointed out, but
         | lacked the phase diagram to show this shift.
        
           | arijo wrote:
           | This is only true for LTI (linear time-invariant systems).
           | 
           | Nonlinear systems responses to a sine signal are in general
           | not just a change in phase and amplitude.
           | 
           | It works if the perturbation stays small and within a
           | linearised version of the dynamics.
        
           | dsv3099i wrote:
           | I agree the overall math is easier in the frequency domain,
           | especially because you don't know which frequencies are
           | problematic so best to look at all of them, but I think the
           | concept is best explained at first, in the time domain.
           | 
           | Here's my attempt in a couple of sentences.
           | 
           | It takes time for the signal to propagate from input to
           | output in any real circuit. If that time is a substantial
           | fraction of the period under consideration then the input of
           | the amplifier, which includes the feedback signal, cannot
           | effect the output before it has moved. And if the delay
           | through the amplifier is just wrong relative to the signal
           | period one can end up in a dog chasing its own tail situation
           | and the output oscillates.
           | 
           | The rest is just math. :)
           | 
           | P.S. this explanation also explains why we use phase and not
           | seconds to measure the delay of the circuit. Because
           | everything is relative to the input signal period and if we
           | use phase we get that for free. No extra divide.
        
         | ChuckMcM wrote:
         | I appreciate what you're saying. That said, not everyone learns
         | the same way and for me, his explanations have always been
         | clear and insightful. My theory is that different brain
         | architectures ingest information in different ways (this is
         | actually studied but not conclusively proven AFAICT) and that
         | the language of exposition has a sort of 'impedance match' with
         | brain architecture. So sometimes you can say something and the
         | person hearing/reading it will just "get it" right away, and
         | sometimes they will look at you like "that didn't help at all."
         | 
         | That said, I agree that if you're used to thinking about things
         | in the frequency domain it makes sense to explain it in those
         | terms. Myself, as a young EE in college found thinking about
         | things in the frequency domain to be useless, in part because I
         | didn't understand the math, and in part because I didn't really
         | understand sinusoidal waveforms. It wasn't until I started
         | diving into SDRs and really unpacking the FFT and how it worked
         | and why did I manage to connect a lot of dots that
         | retroactively gave me a better insight into what my control
         | systems professor was trying to teach me back in the day.
        
       | buildsjets wrote:
       | But the ringing, sustained oscillations, and excessive gain are
       | sometimes desired characteristics of a particular op-amp
       | implementation.
       | 
       | https://youtu.be/SrS9EtfcANg?si=MwbtbuPWu85Tbjzq
        
         | analog31 wrote:
         | Sure, the Wien bridge oscillator. But then, oddly enough, even
         | sustained oscillations need to be controlled in their
         | amplitude, and the Wien Bridge has a secondary feedback loop
         | for that purpose -- the temperature dependent resistance of a
         | light bulb.
        
         | ericwood wrote:
         | Those op amp characteristics aren't really coming into play for
         | that delay sound, it's just vanilla digital delay. Most of the
         | "vibe" of the DD-3 is coming from the companding and filtering
         | scheme it uses to work around the limitations of the digital
         | pieces.
         | 
         | You will hear the effects of this in many hard clipping
         | distortion circuits, though, where the amplifier gain factor
         | will far exceed the voltage rails and be pushed into undefined
         | clipping territory. Behaviors in this range can be an important
         | part of the sound, e.g. the Proco Rat and the infamous LM308 op
         | amp with its slow slew rate. Some like the TL072 exhibit a
         | really nasty phase inversion that results in a pretty horrific
         | (usually undesired) distortion.
         | 
         | It's a balancing act, though; search "op amp motorboating" in
         | any DIY stompbox forum and you'll find thread after thread of
         | people trying to keep op amp gain stages from oscillating. I
         | know more than a few noisier artists who enjoy when designs can
         | be tortured into doing that, though :)
        
       | 082349872349872 wrote:
       | to what degree does the Gartner hype cycle resemble the Gibbs
       | phenomenon?
        
         | marcosdumay wrote:
         | To the degree that society is a complex system with feedback.
         | 
         | But notice that the Gartner hype cycle is full of unjustifiable
         | hidden assumptions (like the fact that the thing being hyped is
         | useful at all) so it has no predictive power. It only happens
         | that some times people act like that.
         | 
         | Also, there's no guarantee that the society's response to a
         | change will be stable.
        
           | WJW wrote:
           | One of the most "useful" insights I ever had is that
           | 
           | 0. Any transfer function higher than 2nd order overshoots.
           | 
           | 1. Society is super complex, has a ton of internal feedback
           | loops and would easily be higher than 2nd order.
           | 
           | 2. So of course it overshoots all the time.
           | 
           | I haven't been able to actually "use" it for anything but it
           | does describe a lot of what we see every day in society.
        
             | RossBencina wrote:
             | > Any transfer function higher than 2nd order overshoots.
             | 
             | That's false. Any LTI system higher than first order
             | _might_ overshoot. But it 's easy to design high-order
             | systems that don't overshoot. Consider for example a
             | cascade of first-order sections. Related terms: Bessel
             | filter, complex vs real poles, overdamped system.
        
       | sobriquet9 wrote:
       | The tape delay methaphor confused me. Tape recorders do not
       | record DC or other frequencies much lower than, say, 20 Hz. So
       | that circuit would run into one of the rails just as quickly as
       | the previous cirquit without DC feedback.
        
         | mrob wrote:
         | It must be an FM encoded tape, which can record DC. There were
         | upgraded versions of both VHS and Betamax with FM audio support
         | (although I expect in practice the inputs were AC coupled).
        
       | Buttons840 wrote:
       | This is tangential, but I took an EE class at community college
       | and the very first thing they did was start teaching op-amps. I
       | don't remember ever getting any insight from working with them,
       | only that we had to follow instructions and build one in the lab.
       | 
       | When I see people asking questions about op-amps and doing "deep
       | dives" into op-amps, I'm left wondering what's so deep about
       | these things we do in week 2 of EE 101.
       | 
       | I've forgotten almost everything from that class though, so maybe
       | it was just a bad class? I switched majors and never took another
       | EE class.
        
         | fourier54 wrote:
         | If your only interaction was "follow instructions and build one
         | in the lab", doesn't that tell you exactly there is something
         | deep you didn't understand at all?
        
         | szundi wrote:
         | These are pesky little things
        
         | analog31 wrote:
         | I'd say that nothing can be covered deeply in an introductory
         | survey class. If it's being taught at the 101 level, the
         | students don't yet have the math to scratch anything beneath
         | the surface. And one of the points of op amps, if not the main
         | point, is the correspondence between their mathematical
         | representation, and their real world behavior.
         | 
         | There are entire books about op amps and their uses. They're a
         | cornerstone of analog design.
        
           | Buttons840 wrote:
           | Now that you mention it, I remember the point was the
           | difference between the theoretical math and the actual
           | behavior.
        
             | WJW wrote:
             | I can definitely see how a more advanced student can get a
             | ton of valuable insights about the "abstraction leaks" of
             | opamps, and I would even submit that opamps could be a
             | particularly fertile place of such leaks (for our more
             | software minded brethren: opamps are like databases: they
             | are perfect until you start to push their boundaries and
             | then you very quickly start to see just how imperfect they
             | are), but I doubt you can teach a student enough about the
             | theoretical math to get a useful intuition about the
             | behavior of opamps in under 2 weeks.
        
         | michaelt wrote:
         | _> I 'm left wondering what's so deep about these things we do
         | in week 2 of EE 101._
         | 
         | Part core concept, part outdated nonsense that's taught due to
         | tradition.
         | 
         | If you've got components that can halve a voltage, then by
         | putting that in a feedback loop you can double a voltage.
         | 
         | And you can make an accurate amplifier even if some of your
         | components - like the op-amp's gain - are inaccurate. So long
         | as your voltage-halving components are accurate, your voltage
         | doubler will be accurate whether your op-amp's gain is 10000x
         | or 20000x
         | 
         | You can chuck other components into the feedback loop too -
         | want a higher current output from your voltage doubler? Have
         | the op-amp control a high-power transistor.
         | 
         | You know how a feedback loop can turn a voltage-halver into a
         | voltage-doubler? It can invert other mathematical functions
         | too. Put a capacitor into your op-amp circuit and you can
         | integrator or differentiate. There are even op-amp circuits for
         | summing inputs!
         | 
         | You now understand feedback loops, precise gains, power output
         | stages, integration and differentiation. You can now make a PID
         | controller - a key concept in control theory! Just what you
         | need to position control a robot's joints.
         | 
         | Except making PID controllers out of op-amps is obsolete;
         | they're all done in software these days.
        
         | Metacelsus wrote:
         | Yeah I was very confused by them in high school, I just
         | internalized "op amps are weird" and then became a biologist.
         | This article was a great explainer. Similar feedback loops
         | happen in biology!
        
         | masspro wrote:
         | It is a headscratchingly bad idea to put op-amps in week 2 of
         | course #1. I can't even remember for sure if we did them in the
         | first course, but if so, it was at the very end, _after_ you
         | already know how to do algebraic working-out of values in a
         | circuit. From there, they give a couple algebraic rules to
         | figure out what an op-amp circuit does. And a key point that is
         | usually glossed over is: op-amps are basically useless when not
         | in a feedback configuration, and some of the analysis rules are
         | based on already assuming the op-amp is in a feedback
         | configuration.
        
       | neuralRiot wrote:
       | Ahh the good times I remember designing and building some
       | configurable audio crossovers with "memories" so they could be
       | adjusted and stored. This was of course before DSPs were even a
       | thing. We gave up because the only solutions were inserting
       | mosfets on the opamp loop or using transconductance opamps. Both
       | solutions were terrible in terms of audio quality, we decided for
       | "cartridges" that were the whole x-over stage.
        
       | Metacelsus wrote:
       | Until reading this article I never really understood what an op-
       | amp actually did (I remember coming across them as high schooler
       | and being confused).
        
       | davidhyde wrote:
       | What an absolute goldmine of a website. So many varied topics.
       | Just amazing.
        
       | RossBencina wrote:
       | If you want an actual deep dive watch James K. Roberge's OCW
       | course and/or get the book "Operational Amplifiers Theory and
       | Practice".
        
       ___________________________________________________________________
       (page generated 2024-10-26 23:00 UTC)