LM386 datasheet circuit problem

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Howdy
I am trying to implement the most basic circuit for an LM386 amp chip. I am following the schematic in the datasheet (posted below), using a +12v power supply with a 4ohm speaker on the other end, driving it with an iphone (line level) audio output.


I'm using all these exact values and well, it sounds like garbage. Super distorted, and the longer it plays, it kind of builds an oscillation or something. I found that using a 1uf cap on pin 7 to ground helps the distortion, but it still sounds awful.

Can anyone see anything wrong with this circuit?

ps. the 250uf and the 0.05uf cap are huge monsters - seems strange to me, but anyway, I am doing it as far as I can tell, exactly like the schematic suggests.
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
It could well be your layout. How have you built it?
Post a picture of your circuit.
Wow - that is a very interesting insight. What could be wrong?
I actually did lay out a similar circuit and had boards printed up as an experiment - I have not tried those yet, I wanted to get it working on breadboard first. I can clarify anything from this pic if it doesn't show what you are looking at (power is disconnected hence the floating wire up top-right).


Thank you
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Without knowing the signal level of the input, my guess is too much gain.
Line level from an iphone, so I think that is ~ 1v.

It doesn't sound like an overdriven input, it sounds like a weird gated oscillation that comes in with louder parts of the music. Quieter parts go extra silent, until it runs for a while, at which point the oscillation becomes fairly constant.
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
That isn't what I said.

Default gain on LM386 is 20 so 1V in gives 20V out; but your supply is 12V. Too much gain causing clipping (i.e. distortion).

Put an attenuator on the input.
I don't really follow though - the minimum gain on that chip is 20, and it also says it can operate at 4-15v. From what I understand from you are saying, all of those supply voltages sound too low (caveat - I don't really know what you are saying, trying to understand).

I will add an attenuator, but I've also experimented with turning the volume down from the phone and it still sounds like garbage, the distorted signal gets quieter and a constant electrical oscillation takes over. Wouldn't turning the volume down at the source be the same as an attenuator?
I'll try to make a demo...thank you.
 

dendad

Joined Feb 20, 2016
4,634
Try adding an electrolytic cap across the power pins close to the chip. Bypassing is good to have.
Also, run the phone output through a 100K resistor with a 100nF cap to Gnd to filter any PWM signal out. A lot of phones have class D amps and it could be some of that getting through.
The R/C filter on the input to the pot will kill the highs a bit but it could be worth a test.
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Try adding an electrolytic cap across the power pins close to the chip. Bypassing is good to have.
Can you explain in detail what you mean here? I have a 0.1uf cap (polar) - do you mean connect this from my power supply to VCC in on the chip?
Or put this cap from VCC to GND?

I'll try the filter you mention - thank you. I've tried it with my laptop audio out as well but that seems to be about the same.

The most interesting thing to me about the distortion is that it builds, like an oscillation that grows louder and louder.
 

AnalogKid

Joined Aug 1, 2013
12,043
All audio power amplifier IC's *demand* extra careful power supply decoupling. If the distortion seems to cut in and out depending on signal level, the chip could be breaking into oscillation. Besides an input coupling capacitor, add a 0.1 uF ceramic in parallel with a 10-100 uF electrolytic from pin 4 to pin 6. Keep the leads as short as possible. Also, the ground (return) lead from the speaker should go directly to pin 4, not to some other ground connection point on the proto-board.

ak
 

dendad

Joined Feb 20, 2016
4,634
Something like this..
LM386.jpg
Try to keep the input signal path separate from the power and speaker currents. That will help stability so use a single common point. Then add the bypassing caps across the power with leads as short as you can.
On the input, a resistor in series with the pot to drop the level down, and a cap across the pot to bypass high frequency noise. Play with the values to find what works for you.
 

Standisher

Joined Jan 16, 2015
156
Don't know if I'm looking at your pic wrong....but it 'appears' to me that you have Pin 3 of LM386 connected to ground rather than the signal input. Looks like you may have pins 2 & 3 connections reversed??? That would give you a 180 degrees phase shift between input and output.
 
Last edited:

dendad

Joined Feb 20, 2016
4,634
2 to gnd at the bottom of the pot, 3 comes from the pot wiper.
The wires cross over.
I could have drawn that all better but....

EDIT: Ah, I see you are referring to the breadboard picture. I thought it was my circuit. Sorry :)
 
Last edited:

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Thanks for the replies - I have a lot to try tomorrow.

Why is the datasheet so wrong then? What is the datasheet assuming that I am missing - any insight into that?
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Besides an input coupling capacitor,
When you say 'input couping capacitor', what exactly do you mean? Any cap with any value in the input path? In parallel with the input? Polar or not - does that even matter? Surely there is a range of values that will work or not?
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Don't know if I'm looking at your pic wrong....but it 'appears' to me that you have Pin 3 of LM386 connected to ground rather than the signal input. Looks like you may have pins 2 & 3 connections reversed??? That would give you a 180 degrees phase shift between input and output.
You are right about that - totally my mistake. I'm thinking that is not part of the problem here and probably just a throwback from an earlier (believe it or not) WORKING circuit that I did based off Mims's design. It was fairly different, used way different values, but also worked well. I just mistakenly thought that using the 'official' schematic out of the datasheet would work the same or better.
 

AnalogKid

Joined Aug 1, 2013
12,043
https://en.wikipedia.org/wiki/Capacitive_coupling

An input coupling capacitor goes in series with the input. One end of the cap connects to the point labeled Vin, and the other end is the new Vin. If your input potentiometer is 10 K ohms, then a 1.0 uF coupling cap will act as a high-pas filter with a corner frequency of 16 Hz - plenty low enough. If you want to set a different cutoff freq, the equation is:

f = 1 / ( 2 x pi x R x C)

ak
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
https://en.wikipedia.org/wiki/Capacitive_coupling

An input coupling capacitor goes in series with the input. One end of the cap connects to the point labeled Vin, and the other end is the new Vin. If your input potentiometer is 10 K ohms, then a 1.0 uF coupling cap will act as a high-pas filter with a corner frequency of 16 Hz - plenty low enough. If you want to set a different cutoff freq, the equation is:

f = 1 / ( 2 x pi x R x C)

ak
That really clears things up - thank you so much.

Side note - 386's are really easy to fry.
 

AnalogKid

Joined Aug 1, 2013
12,043
If it is wired correctly, frying usually is caused by oscillation. That's the only time I've seen one die. I killed a TDA2003 the same way, then learned.

ak
 
Top