DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: Lino22 on December 16, 2022, 03:55:57 AM

Title: LM386 headphone amp, i need to lower gain
Post by: Lino22 on December 16, 2022, 03:55:57 AM
Hi guys, i built this LM386 based headphone amp

(https://i.postimg.cc/YLS7gtLr/WEB.png) (https://postimg.cc/YLS7gtLr)

Now it has gain about 20, which is way too much for my needs. I added the 10k input voltage divider, but it really works just at the end of the path, where the part to ground is about 300 ohms.

My question is: is there any other way i could lower gain apart from shunting the signal down through 300 ohms?
There is an unofficial way to make the gain a bit lower, using the pins 1 and 8, but the official LM386 data sheet talks just about making it higher.

Title: Re: LM386 headphone amp, i need to lower gain
Post by: anotherjim on December 16, 2022, 05:26:26 AM
I would add a resistor in series with the output to the phones.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Vivek on December 16, 2022, 05:45:03 AM
The input impedance of the LM386 is about 50K ohms

It will interfere with the volume pot, changing its taper

A) just to make sure, did you use a log taper Audio volume control ?

B) Try adding 50k or 100K or 200K resistance in series, in between pot wiper and pin 3. That would act like a fixed voltage divider reducing the signal hoing into the LM386, and it would increase the impedance seen by the wiper, allowing it to better follow its taper.

C) In one application where I needed to control the volume of a LM386, I used 5K log pot . This was to ensure that 50K input impedance of LM386 does not have too much of effect on the taper


I am not for adding resistance in series with the headphone, since that changes the damping factor. I would rather try all kinds of tricks to reduce the input seen by pin 3
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Vivek on December 16, 2022, 05:54:26 AM
I dont know enough of the internals of the LM386

Maybe this works to reduce gain of the LM386

Idea being to feed part of signal to - pin as well as + pin

(https://i.postimg.cc/SxPxZCCw/lm386.png) (https://postimg.cc/3kghNyLB)
Title: Re: LM386 headphone amp, i need to lower gain
Post by: antonis on December 16, 2022, 06:42:18 AM
If you want to reduce GAIN (not input signal amplitude..), place a resistor across pins 1 & 5..
(preferably in series with a DC blocking cap..)
Gain should be calculated according to schematic formula, where Rf should be the parallel equivalent of 15k and shunt resistor..
(by placing a pot, wired as variable resistor, across pins 1 & 5 you could lower the gain down to unity - but gains lower than 9 aren't advisable 'cause LM386 might be unstable for such low gains..)

(https://i.imgur.com/R9Mz0Vq.png)
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Lino22 on December 16, 2022, 06:52:11 AM
Thank you guys. Here is the whole circuit.


(https://i.postimg.cc/2L185sqq/navrh-zesilovace.png) (https://postimg.cc/2L185sqq)

It is a charge amp that has a headphone output.

I used a log 100k for the volume pot, but it really feels more log than what i would expect, is that the 10k trimpot that  adds its resistance between the wiper and ground?
And there is a weird crackling noise right before it gets to the maximum volume.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: antonis on December 16, 2022, 07:03:04 AM
C5 and LM386 input cap polarities fight each other at various pots settings.. :icon_wink:

P.S.
10k pot severely dominates VR3 effective value and taper...
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Vivek on December 16, 2022, 07:06:45 AM
Looks like the 10k is a trimmer, meant to adjust gain of headphone section (set and forget)

And then volume is controlled by 100k pot



But 10k trimmer is too small and will alter the taper of the 100k volume pot.

Not very smart design
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Lino22 on December 16, 2022, 07:12:11 AM
Quote from: antonis on December 16, 2022, 07:03:04 AM
C5 and LM386 input cap polarities fight each other at various pots settings.. :icon_wink:

P.S.
10k pot severely dominates VR3 effective value and taper...

Is there any way to sort out the cap problem?
I will try to change the trimpot to 100k, or even 250k. That with 100k linear volume pot should create about 50k log volume pot. Maybe i can leave it out completely and add just the resistor across 1 and 5? Or just a 100k resistor on the input pin 3?
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Lino22 on December 16, 2022, 07:18:16 AM
Quote from: Vivek on December 16, 2022, 07:06:45 AM
Looks like the 10k is a trimmer, meant to adjust gain of headphone section (set and forget)

And then volume is controlled by 100k pot



But 10k trimmer is too small and will alter the taper of the 100k volume pot.

Not very smart design

Vivek i am sorry, i should have posted the whole circuit. It is not very smart, i agree :(
Title: Re: LM386 headphone amp, i need to lower gain
Post by: anotherjim on December 16, 2022, 07:43:48 AM
Are the headphones too loud or is the 386 distorting too easily (probably both)? If they are simply too loud, just add a resistor in series with the phones output - that's what commercial products do and it's a safe way to do it too. => 100R. The amp output cap value can then be smaller. If max volume is ok but it still distorts too easily, place a series resistor in the feed to the phones volume pot lug 3. It's going to => 10k.

10kA pot is a good match for the 386 input. Ideally, you would use a 4k7A or 5kA pot but the 50k input of the 386 doesn't change the log taper of the 10k too much in practice and 10k pot keeps the input impedance closer to the expected 10k load for line audio.

The 386 inputs are ground-friendly, you don't need an input coupling cap unless you want to cut bass to the phones in which case the cap will be =<1uF.

Why have the headphone vol dependent on the amp volume? You can take the feed from vol lug 3. Also, the load of the 386 input won't affect the amp vol pot taper this way.

Title: Re: LM386 headphone amp, i need to lower gain
Post by: antonis on December 16, 2022, 07:53:59 AM
Quote from: Lino22 on December 16, 2022, 07:12:11 AM
Maybe i can leave it out completely and add just the resistor across 1 and 5? Or just a 100k resistor on the input pin 3?

I'd experiment with both mods simulataneously..

Make VR3 10k, delete LM386 input cap, place a resistor across pins 1 & 5 and place a trimmer in place of 10k (its value should depend on desirable signal attenuation 'cause it should form a voltage divider with 50k internal resistor between pins 3 & 4)..

Title: Re: LM386 headphone amp, i need to lower gain
Post by: PRR on December 16, 2022, 01:33:09 PM

(https://i.postimg.cc/RWztB746/lino22-HPamp.gif) (https://postimg.cc/RWztB746)
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Lino22 on December 16, 2022, 03:29:17 PM
Paul, thank you. Thank you everybody, it is working the way it is supposed to, ha ha. I didn't realize how much those 47R on the output help because of the high current through the headphones (right?). The 100-500k before the 100k trimpot wasn't even necessary. I rewired it as Paul suggested and the volume works like a charm. I omitted the 100n cap for now.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: PRR on December 16, 2022, 10:26:39 PM
Quote from: Lino22 on December 16, 2022, 03:29:17 PM...I omitted the 100n cap for now.

You are right; that was pointless.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Vivek on December 17, 2022, 02:57:27 AM
47 Ohms in series with headphones can alter the bass response

It changes the damping factor

It changes the resistance that the reverse current created by the headphone sees

Way to test : Play a bass note and suddenly stop the note, See if some sound still lingers on in the headphone.

If you cannot hear the difference, I suppose it does not matter. Im sure some will hear the difference.


Quote
Damping Factor (DF) is the amplifier's ability to control speaker motion once a signal has stopped. Technically speaking, Damping Factor is the ratio of nominal loudspeaker impedance (the impedance the loudspeaker is rated at) to total output impedance of the system driving the loudspeaker, including the amplifier and cables.

Damping Factor changes with frequency (as does impedance) and is most noticeable at lower frequencies. A high DF typically results in a tighter, more controlled bass, which is usually (but not always) more desirable from a listener's point-of-view. Low DF results in soft or fat bass.

-https://ca.kef.com/blogs/news/damping-factor-explained


https://www.aes.org/aeshc/pdf/how.the.aes.began/preisman_loudspeaker-damping.pdf
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Lino22 on December 17, 2022, 05:12:49 AM
I didn't know that. Thank you Vivek.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: PRR on December 17, 2022, 10:42:44 AM
Quote from: Vivek on December 17, 2022, 02:57:27 AM
47 Ohms in series with headphones can alter the bass response

I worried about this, like 20 years ago.

I had 300r phones with a 600r peak. Driving them with 680r made a small difference. 33r made no difference at all. (And I was using these for monitoring live recording quality.)

I tested lots of "Walkman/iPod" phones and buds around 28-42 Ohms. None of them showed even 10% rise at resonance. A few showed 10% rise at the top of the audio band. 27 Ohms series made no audible difference on any. (Except a lot of them overloaded easy and some series resistance delayed that to higher applied voltage.)

Since Lino was saying "too loud", I 'erred' on the side of less level even if less "accurate" (no headphones are that accurate anyway).

Anyway all musical speakers have more or less resonances, some quite spectacular in a sine-sweep, and musicians play around that.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: anotherjim on December 17, 2022, 11:07:46 AM
I would not worry about the resistor upsetting the response. Many amplifiers add phones to the main speaker output with a switched jack that inserts resistors to cut the level in the phones.
There is also a concern for the safety of a person's ears. You could limit the gain/input level all you like, but what about power on/off pop or fault? The attenuation after the amp will cut that too.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Rob Strand on December 17, 2022, 03:56:46 PM
I've got similar comments to Jim and PRR.

Many years ago I measured the impedance of a lot of headphones.  Mostly reasonable quality and the response variations were minimal and often at quite low frequencies.    In more recent times, say 10 to 15 years ago  ;D, I checked some ear buds and the impedance was surprisingly flat, what I saw was peaking in the higher frequencies - that's because ear buds are strongly coupled to your ear canal.   In short I wouldn't flinch at 33 to 47 ohm series resistance.

You will always find counter examples.  If you see strong impedance peaks around 100Hz the headphones probably aren't that great anyway and any bass boost from the impedance is probably a help  :icon_mrgreen:

The international standard for headphone amplifiers is actually 120 ohm however for low voltage power supplies this tends to be too high, too much loss of swing.

The case for adding the resistor is this:
- prevents very high volumes when you plug in low impedance headphones.
- evens out the level when you plug in different impedance headphones (very handy).
- allows a smaller output cap without losing bass response.
  If you have no resistor and a smallish output cap you will get loss of bass on low impedance headphones.
- for opamp based headphone amplifiers it prevents the opamps cooking with low impedance headphones.

By low impedance I mean 32 ohms or less.

Title: Re: LM386 headphone amp, i need to lower gain
Post by: amptramp on December 18, 2022, 12:01:24 PM
If you put a resistor in series with the output, do you want the Zobel network to be on the amp side or the speaker side?  It is there to counteract the rise in impedance of the speaker / earphone at high frequencies and its effect on the feedback loop and it is quite the load on the amp at high frequencies.  It may not be necessary with a series resistor since the load is isolated somewhat from the output and the feedback path.  At the very least, it should be recalculated for its intended use.  You may find lower power consumption with the change to the 47 nF + 10 ohm network.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Dormammu on December 18, 2022, 02:09:06 PM
amptramp
In this particular case - I think this whole impedance mumba-jumbo thing doesn't matter. It's just performance control, not audiophilliac  puzzles.    ;)
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Rob Strand on December 18, 2022, 04:23:21 PM
QuoteIf you put a resistor in series with the output, do you want the Zobel network to be on the amp side or the speaker side?  It is there to counteract the rise in impedance of the speaker / earphone at high frequencies and its effect on the feedback loop and it is quite the load on the amp at high frequencies.  It may not be necessary with a series resistor since the load is isolated somewhat from the output and the feedback path.  At the very least, it should be recalculated for its intended use.  You may find lower power consumption with the change to the 47 nF + 10 ohm network.
It's a valid point.

Treating the LM386 as a black box (ie. unknown innards) it would be best to keep the Zobel on the output of the LM386.   The bonus here is it will probably help damp parasitic oscillations.   The series resistor just makes the load look nice and resistive but the everything is still happy with the Zobel on the LM386 output.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: PRR on December 18, 2022, 06:11:56 PM
Quote from: Rob Strand on December 17, 2022, 03:56:46 PM...The international standard for headphone amplifiers is actually 120 ohm however ....

I believe that is a "testing" standard. Like testing speakers on an open baffle. It is reproducable, that's all.

Although it may be a fair approximation of 150r/200r broadcast console line amps. (Even if they are "zero-Z", you like some series resistance to protect against goofy or shorted loads.)

And IIRC the 120r standard came before the Sony Walkman and universal use of low-Z phones/buds.

Mr Sony was not stupid. He may have deliberately designed to tolerate various sources and to be a design that other makers would tend to copy (not fragment the market).
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Rob Strand on December 18, 2022, 06:32:14 PM
QuoteI believe that is a "testing" standard. Like testing speakers on an open baffle. It is reproducable, that's all.
Form what I remember it originated as a recommendation for headphone amplifiers   I'm fairly certain about that because the standard also specified maximum voltage levels.   The main intent was to stop excessive output levels on low impedance headphones.

If you consider headphones ranging from 16 ohm to 600ohm then the geometric mean impedance is sqrt(16 * 600) = 98 ohm.   If you consider the ranges as 32 ohm to 600ohm the geometric mean is sqrt(32*600) = 138 ohm.  All in the 120 ohm ball-park.  The significance of the geometric mean impedance is an amplifier with that source impedance will have the least variation in power when *different* impedances are plugged into the output.
[EDIT: 
The standard actually states:
This output is designed to produce, as far as possible, a constant sound pressure level in the
headphones for a given setting of the volume control, irrespective of the impedance of the
headphones over the range 8 ohm to 2000 ohm.


Note that geometric impedance = sqrt(8*2000) = 126 ohm
]

Because these standards have some degree of harmonization it's likely the resistance value spills over to the test standards.

Speaker designers tend to allow for some degree of cable impedance when they consider the damping of the bass response.

I'm not aware of ever reading what allowance headphone designers make for amplifier impedance in the *design*.   (Presenting test results is a different matter.)

Something I've noticed about the IEC *Audio* standards in general is they are not mandatory.   In many instances you can use a different test configuration to their recommendations.  In this case the standards only say all you need to do is document this configuration in the test results!  Crazy stuff for a standard.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Rob Strand on December 18, 2022, 06:43:14 PM
Here you go,

The standard is about audio interfaces
IEC 61938 from 1996
https://store.standards.org.au/product/iec-61938-2018

It is referenced on this page,
https://nwavguy.blogspot.com/2011/02/headphone-amp-impedance.html

Here's an extract from the posts at the bottom,

FWIW, John Woodgate is involved in some of these Audio standards.  I used to post with him on the old
usenet groups sci.electronics.design.  He's a smart dude with a lot of experience.
http://www.woodjohn.uk/

"
http://gilmore2.chem.northwestern.edu/faqs.htm

Is an amplifier's damping factor important to headphone performance?
With loudspeakers, the lower the amplifier's output impedance, the higher the damping factor into the rated load. Damping factor is given as the ratio of loudspeaker impedance to the amplifier's output impedance. As the theory goes, the higher the damping factor, the better the amplifier's ability to control a loudspeaker's low frequency response (when the motional reactance of the system is at maximum), because the low output impedance of the amplifier allows any back-emf generated by the loudspeaker to be absorbed by the amplifier. That theory has been discharged by members of the audio community as unsubstantiated.
However, even if the theory were correct for loudspeakers, its applicability to headphones is suspect. John Woodgate, a contributor to The Loudspeaker and Headphone Handbook (1988), had the following to say about the effect of damping factor on headphone performance:

Headphone transducers are resistance-controlled, not mass-controlled like loudspeaker drivers above the main resonance. In any case 'damping factor' is largely nonsense - most of the resistance in the circuit is the voice-coil resistance and reducing the amplifier source impedance to infinitesimal proportions has an exactly corresponding effect on damping - infinitesimal.

However, the source impedance affects the *frequency response* of a loudspeaker because the motional impedance varies with frequency, and thus so does the voltage drop across the source impedance. This means that the source impedance (including the cable) should be less than about one-twentieth (not one two-hundredth or less!) of the rated impedance of the loudspeaker, to give a *worst-possible change* in frequency response from true voltage-drive of 0.5 dB.

The motional impedance of headphone transducers varies very little (or should vary very little - someone can always do it wrong!) with frequency, so the source impedance can be high with no ill effect.

The IEC 61938 international standard specifies that headphones should be driven by a 120 ohm source - regardless of the impedance of the headphones themselves. If the headphones were designed to this standard, then an amplifier's high output impedance should have little effect on the sound of the headphones. In general, headphones with a flat impedance curve over the audio range will not be affected by high output impedance. For example, in May 1995, Stereo Review published a review of the Grado SR125 headphones. The impedance curve of the SR125s, which have a nominal impedance of 32 ohms, varied from 31 to 36 ohms over the entire 20Hz to 20kHz spectrum. Not all headphones may be as well behaved as the Grados, but neither do they usually have the roller-coaster impedance runs of a loudspeaker. Tube amplifiers (with their high output impedances), it should be noted, have very low damping factors."
Title: Re: LM386 headphone amp, i need to lower gain
Post by: PRR on December 19, 2022, 12:07:55 AM
I sit in awe of your superior library.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Rob Strand on December 19, 2022, 12:28:07 AM
It's something I've worked on in the past.  I remembered John Woodgate wrote some stuff on it and I was just lucky to get a hit on his name.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Vivek on December 19, 2022, 04:00:37 AM
Rob, your research is phenomenal !

Respects !
Title: Re: LM386 headphone amp, i need to lower gain
Post by: amptramp on December 19, 2022, 07:18:27 AM
This source:

https://audioxpress.com/article/voice-coil-lab-notes-improved-zobel-network

implies that the resistor in a Zobel network for a speaker is 1.25 times the voice coil resistance and this would include any series resistor you add and the value for C would be the part of the inductance of the load that is not shunted by any other resistance divided by the square of the Zobel resistor.  This would give much higher values for the Zobel resistor and lower values for the Zobel capacitor.  This would in turn result in much lower power consumption from the amplifier.  This assumes the Zobel network is connected to the amplifier output rather than the speaker.  You would have to determine the inductance of the headphones to select the proper capacitor value.

If you all remember the General Electric Transistor Manual, they designed a number of amps and always used 100 nF and 10 ohms as the Zobel network regardless of any other amp characteristic.  This may be OK where you have an amplifier that has to be used with any 8-ohm speaker they decide to drive with it, but for the case of a headphone amplifier, the 47 nF / 10 ohm values hog way too much output power.  If you are operating from a battery, Zobel network dissipation is the major power requirement and with the correct network, you could extend battery life dramatically and reduce dissipation in the LM386.

Title: Re: LM386 headphone amp, i need to lower gain
Post by: PRR on December 19, 2022, 11:32:03 AM
> the 47 nF / 10 ohm values hog way too much output power.

Only above 159kHz !?? A simple low-pass in front should take RF way down. A 50kHz low-pass is traditional and almost essential(*) in guitar amplification.

And the article seems to focus on flattening loudspeaker impedance. The 0.1u/10r on the NatSemi notes is about swamping load inductance so it does not reflect-in as capacitance to the NFB amplifier's core and spoil the stability.

(*) you "don't need it" until you play a truck stop or around police/taxi or AM broadcast transmitters; then you NEED it.
Title: Re: LM386 headphone amp, i need to lower gain
Post by: anotherjim on December 19, 2022, 01:39:12 PM
(https://i.postimg.cc/rss55hTf/alto-s-12-mixer-phones.png)
I don't think I've seen a Zobel on this kind of phones output but this is just a snippet of the first thing I grabbed from my device. So I'm not saying it's never done to fit a Zobel. Anyway. +/-15v rails on this and the unfamiliar (to me) BA15218 is yet another "audio" dual opamp.

If you want to read the rather sparse datasheet.
https://datasheet.octopart.com/BA15218-Rohm-datasheet-14139886.pdf
Title: Re: LM386 headphone amp, i need to lower gain
Post by: Rob Strand on December 19, 2022, 03:53:23 PM
QuoteI don't think I've seen a Zobel on this kind of phones output but this is just a snippet of the first thing I grabbed from my device. So I'm not saying it's never done to fit a Zobel.

There's differences between the opamp case and the power amp case.   It's all to do with feedback loop stability.

No Load:
- Some power amp don't like operating into an open circuit at high frequencies.   A Zobel network ensures
  the load looks low and resistive at high frequencies.
- The inductive load of a speaker creates a similar no-load condition at high frequencies.
   For amplifier stability the values of the Zobel network depend on the amp more than the speaker.
- opamps are different:  opamps are always stable into no load

In general you should use a Zobel network on a power amplifier.   If the datasheet shows a Zobel you should use it.
To go against that you would need a lot of supporting evidence - which is almost impossible to create since you know
nothing about the innards of a power amplifier chip.

Capacitive loads:
That's a whole different story.   

- Capacitive loads stuff up all amplifiers with feedback: power amps and opamps.
- For power amps a common way to "disconnect" the capacitive load is to add an LCR network.
Then to ensure the amp is still stable with the "disconnected" load you need
to place a Zobel network across power amp output.

This pic should also show cable capacitance.
https://www.globalspec.com/reference/22138/203279/output-networks
(https://images.books24x7.com/bookimages/id_25410/fig216_01.jpg)

- For opamps the simplest way to handle capacitive loads is to add a series resistor to the
  output.   In general, the value of the *minimum* resistor depends on output impedance
  of the opamp, the capacitive load, and what frequency the opamp rolls-off.  If you add
  a large valued resistor (say 1k in most cases) it will pretty much work for all opamps,
  except some low power units.

  If the resistor value isn't large enough the capacitive load can introduce phase shift
  into the feedback loop and cause the opamp to go unstable.

  That's why you see a 470 ohm to 1k series resistor on the output of an effects pedal.
  Here, the capacitive load is the cable capacitance.

- Beyond that, there's a whole lot of techniques,
  https://www.analog.com/en/analog-dialogue/articles/ask-the-applications-engineer-25.html