Top
Best
New

Posted by lapnect 10/26/2024

Deep dive: the instability of op-amps(lcamtuf.substack.com)
115 points | 46 comments
dragontamer 10/26/2024|
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.

ChuckMcM 10/26/2024||
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.

H8crilA 10/27/2024||
You don't actually need to reach for theories about the inner workings of a brain. A person's education history can strongly bias towards one form of information presentation over another. For example imagine a self learned musician who doesn't even know the notation vs a classically trained one.
FunkyDuckling 10/26/2024||
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 10/26/2024|||
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 10/26/2024|||
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.

neuralRiot 10/26/2024||
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.
Buttons840 10/26/2024||
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.

michaelt 10/26/2024||
> 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.

jcgrillo 10/27/2024||
Building a PID controller to control the temperature of a (IIRC) piezoelectric cooler (or was it a hot plate? I don't remember exactly) was such a fun exercise. It took me until like 3am to get it working, most fun I had in junior year physics lab.
masspro 10/26/2024|||
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.
analog31 10/26/2024|||
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 10/26/2024||
Now that you mention it, I remember the point was the difference between the theoretical math and the actual behavior.
WJW 10/26/2024|||
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.
analog31 10/26/2024|||
Indeed, but you have to grasp one before it makes sense to learn about the other, and neither is going to happen in a 101 class.
fourier54 10/26/2024|||
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?
BobbyTables2 10/27/2024|||
Starting with op-amps sounds like a horrible way of teaching EE.

We started with transistors (BJT and FET) analyzed many types of designs, and only then moved on to op-amps.

Metacelsus 10/26/2024|||
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!
szundi 10/26/2024|||
These are pesky little things
pbazarnik 10/27/2024||
When I first discovered OPAMPs I my teen years while self learning the electronics I was astonished by the beauty and power of an abstract opamp: the mythical component with infinite differential voltage gain, zero common mode gain, infinite input impedance and zero output resistance. This marvelous device can only exist, without destroying the world by its infinite output power, by staying in equilibrium defined by negative feedback. /s

You have to appreciate the reason it was invented in Bell Labs: analog computers, which primary applications at that time were in military applications for computing artillery solutions.

Now, as a professional EE, I still think fondly of them, even though I know well about their real life limitations. My advice is to try to stay first at ideal OPAMP abstraction level to appreciate the mathematical usefulness of that abstract construct. This is almost entirely how professionals use them.

I can only lament the educational system, which invariably makes the students miss the forrest for the trees by not presenting well the power of ideal opamp

ilayn 10/27/2024||
This is a bit of a strange presentation of stability but I liked it. I don't agree with the phase margin absence in the other comment but it would have been much clearer if the author chose to present it once via a Nyquist plot, then stuck with the magnitude plots which would clarify what we are talking about. It is also very welcome clarity to see that we are not using the weird dB unit in Bode plots.

For those who are not related to the field, what the reported subject here (and destabilizing effect of the negative feedback) is fixed by Black to remedy amp ringing, led to Bell labs, develop frequency domain techniques later analyzed by Nyquist and Bode (also seniors in Bell labs) then made western control theory kick off (then united with the Soviet techniques) and today everybody losing their mind about boosters coming back to base with SpaceX (which was already done a few times historically decades ago).

RossBencina 10/26/2024||
If you want an actual deep dive watch James K. Roberge's OCW course and/or get the book "Operational Amplifiers Theory and Practice".
buildsjets 10/26/2024||
But the ringing, sustained oscillations, and excessive gain are sometimes desired characteristics of a particular op-amp implementation.

https://youtu.be/SrS9EtfcANg?si=MwbtbuPWu85Tbjzq

ericwood 10/26/2024||
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 :)

kazinator 10/27/2024||
Motorboating feels like a strawman version of op-amp oscillation. It occurs because the tinkerers are using single supply circuits, without adequate bypassing to ensure that their virtual ground network has very low resistance. Thus the current dumped to ground by any circuit generates a voltage which appears to it and all the other circuits (ground loop). Another ingredient in motorboating is that there are multiple amplification circuits cascaded together which are coupled using capacitors (due to the single supply operation, again, which tends to discourage DC coupling). The ground loop creates a feedback path across multiple amplifiers, and the coupling capacitors create the phase shift.
ericwood 10/27/2024||
I'm not sure what you mean by "strawman version of op amp oscillation"; for many it's the colloquial term for oscillation. You can accomplish it very easily with many classic distortion circuits, especially on a breadboard. Guitar pedals are almost always run off a unipolar 9V supply. Large bypass caps are the normal (usually cargo culted over as a 100u at the input).

There's a lot of constraints that either remain due to the restrictive power supply requirements on top of tradition or people building off designs from the 90s that were hand assembled and took BOM golf to the next level.

kazinator 10/27/2024||
Motorboating is not a colloquial term for all oscillation. It's a very low frequency instability consisting of a train of pulses which, when played through a speaker, sound like an internal combustion engine with a short exhaust.

The op-amp oscillation the article is talking about occurs in the radio frequency range. Tiny parasitic capacitances induce 180° phase shift at some very high frequency where the op-amp's open loop gain has dropped to unity.

You can't hear this directly since it's not in the audio range. It brings about distortion. The amp may pass audio signal, but the oscillation prevents it from performing properly.

ericwood 10/27/2024||
In the contexts I was talking about (hobbyist DIY guitar pedal forums) motorboating is often used as a catch-all for many types of oscillation, probably because the symptoms you describe are a very common error. Sometimes you get lucky and can tune the resulting oscillator by turning the guitar's volume knob!

I wasn't trying to assert anything about the article, just responding to a comment about desired op amp imperfections in guitar effects. It's fairly common practice to bandwidth limit high gain op amp stages to avoid the issues discussed in the article, amongst other things.

analog31 10/26/2024||
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.
ggm 10/27/2024||
Did op amps on a uni CS degree in 79-82 and they never explained why. "Learn this" was an unhelpful approach where "these are building blocks which matter in digital communications, IO, control systems and signal processing" might have helped.

Same with numerical methods. Zero sense of why we had to learn, and I failed spectacularly.

Metacelsus 10/26/2024||
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 10/26/2024||
What an absolute goldmine of a website. So many varied topics. Just amazing.
082349872349872 10/26/2024|
to what degree does the Gartner hype cycle resemble the Gibbs phenomenon?
marcosdumay 10/26/2024|
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 10/26/2024||
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 10/26/2024||
> 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.