LM386n datasheet inquiry - Page 1
Forum section: electronics / beginners

author: bitman
author_rank: Unknown
timestamp: May 26, 2019, 04:04:23 pm
content: For a few days I was lost trying to get a very simple LM386n circuit to work - took me a while to realize a simple wrong connection - but it led me to read the datasheet in details. Now that I finally got the simple 20x and 200x circuit to work, I'm seeing characteristics I cannot find in the datasheet.The biggest issue and the reason for my question is, that it look like when the amplitude reaches 5V on the output, the LM386n just stops amplifying. I see a flat top if the input is larger. The lowest voltage amplitude my function generator can make is 0.5v so that should be +/- 0.25v which is well within the +/- 0.4v on the input. I have to admit that during my tests I far exceeded this so perhaps my just destroyed the chip. Anyway, I cannot find where in the datasheet such a limit exists. 0.4*200 is far above 5V it cannot be inferred.Other beginner issues and lessons learned is:* Supply voltage isn't the max amplitude this chip can provide. I started out with 5V on the Vdd and nothing worked. It wasn't until I put that at 9v my very low < 0.5v input signal was amplified.* "Cheap" scope (Rigol DS1054Z) cannot trigger on very low voltages. When the amplitude gets below 0.15v or there about it will no longer trigger. I wonder what specs states how sensitive the scope is - not a big deal, but it's definitely nice to know going forward.Hopefully someone can help explain what seems to be basic to a lost novice.

author: bdunham7
author_rank: Super Contributor
timestamp: May 26, 2019, 05:47:37 pm
content: Could you post your circuit?Some of your conclusions are wrong and I'd like to see how you arrived at them.1) the DS1054Z will trigger just fine far below 150mV--actually I'm not sure exactly what you mean. Default trigger is zero.2) supply voltage does determine the max amplitude, but it would be peak-to-peak, minus a bit, not RMS. Do you have an output capacitor?As you've figured out, your input voltage is way too high to properly set up an amplifier circuit with this IC, even with max Vss and default gain. The solution is simple--you need an input voltage divider AKA volume control. The datasheet should have example circuits.

author: Zero999
author_rank: Super Contributor
timestamp: May 26, 2019, 05:56:20 pm
content: It's clipping. The maximum peak to peak output voltage is limited by the power supply voltage and the losses in the LM386's output transistors.If your function generator can't produce lower voltages, then you need an attenuator on the output. A simple potentiometer will do, but I advise building one with a rotary switch and some resistors to attenuate by a factor of 10 or 100.

author: bitman
author_rank: Unknown
timestamp: May 26, 2019, 06:10:38 pm
content: Quote from: Zero999 on May 26, 2019, 05:56:20 pmI've got a 10k pot on the input - as indicated in the datasheet. This is how I know that when I get a signal less than ~150mV the scope no longer auto-triggers. It's also how I see the output get capped at 5V amplitude when I turn the input voltage amp up.Since you didn't say "yeah, that's correct" in regards to my observation on the output max amplitude, givenhttp://www.ti.com/lit/ds/symlink/lm386.pdfsection 9.2.2 (that's my circuit) and let's make the Vdd 12V - are you saying I should be able to get more than 5V amplitude with a 200mV amplitude input and a 200 gain? I do not see that.

author: Audioguru
author_rank: Super Contributor
timestamp: May 26, 2019, 06:18:32 pm
content: The datasheet shows the test circuit with a 10k volume control at the input pin 3 to ground, pin 2 is grounded and a 250uF capacitor feeds an 8 ohm speaker. The input to the volume control must be audio with no DC voltage on it so that pin 3 averages 0V.The graph on Page 4 Peak-To-Peak Output Voltage Swing Vs Supply Voltage shows the maximum output voltage swing at different speaker impedances and different supply voltages. With a 5V supply the maximum output is 3V p-p which is +1.5V and -1.5. If the output is more than 3V p-p then the top and bottom of the waveform will have flats that we call "clipping" and it produces severe distortion.When the gain is set to 20 times then if the input level exceeds 3V/20= 0.15V p-p then the output will be clipping.If the gain is set to 200 times then if the input level exceeds 0.015V (15mV p-p) then the output will be clipping.3V p-p into an 8 ohm speaker is a power of 0.14W which will be distorted a little and is so low that it is almost nothing.If a 9V supply is used then the maximum output level will be 6V p-p and the power in an 8 ohm speaker is 0.56W like a cheap clock radio.Please post a schematic of your circuit showing all parts values, the supply voltage and the speaker impedance.Here is what amplifier clipping looks like on an oscilloscope:

author: bitman
author_rank: Unknown
timestamp: May 26, 2019, 06:25:14 pm
content: Quote from: bdunham7 on May 26, 2019, 05:47:37 pmIt's straight out of the datasheet (see attachment).Quote from: bdunham7This is the first time I work with that low voltage for real, but it doesn't fit with my observation. Note - I'm talking AC coupling here, not DC - not sure if that makes a difference. Even if I set the vertical resolution to 50mV so the sine is easy to see, it doesn't freeze (trigger) at that low voltages. I see two or three sines overlayed and moving side to side - clearly the sync isn't working. Even when I hit stop are there overlayed sine curves. The moment I get a bit more voltage than 150mV I see a steady curve. I've tried to adjust the trigger level but regardless of where I put it on the sine I see no correct output. IQuote from: bdunham7Yes that was indeed one of my first issues (thinking that 1V was "weak") - but once I put the trimmer in and looked at both the input and output signal I made sure to adjust within the limits for the chip. Absolutely a lesson learned for me as it never occurred to me to check if the input voltage was too high. Once I thought of it, that all made perfect sense - just no something I thought off when all I wanted was to sound sound waves (input is a small Mic when then Frequency Generator isn't used).Thanks for your reply. I posted this because I want to understand how to read the datasheet better. Not only did I miss very obvious things later on, but I still cannot find why the output is limited. And if it's not, what I'm doing wrong.

author: Audioguru
author_rank: Super Contributor
timestamp: May 26, 2019, 06:31:45 pm
content: The graph is on Figure 3 of your datasheet. With a 12V supply and an 8 ohm load the LM386 gets too hot when playing loudly. With a 12V supply and an 8 ohm load the graph shows a maximum peak-to-peak output of 6.5V which is +3.25V to -3.25V which is 0.66W.You did not say the frequency. The 250uF output capacitor feeding an 8 ohm speaker reduces the level of frequencies below 400Hz.

author: bitman
author_rank: Unknown
timestamp: May 26, 2019, 07:07:25 pm
content: Quote from: Audioguru on May 26, 2019, 06:31:45 pmWhere are you finding the information?? I'm obviously not reading the datasheet right so how are you determining those values?I've done frequencies between 600Hz to 1.2KHz - typically the test frequency was set at 1KHz.Note - because my ears would object, I did not have a speaker on for most of the time - I put the probe straight on pin 5 (before the two caps). I did not see any significant change putting the probe after the cap (but still no speaker). I did notice that values would change once I had a load (the speaker) on. So when I just want to test the circuit in silence, should I just add a properly sized resistor?

author: bitman
author_rank: Unknown
timestamp: May 26, 2019, 07:22:37 pm
content: Quote from: Audioguru on May 26, 2019, 06:18:32 pmThank you very much - you not only helped identifying where in the data-sheet I can find an answer to the issue I'm seeing, but you also made me aware of a bad setup. The image you had of the clipping matched pretty much what I saw, except I only see clipping on the _top_ curve. So it made me think, and I realized my function generator was set with a 100% offset meaning it didn't go below 0 - everything was positive voltages (or 0). Now that I've corrected that, I see higher outputs than 5V all relative to the graph you pointed to. In my "defense" the image doesn't use searchable characters .. well, that's a bad excuse but that's why I didn't find it when I searched for "peak".Things make a lot more sense now! Thanks a lot. As noted in the previous post, I only put the speaker on momentarily so just measured without one so my ears wouldn't get mad at meI didn't put in a resistor in its' place, so of course my output would be too clean and not show the flattening out that the curves show in the datasheet. Still making a lot more sense now. I was reading tables looking for a "max/peak" value when it was in a graph.

author: Audioguru
author_rank: Super Contributor
timestamp: May 26, 2019, 08:20:30 pm
content: The graph shows that with a 12V supply and an 8 ohm speaker or resistor the maximum output is 6.6V p-p and with no load (infinity resistance) the maximum output is about 10.5V p-p.The output at pin 5 is at half the DC supply voltage so that it can swing equally up and down. The output capacitor blocks the output DC but passes the AC. Dc in a speaker pulls the cone to one side causing heating and distortion.

author: bdunham7
author_rank: Super Contributor
timestamp: May 27, 2019, 01:37:22 am
content: Quote from: bitman on May 26, 2019, 06:25:14 pmI think Audioguru has explained the clipping and max voltage well enough. There are amps that work differently (push-pull and h-bridge) that do not have ground-referenced output and can have peak-to-peak outputs nearly double the supply voltage. These are commonly used in car audio. The LM386 is not one of those.As far as your scope trigger issue, something is wrong. Just to check for sure, I took my DS1054Z and connected it to my signal generator which was set to 1KHz, 50mV p-p. I then simply pressed the "AUTO" button and a few seconds later I had a clean, stable sine wave on my screen showing 52mV Vp-p and 17mV RMS. I then dialed down the amplitude until the scope triggering failed, which was at 7mV. 8mV gave a stable signal. Using more advanced trigger options, I was able to trigger reliably on a 1mV signal, although it was pretty noisy--not a pretty picture. Post your setup exactly, with a photo if needed, showing scope settings, probe setting, etc and I'll try to see where you are going wrong. Perhaps your input is very noisy??

author: Zero999
author_rank: Super Contributor
timestamp: May 27, 2019, 09:05:30 am
content: Quote from: bitman on May 26, 2019, 07:07:25 pmIn theory yes, it should be possible to replace the speaker with the a resistor of the same value, but in practice, the impedance of the speaker varies with the frequency and at resonance will be higher than what's written on the back of the speaker or when measured using a multimeter.Here's an example of an 8 Ohm speaker I found, which has an impedance of over 40 Ohms, at 200Hz.https://impactaudio.co.uk/collections/visaton-miniature-speakers/products/visaton-frs-5-xts-8-ohm

author: bitman
author_rank: Unknown
timestamp: May 27, 2019, 06:22:40 pm
content: Quote from: bdunham7 on May 27, 2019, 01:37:22 amAudioguru absolutely did. I've learned the mistake of skipping the graph sections when I try to find key value points in a data sheet. Quite frankly I didn't even read the datasheet before I started with this very simple circuit - it took several failed attempts before I downloaded it (and then realizing there are more than one kind of LM386n). Lots of beginner confusion made bigger by using too low of a Vdd. Well, and using the wrong type of caps. My only frustration here is simple - I just needed something that would illustrate sound in basic electronics in a talk about how codecs works (I work in IT and only dabble in electronics as a hobby). I thought I could quickly put something together that would allow a simple live demonstration. I wasted so much time on screwing around with this, that it ended up with no live demonstration *grrr*. Thinking you know how to do something when obviously you don't is frustrating.Quote from: bdunham7Wow - ok, interesting. It was (I took it all apart now - sorry) very spot on around 150mV things would no longer be steady for me. Maybe I'll just repeat your setup and see. Noise - yeah, there's plenty here in my "electronics lair". From watching Dave's videos I know he would get a heart-attack if he saw how I connected the scope to the bread-board. Definitely not isolated - typically it's not an issue. I do mostly simple CMOS/TTL stuff, or basic micro-controller setup talking I2C or similar to components - nothing is very low voltage or prune to not work if there's noise. So I've never invested in the right cables and connectors. I have a ton of cheap crocodile cables or the hookup wires for bread-boards that I use to connect PSU, Scope, Meter etc. to the right points. I know it's far far FAR from efficient. So maybe that's what is really happening here - but that's the equipment I have so my options are a bit limited.I've got a good supply of perfboards now and I'll start doing soldered circuitry more than just bread-boards. But as you can probably tell, I make a lot of mistakes so using bread-boards allows me to figure those out, correct them before I move on. That probably won't change.