Thursday, 29 October 2015

QRP WorkBench Line-in Audio Amplifier — Part 2

Welcome to Part 2

I share some experiments, plus a few thoughts & observations from my QRP workbench.

[A]  Some general points in AF design and breadboarding

[1] Expect your amplifiers to oscillate and design to mitigate this.

[2] Read your datasheet(s).

[3] As possible, identify the frequency of any parasitic oscillations by measurement. If you lack a 'scope, you can’t hear HF oscillations, but may hear their outcomes — or view their effects on DC measures like quiescent current.

[4] Going for high gain in a single stage may bring you pain.

[5] Build a homebrew, low noise AF signal generator with an amplitude control pot — if only for 1 frequency such as 1 KHz. Your sure to benefit from the experience designing for and soldering on op-amps.

[6] Test your AF boards before inserting them in a receiver.

[B]  AF + HF Decoupling and Bypassing

For this discussion, I placed an LM386 in high gain mode ( 46 dB power gain ) and measured the output signal across an 8 Ω load resistor.

To show what can happen if power supply Pin 6 is unbypassed; or inadequately decoupled and bypassed @ AF,  I left off the usual Pin 6  R-C low-pass filter network. Vs = 12.3 VDC.

Above — 144.6 Hertz oscillations erupt with no input signal applied by my signal generator.

Insufficient power supply filtering allows low frequency noise to make it from the output into the input via the DC power line where that feedback path contributes 180 degrees of phase shift to the 180 degrees provided by the inverting amplifier.  If the gain at the oscillation frequency >=1  you'll hear (and see with a 'scope ) AF parasitic oscillations.

The quiescent current of an LM386 powered by 12 VDC ran  5.6 - 6.2 mA in my Lab. I measured the current with the parasitic oscillations seen above and the quiescent current rose to 13.2 mA. A higher than expected quiescent current may signal parasitic AF - HF oscillations in an AF stage.

Above — I put a 1 KHz signal into that LF oscillating LM386 input.

Above — An FFT of above.  Looks and sounds nasty!  F0 = 1.015 KHz.

Above — A 470 µF AF bypass electrolytic capacitor was soldered to Pin 6, plus a 10 Ω decoupling resistor inserted between the power rail and Pin 6. Further, I AF bypassed the B+ rail with 100 µF.

Above — The averaged noise voltage at the LM386 output after adding the DC line low-pass filtration shown above. Parasitic audio oscillations killed dead!

Above — 3 different DC power line filtering R-C networks set up for analysis in a 50 Ω system. In our AF amplifiers, we need to worry about parasitic HF oscillations in addition to AF parasitics.

Above — A tracking generator plus spectrum analyzer sweep of Figure A.  The analyzer doesn't measure below 9 KHz and unfortunately doesn't assess the 470 µF capacitor. However, from other experiments and calculations, the 470 µF plus the 0.1 µF give a good wideband bypass for AF to HF.

The reference sweep is the red horizontal line above [ 0 dB attenuation of the signal ]. When inserted between the TG + SA, the 0.1 µF cap exerts it's ultimate attenuation of the signal at 5.8 MHz ( -44.3 dB = peak attenuation).

Above — TG + SA sweep of Figure B. Now we've got a classic pi filter with shunt capacitor(s) on each end separated by a 10 Ω resistor.  Peak attenuation = 8.04 MHz. Notice how the pi filter deepens the ultimate attenuation of the 0.1 µF and gives better RF bypass than just a single capacitor with no decoupling resistor.
This rings true for both RF and the AF bypass capacitors.

Above — TG + SA sweep of Figure C.  R now = 100 Ω. The peak attenuation occurs at ~12.1 MHz and has flattened out even more to provide better RF bypass across the span. This is why we decouple and bypass the DC lines in our RF projects too.

Above — To get better DC filtering @ HF in AF amplifiers, we ought to put a at least 1 HF bypass capacitor on our positive supply rail to make the classic pi filter. In Figure A, I've placed AF + HF bypass on both sides of the 10 Ω decoupling resistor. We're radio builders and don't want parasitic AF or RF flowing down our B+ lines and wreaking havoc in our AF or RF stages.

For op-amp DC power supply pin AF bypass, 22 µF works well in my Lab, however, you've got to find what works best from your own experiments.  

At Figure B, the 10 Ω resistor is shown as optional. Since the power followers draw significant current for speaker-level volume during signal peaks, the voltage drop across the 10 Ω resistor might reduce clean signal power a little. I tend to leave off the 10 Ω resistor and only include it if I measure AF instability that I can't fix by increasing the value of the C within reason.

I've encountered AF parasitic oscillations with a 100 to 220 µF bypass capacitor in my power amplifier stage designs that was stopped by going up to 470 µF — now I just stick 470 µF in as my default AF bypass capacitor and work from there. On my bench, at least, higher gain PA stages tend to oscillate more. I strive to keep the power gain of my PA stages <= 26 dB.

Choosing gain, cap and resistor values are decisions we designers must face during every build. Consider thinking critically and choosing carefully — don't just copy what another builder did, because that builder might have copied someone else and so on. Some times unmeasured 'minimal part' designs that seem attractive dole out maximum grief and ruin your bench experience. Bench time should foster fun and discovery.

Above — A JavaScript applet screen shot from my blog  You've go to decide what R and C values to use for AF bypass and to decouple your DC power lines. I tend to ply lower Rs and higher C's to minimize DC voltage drops to preserve headroom. From the example above, if you applied a 100 Ω resistor, then only a 47 µF capacitor is required for the same 3 dB down frequency.

Yes, our parts collection often dictates what choices we make, but if you're buying parts — a  470 µF/25v capacitor often costs just pennies more than a 47 µF/25v capacitor — especially with low-cost parts offered by on-line stores and auctions.

[C] HF Oscillations 

Above — Intense HF oscillations from a 5532 op-amp circuit. I collected this and the other images over the past 2 years.

Above —  I didn't think this was possible — 10 MHz oscillations in an op-amp + power follower AF stage. The stage quiescent current measured ~ 65 mA just from these parasitic oscillations.

Above —HF oscillations in a LM4562 based op-amp tone circuit driven with a 1 KHz AF tone from my 1 of my homebrew audio signal generators.

Above — Techniques to remove HF oscillations. Decoupling and bypassing at HF previously discussed in Section [B]

Figure A — The input of any AF chain, or IC like the LM386 should contain RF bypass to ground. You might also choose that capacitor's value to shunt some of the higher frequency noise and signal to ground like a low-pass filter.

The output of the LM386, like most power amps, contains the familiar R-C ( Zobel ) network connected in parallel with the speaker voice coil. I recommend adding this to all PA output stages.

Since a speaker load presents a complex impedance, placing the Zobel network in parallel with the voice coil keeps the amplifier happy since it's a purely resistive load.  The resistive load boosts the PA's stability and in some high power, more sophisticated IC power amps, helps to eliminate negative voltages that could harm the PA.

Figure B — In high gain feedback amplifiers, it does not take much time delay, or phase lag to trigger high frequency oscillations near the upper end of the op-amp's bandwidth.  I've noticed 2 cases where this is more likely to occur: in op-amp driven PA stages, and also in some tone control circuits. I applied 20 pF for Cx in the tone circuitry applied in my line-in AF amp from Part 1 of this blog posting.

Figure C —  Similar to what's shown in Figure B; a small value feedback capacitor Cx lowers the closed loop bandwidth so there's insufficient gain at high frequencies for oscillation to occur. As aforementioned, in some stages you might create a frequency dependent situation where the total phase shift in the feedback loop exceeds 360 degrees and has gain larger than 1 which = unwanted oscillations.  Feedback capacitor Cy lowers the op-amps upper cutoff audio frequency, and as an added benefit, its noise bandwidth.

In typical complimentary emitter follower power amplifiers, this works well. An example = Figure 9.74 by Rick, KK7B shown in EMRFD. In my particular PA from QRP WorkBench Line-in Audio Amplifier — Part 1, too high a cap value will actually trigger HF oscillations.

[D] Environmental Noise

Noise sources may affect your measures. To conserve energy, I purchased an LED light bulb for my new workbench. I knew these things used switched drivers, but wanted to 'go green'. Bad mistake. I'll show you some cool DSO traces measured during some AF design work.

Above — I went to measure the noise voltage across an 8 Ω resistive output load of a PA with no input signal, plus a 470 Ω shunt resistor across the input. I could not figure out why my stage measured so crazy noisy!

Above — With some DSO averaging, this signal looked like my noise was modulated by a regular occurring oscillation of unknown cause.

Above — Finally, it occurred to me: it's probably the LED lamp above your work. I switched the LED bulb off and instantly the modulated noise stopped. Yikes!  I gave the bulb to a friend who lives across town.

Above — The LED bulb modulating an HF oscillating LM4562 op-amp circuit.

Above — That wretched LED bulb even modulated a low-level UHF circuit.  It's gone for good.

[E] LM386 Musings

Let's unpack the LM386 a little. It's a great design that finally went end-of-life this year. Over the years of web publishing AF stuff, this humble part provided me with many emails and many wanted to use it at 46 dB gain to eliminate the need to make a preamplifier — or as a space saver so they could stuff their entire project into a mint tin.

If you manage to build a high-gain mode LM386 AF amp without hum and parasitic oscillations, you may notice it gives some crunchy harmonic distortion when driven anywhere towards loud. My question = why?

I performed a ton of experiments and saved over 50 files. The tough part was writing something that made sense and stuck to the measures and facts. When we don't know facts, or information based on reliable measures and data, we often just get opinions : they're free on the Internet.

LM386 with Power Gain = 46 dB      "High gain mode"

Above — The best 2nd harmonic distortion possible even when driven to only 11.8 mW. In high gain mode, the harmonics do not clean up at low drive levels like other AF PA circuits I've tested.

Above — I drove this particular LM386 to 2 Vpp and 6.82 Vpp and we'll use those 2 voltages  to compare this to the chip with 26 dB gain (low gain mode). At 6.82 Vpp (or 727 mW) the sine wave starts to show obvious distortion, so I chose this as a benchmark since many builders don't have access to FFT.  The load = an 8 Ω resistor bank.

Above — Sine wave in time domain driven to 6.82 Vpp. I can just see the positive tip starting to distort. It's easier to do this live by bringing the waveform in and out of distortion repeatedly. From practice, I can usually see sine wave distortion when the 2nd harmonic lies >= -44 dBc — and especially when the 3rd harmonic moves towards this level.

Above —The FFT of the above sine wave. The third harmonic lies about -43 dBc.

LM386 with Power Gain = 26 dB

I set that LM386 to minimum gain mode by removing the capacitor between Pin 1 and 8. Lets see how it compares to the above measures @ 2 and 6.82 Vpp.

Above — The FFT when driven to 2 Vpp. Compared to the high gain mode, the 2nd and 3rd harmonics are ~ 7 dB and 5 dB lower respectively.

Above — The FFT driven to 6.83 Vpp. Compared to the high gain mode, the 2nd and 3rd harmonics are about 3 dB and 6 dB lower respectively.

From these 4 FFTs, I can't see why I seem to hear more distortion in the high gain mode version since the 2nd-3rd harmonic differences are <= 7 dB. Or, maybe that's enough of a difference to hear?

Perhaps it's just easier to overdrive a high gain LM386 in real life receiver testing? Consider to, I don't run AGC in my receivers, so my louder RF signals do sound louder. I'm pretty certain the distortion doesn't occur in my receiver front end, since I've heard it on peaks with attenuators switched in — and also in my high performance front-ends, plus non-radio projects.

Finally, here's an old experiment that makes no direct comparisons to any other LM386 configurations.

Above an  LM386 schematic and its FFT:  If I do run an LM386 AF PA in a receiver, I build a low noise (preferably op-amp) preamplifier and drive the LM386 in the so-called bass boost configuration as shown in the schematic just above the FFT.

An R-C network provides negative feedback from the output to the emitter of the input PNP transistor via Pin 1. I've noticed that in this particular configuration, as you lower the drive level, the harmonics clean up ( unlike what happens in the high gain mode and much better than in plain low gain mode ). In the above FFT, please view that all harmonics are 60 dBc down @ (and below) 235 mW output power.

I also bypass the point between the two 15K emitter resistors of the grounded PNP of differential pair @ Pin 7. This bypasses any DC line noise/ripple to ground.

Wait.  Now I'm getting it.  I don't just prefer the LM386 in low gain mode; I also prefer it with negative feedback. Good old negative feedback!

I'll let you draw your own conclusions about how and when to employ the venerable LM386. 

OK, enough ranting  — back to the bench!

Click for Part 1.


  1. Hi Vasily,
    nice work,are you test it on pcb?

  2. Hi Kostas ---- and thanks for your comment. I built everything with a bare copper board using Ugly Construction. 'Ugly' is all I use.. Best regards!

  3. I see Vasily,
    there are a distance between component data sheets as basic principles concern the schematic.
    Your experimentations the schematics above [B] AF + HF Decoupling and Bypassing proof those
    imperfect designer schematics.
    Waiting to complete all your tests at this points.
    Thanks for your time.

  4. Thank you for the info on decoupling & bypassing. I tried the ideas out on an LM386 amp I was having trouble with, even though it had some decoupling---it now works great!

  5. Vasily, I pity you, you are reading my mind. You have read the N6QW blog? I asked these questions there, and WOW!! you answered better than I had hoped for. THANK YOU!! I am much smarter now...

  6. V - I really appreciate that after all these years building and posting about audio amps, you still describe the art and science of decoupling and bypassing in detail. Few do this. Thank you - great stuff!


  7. What is this diagram software you have used to create these logic gate diagrams ?


  8. I have just visited your website and I found it very informative and useful for readers.Thanks for sharing and please keep updating with your views.

    Micro Filtration | Ultra Filtration