LM386 softer clipping

Started by Steben, September 22, 2021, 03:52:57 PM

Previous topic - Next topic

Vivek

Rob Strand had posted a clipper/ limiter system with diodes referenced to power supply.



This can be used to soften the output of a rail saturated LM386 (Or any other Rail saturated Opamp circuit), by adding one more knee close to each rail. For LM386, I suppose we will have to use inverting pin, Opamp style feedback as I had posted earlier.

I feel this might be an excellent idea for this purpose.


Steben

Quote from: Vivek on September 28, 2021, 03:49:09 AM
Rob Strand had posted a clipper/ limiter system with diodes referenced to power supply.



This can be used to soften the output of a rail saturated LM386 (Or any other Rail saturated Opamp circuit), by adding one more knee close to each rail. For LM386, I suppose we will have to use inverting pin, Opamp style feedback as I had posted earlier.

I feel this might be an excellent idea for this purpose.

Yes. And follows power sag.
  • SUPPORTER
Rules apply only for those who are not allowed to break them

Vivek

YES !!!!

Follows power sag !!!

I remember your idea to put a resistor in series with power supply going to Opamp, to get power sag in the traditional way

+ your comment that LM386 has variable current draw (especially if the load impedance is low)

Clint Eastwood

Here is my attempt:



And here the waveform it creates:




The waveform clips asymmetrically, because the spice simulation has the output dc voltage not halfway the supply, but at 5.2 volts.
you can get softer clipping by lowering the led voltage drop,  using pairs of one green and one red led, or two red leds.

PRR

Quote from: Clint Eastwood on February 05, 2022, 02:49:29 PM....the spice simulation has the output dc voltage not halfway the supply, but at 5.2 volts.

If you look at the internal circuit, that is probably correct. Asymmetric clipping hardly affects the perceived loudness of a pocket radio.

Has anybody tried running on 3V supply with <4 Ohm load? Marginally beyond spec? Not as a loudspeaker driver but as an in-line flavor box? The natural curvatures are in the few-tenths-Volt range, so may stand out more at few-volt than with 9V or 12V supply.
  • SUPPORTER

Clint Eastwood

More than a year ago I posted reply #43 here, but I cheered too early. It worked fine in my simulator, but in practice it oscillated badly. So I abandonded the topic, and then a while ago ended up rereading the thread. I found the idea posted by Vivek interesting, clipping diodes referenced to the power supply. I have come up with this practical circuit:



This time the circuit has been tried and tested, and it works very well. Normally, an LM386 amp sounds a bit too harsh to my ears when cranked up, with the diode clipping you can tame it. Changing the values of R7 and R9 will alter the moment when the clipping starts, higher values make the clipping start earlier. The ratio between R8 and R3/R6 affects the softness of the clipping.
Early clipping of course means you have less clean headroom, I think I will make a switch between C3 and -in so I can turn the diode clipping on/off. Or even a dual gang pot to substitute R7 and R9.
The value of C3 also shapes the sound, lower values mean less low frequencies are clipped. I have put a Jfet buffer in front, although I  am not convinced it is really necessary. Without it, I did not hear much difference. C2 and R1 determine the amount of bass that gets into the amp, it is important to pick the right value for C2 to get the sound you like. A good upgrade would be to make a variable bass cut.
I can really recommend tinkering with this idea, the sound possibilities with different component values are endless.
Any comments/improvements are very welcome of course!





Rob Strand

#46
QuoteMore than a year ago I posted reply #43 here, but I cheered too early. It worked fine in my simulator, but in practice it oscillated badly. So I abandonded the topic, and then a while ago ended up rereading the thread. I found the idea posted by Vivek interesting, clipping diodes referenced to the power supply. I have come up with this practical circuit:
The new config doesn't oscillate because the 10k + 470 ohm resistors set the gain to approx 20 and the LM386 is still stable with that gain.   Before it clips the gain is 200 and when it clips the gain drops so 20, so you get a gain switch type soft clipper.  The 10k + 33k sets the voltage where the knee is between the two gains.

The only thing that looks odd is the short on pins 1 and 8 as it will affect the DC bias at the output.  Normally you put a cap there.  For a distorter it might be OK.


It occurred to me later a large-ish cap between the LM386 output and the node where the 2x10k meet would help the clipper act symmetrically.  At the moment the DC offset from Vcc/2 at the output pushes the clipper to one side of clipping even with no signal.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Clint Eastwood

Hi Rob,

The datasheet shows closed loop gain should be at least 10 for stability, so R3 and R6 should be at least 10 times larger than R8.

About the capacitor between pin 1 and 8, it should be there to get half supply dc at the output. However, most LM386 guitar amp schematics  don't use a cap here, and the (deliberate?) result is asymmetrical clipping. And that sounds good to me actually.
But it is more elegant I guess to use the capacitor and get asymmetrical clipping by choosing differing values for R7 and R9. Also, that way you have a bit more clean headroom without the diode clipper.
Thank you for originally posting this idea!

Rob Strand

Upfront, I only mentioned those things because the LM386 has some slight quirks compared to the original circuit Vivek posted.  The slight lack of symmetry being the main one.

QuoteThe datasheet shows closed loop gain should be at least 10 for stability, so R3 and R6 should be at least 10 times larger than R8.
Yep, 10 would be a good target.  (One of the datasheets actually states the minimum stable gain.)

QuoteAbout the capacitor between pin 1 and 8, it should be there to get half supply dc at the output. However, most LM386 guitar amp schematics  don't use a cap here, and the (deliberate?) result is asymmetrical clipping. And that sounds good to me actually.
I suspect it started off by skimping parts and people found it sounded OK.   There's no rules for a distorter.

Despite what the datasheet implies when pins 1 and 8 are open (or you have a cap across them) the output doesn't quite bias at Vcc/2 anyway.  It's more like Vcc/2 + 0.7, a little above Vcc/2.  With pins 1 and 8 short the output biases at about Vcc/2 + 1.1V, so more offset.

QuoteBut it is more elegant I guess to use the capacitor and get asymmetrical clipping by choosing differing values for R7 and R9. Also, that way you have a bit more clean headroom without the diode clipper.
It's certainly possible.   I had a look at the effect of the bias offset on the soft-clipper thresholds with pins 1 and 8 shorted and it didn't shift them much.  So pins 1 and 8 is mainly affecting the overall LM386 behaviour.

FYI, it is possible to bias the LM386 at Vcc/2.   I don't think the trick is well known.  One method is a resistor from pin 1 to Vcc, perhaps around 180k.   Another is a resistor from pin 7 to ground, perhaps around 47k.     I prefer the second method but I didn't spend enough time on it to make a good judgement (and it's largely of academic interest.)   If you wanted deliberately adjust the asymmetry of the *LM386* then either of these ideas would work  - an adjustable scheme might favour the first method.

In the recent Ebow thread I made an LM386 spice model and played with the idea.  However, I know my spice model wasn't tuned to model the supply current vs Vcc or the PSRR.   I know what the problem is but need to spend time fixing it without breaking something.


You did well sticking with it by the way!
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

brett

Hi.  One of the 'problems' is that LM386 amps put out a LOT more power and have hard clipping when run from low-impedance power supplies. 

Consider that the LM386 can put out almost 1 W into 4 ohms when supplied with 9V and 0 ohms impedance. 

But if we supply it from an alkaline battery with (guessing) 10 ohms of internal resistance and there's double the resistance in the source as there is in the output. Instead of 2V of output into 4 ohms (1 W) there's barely 0.5 V into 4 ohms (0.25 W).  It only happens at full power. It's quite a lot of compression (and distortion, because it's clipping) of the output, and in my opinion, sounds really good.  (Valve amp guys would be right to think that valve-rectifiers gave 'sag', crunchy clipping and heaps of compression.  Same deal with a battery-powered LM386?).

I haven't powered my LM386 amp from an old zinc-carbon battery with high internal resistance, but I've slipped a 47 ohm resistor in the supply line.  It's so quiet that it's not a practical option. Flat out, the power will be about 0.05 W.  I have a nice valve amp that puts out just 0.2 W, but 0.05 is probably too low.  And it didn't break up in a particularly nice way.  On the other hand, a 4.7 ohm resistor cut a little power and seemed to partly 'do the trick' (very subjectively).  Pity I don't have a scope to see what's going on.

If I was set up to do it, I'd be interested to see how batteries response to intermittent loads.  Does their internal resistance stay low for a while, then rise?  So far, the battery 'simulators' designed by various people haven't attracted interest, because 1. they get used with pedals having high supply impedance (eg 10,000 ohms vs 8 ohms for an LM 386) where they clearly don't do anything and 2, they're mostly very simple (added resistance) so might not behave like batteries when used in high-current devices where batteries probably do have some effects.

Please excuse the long story.  A topic that's been on my mind for 20 years, where I've done just a little experimentation.
Brett Robinson
Let a hundred flowers bloom, let a hundred schools of thought contend. (Mao Zedong)

Rob Strand

QuoteIf I was set up to do it, I'd be interested to see how batteries response to intermittent loads.  Does their internal resistance stay low for a while, then rise?  So far, the battery 'simulators' designed by various people haven't attracted interest, because 1. they get used with pedals having high supply impedance (eg 10,000 ohms vs 8 ohms for an LM 386) where they clearly don't do anything and 2, they're mostly very simple (added resistance) so might not behave like batteries when used in high-current devices where batteries probably do have some effects.

The problem you mentioned is "normal" for power amplifiers but it is especially bad on 9V batteries.   Even large transformers sag to some extent.  I'm not fond using 9V for any high-power applications, they just aren't suited for it and the effective battery life is poor.   Alkalines help enormously.

A common trick for pulse loads with batteries is to put large caps across the supply rails.    This idea also works for squeezing the most battery life out of low-power applications - although for very low power applications the leakage of the cap can exceed the average drain of the circuit!     Some years back semiconductor manufacturers had applications notes showing pulse loads and the effect of adding supply caps.   IIRC for lithium button cells.

Here's one but there might be more,
https://www.ti.com/lit/wp/swra349/swra349.pdf

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

brett

Quote from: PRR on February 05, 2022, 03:59:00 PM
Has anybody tried running on 3V supply with <4 Ohm load? Marginally beyond spec? Not as a loudspeaker driver but as an in-line flavor box? The natural curvatures are in the few-tenths-Volt range, so may stand out more at few-volt than with 9V or 12V supply.

An alkaline battery has 5 to 25 ohms of internal resistance.  An LM386 only has a few ohms of emitter resistance and a 4 ohm speaker for a load.  So 4, 5 or even 6 volts of the supply might be lost when an LM386 is at max power when using a battery.

Again, I think this is part of the great tone of an LM386 driven hard, powered off a battery.  Louder, but not as great tone with a regulated power supply.

FWIW, for clipping, at the output I've added anti-parallel 1N4007 diodes to ground in series with an 8 ohm resistor. Works fine.
Brett Robinson
Let a hundred flowers bloom, let a hundred schools of thought contend. (Mao Zedong)

Clint Eastwood

I use a Nimh rechargeable battery, wich apparently has 1 or 2 ohms internal resistance. If i wanted to mimick the behaviour of an alkaline battery, is it enough to add a 10-20 ohm series resistor or is there more to it?

PRR

  • SUPPORTER

Rob Strand

#54
Quote from: Clint Eastwood on April 12, 2023, 08:06:23 AM
I use a Nimh rechargeable battery, wich apparently has 1 or 2 ohms internal resistance. If i wanted to mimick the behaviour of an alkaline battery, is it enough to add a 10-20 ohm series resistor or is there more to it?

The resistance varies over the life of the battery.   For a 9V alkaline it might start off around 1 to 5 ohm but as the battery is used the resistance increases.   Under normal circumstances the end-of-life resistance for a 9V alkaline might be 10 to 20 ohm.  There's no single figure but 7 ohm resistance would be something in the middle.   The common heavy duty zinc-carbon types have much a higher resistance when new.

You can do slightly better with this type of circuit but it's still an over simplification; ignore the inductor.   Where Rct+Ro is the DC resistance and Ro is the AC resistance.   The AC resistance might be say 1/7th the DC resistance.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

brett

Rob Strand said "For a 9V alkaline it might start off around 1 to 5 ohm but as the battery is used the resistance increases."

Thanks!  I had believed it was greater.  Hence with a 47 ohm series resistor I'd reduced the voltage and power to very low levels.   4.7 ohms was better, and now it's obvious why.  Next build will be a filter cap then 2.2 ohms. At 0.1 A, that's 2.2 V "thrown away".  Seems about right.
Brett Robinson
Let a hundred flowers bloom, let a hundred schools of thought contend. (Mao Zedong)

Rob Strand

Quote from: brett on April 13, 2023, 03:20:14 AM
Rob Strand said "For a 9V alkaline it might start off around 1 to 5 ohm but as the battery is used the resistance increases."

Thanks!  I had believed it was greater.  Hence with a 47 ohm series resistor I'd reduced the voltage and power to very low levels.   4.7 ohms was better, and now it's obvious why.  Next build will be a filter cap then 2.2 ohms. At 0.1 A, that's 2.2 V "thrown away".  Seems about right.

For alkaline 47 ohm is would be quite high.   However for new/newish batteries there's a lot of variation.  I wouldn't flinch much if I saw 10 ohm when new and 30 ohm at end of discharge which would make the middle in the 15 ohm to 20 ohm.  If you are driving an 8 ohm speaker the effect is quite a bit stronger than my 7 ohm.   In operation you might not get to 30 ohm which brings the actual "middle" down a bit.

The results can vary depending on the battery and how the test is done.   Different loads can imply a different battery resistance.   If you base your numbers on Rbat = (Vopen - Vloaded)/Iload  you might see a different Rbat for different loads.   Using the open circuit voltage can introduce quite a bit of variation.   Under load the voltage keeps changing so at what point do you make the measurement?   Another way to measure the DC resistance is incrementally using the voltage drop between two loads, one low current and one high current, then from that infer the (estimated) open circuit voltage and resistance.     They all give different numbers for Rbat, you might see a factor of 2 variation!
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

Here's some manufacturer's data and some real measurements:


The manufacturer gives an DC resistance plot and an AC resistance spec.  The DC resistance spans 2.2 ohm to 4.1 ohm over the discharge period.   The AC resistance is always less than the DC resistance.

The measured "new" batteries have somewhat higher DC resistance than the manufacturer's data.   The DC resistance was about 8.5 ohm and was quite consistent across three batteries.

The depleted battery has a DC resistance of 21 ohm and a lower open circuit voltage.

I've given the directly measured open circuit voltage and the estimated open circuit voltage based on fitting a line to two load currents.   The measured open circuit voltage tends to be higher then the estimated due to non-linear behaviour of the battery.

In reply #35 of this thread,
https://www.diystompboxes.com/smfforum/index.php?topic=76150
I did a similar study on an Energizer Alkaline battery.  Very similar results to my Duracell measurements.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Steben

#58
Well.... isn't this reproducable with a resistor in series to the supply line of non-battery regulated source?
It will introduce some sag due tot the variable current draw of the LM386.

But will it soften the clipping?

The datasheet gives quite a soft onset of distortion. I guess this with max gain setting. The min setting probably will yield an onset more abruptly as any bigger amount of negative feedback would?
  • SUPPORTER
Rules apply only for those who are not allowed to break them

mac

Maybe it's a lot of work and the schematics are incomplete,
but what about a kind of "Joe Davisson's Diode Compression Discrete LM386"?



Something like this ... ??



#2 can interfere with bias

mac
mac@mac-pc:~$ sudo apt-get install ECC83 EL84