Electronic – Voltage spikes in triangular waveform generator circuit using LM324 op amp

analogoperational-amplifieroscillatorwaveform

I recently made a triangular waveform generator circuit using LM324 op amp. But the output of the generator had some sort of periodic spikes in it. However I was able to suppress the spikes by lowering the load resistor (<=1Kohm, 680ohm completely killed the spikes). What can be the reason for that? My first guess was that there may be a pole somewhere in the feedback loop due to parasitic impedance and the lower load resistor has compensated for that.

I tried the same circuit using TL084 op amp which has JFET inputs. This time the spikes were never there even when the load resistor was not connected! So if there was a pole in the feedback loop, then the spikes should have appeared in this circuit also. I am wondering what can be the REAL cause for the spikes and how did the load resistor kill it? I really appreciate some help from someone with an experience in this field.

Note: I used a solder-less breadboard for constructing the circuit

Schematic:

schematic

simulate this circuit – Schematic created using CircuitLab

Waveform (LM324)
enter image description here

Waveform (TL084):
enter image description here

Best Answer

This is a great example of why the various physical limitations of different op amps need to be considered.

You're correct, it is not a pole. In fact, it's got nothing to do with the circuit itself, or hidden parasitics or anything like that.

There is a huge and vital clue hiding in plain sight. The spikes happen with the LM324. They do not with the TL084. There is your answer, right there. The cause is something to do with the LM324 itself. But what does the TL084 have that the LM324 doesn't?

Speed.

Or more specifically, slew rate. That is how many volts per microsecond (or whatever measure of time you'd prefer) the op amp can slew or wiggle its output, regardless of all other considerations. This is distinct from phase shift. I like to think of phase as a delay that gets introduced, it's sort of like reaction time, but the op amp is still able to faithfully recreate the input signal on it's output (or whatever the op amp is configured to be doing), even if it might not be quite in phase with the input.

Slew rate is not that. Slew rate isn't speed in terms of delay or reaction time. It's about how fast the signal itself is actually changing. If the input signal changes so fast that recreating the amplified signal on the output would exceed that op amp's slew rate... it's not going to work. The op amp just can't move that fast.

What you're seeing in this specific case is switching noise from the first LM324's square wave. Look at the triangle wave as well as the square wave on your oscilloscope, and you should see the spikes

There are op amps that can slew several thousand volts per microsecond. For these very fast and slewy op-amps...well, their business is wiggling. And business is good.

Then there are op amps that can't even manage an entire volt in a microsecond. Op amps like the LM324. It has a slew rate of just 0.5V/µs. To put it bluntly, it's slower than a sloth on ketamine.

Because it's so slow, in your circuit, it isn't able to react quickly enough.

Clear as mud, right? Let me break it down a little.

Story time!

I apologize in advance, but I am going to personify op amps because, frankly, no one told me not to.

Let's ignore the the LM324 generating the square wave, it isn't really a significant player in this phenomenon. It is enough to simply keep in mind that the first LM324 is just there to create as close to a square-ish wave as it can, which drives the triangle wave from the second, spikier LM324.

Now, our second LM324 is configured as a low pass filter, which can also be viewed as an integrator.

For the first part of our square wave, it is low, below ground. It's at the plateau region, and our LM324 integrator is happily charging capacitor C1 through R3. The current is a constant Vin_low/R3, and the op amp's output increases linearly as the capacitor is charged. This is what we want, this is what is generating that nicely shaped triangle wave we built the circuit to produce.

Suddenly however, something disastrous occurs for our poor little op amp. The input, with next to no warning, has suddenly shifted from Vin_low (let's call it -1V) to Vin_high, which is +1V! The input has completely reversed polarity, and fast! Far too fast for this tortoise-like op amp to ever hope to keep up with.

Slew rate essentially exposes an op amp's non-zero output resistance. This goes up with higher frequencies, which results in a loss of gain, until you actually demand the op amp slew as fast as it can, and now it's output acts like a resistive, linear region one. It's trying to force its output as fast as it's little transistors can manage.

So what we now have is all that charge that our LM324 spent the entire low cycle of the the square wave shoving into the capacitor, with the new, opposite polarity voltage impressed on that same capacitor. The output has not changed fast enough, so we get a current pulse that couples back through the capacitor to the input.

You can view it as artificially forcing the 'ground' at the output, or just as a current pulse making the input overshoot, and causing the output to spike. It's a very typical problem in slew-rate limited integrators like this.

Now, the load resistor isn't actually eliminating the spike, but once it is low enough that it dominates whatever current that normally would need to rely on the op amp's output resistance (which is at its highest when slew-rate limited), then the magnitude of the spike will be reduced further and further until it is as good as gone. It can flow through the load resistor and be less effected by the output impedance/resistance of the op amp.

The TL084 works without any load resistor at all because it's impedance is still quite low even at those fast rise and fall times of the 'square' wave input. It gladly takes the square wave switcheroo being given in stride, while it simply confuses and frightens the poor LM324.

We can tell this is what is happening by looking at the actual location of where the spikes are occurring. See how they aren't perfectly aligned with the triangle peaks and valleys (which are also the square wave zero crossing points)? The spikes occur slightly after that. I smell capacitor shenanigans.

capacitor shenanigans

Yep. You can confirm all of this by measuring the current through C1, then watching how that impacts the input voltage right after R3. Overlay your spiking triangle wave, and I am confident you'll be able to empirically put this mystery to rest!

I did my best to explain, but its not so easy. For a more text-book like explanation, check out "page" 6.180 of Signal Amplifiers by Walt Jung.

TLDR: Sloths are slow, especially on ketamine.