LM386 - LTSpice Simulation

Thread Starter

vol_

Joined Dec 2, 2015
93
Hello everyone!

I simulate a LM386 circuit in LTSpice and I'm getting almost the right output dc offset voltage (+5V), but the frequency response I get as result can't be right. The amplifier amplifies up to 0dB... I run a transient response analysis with Vin (dc offset=0V, Amplitude=50mV, f=1kHz) and an ac analysis with Vin (small ac signal of 50mV).

I attach all the files of the circuit..

Actually allcircuits.com has forbidden extensions, so I attach the model that i created and the test circuit schematic. The ltspice model for lm386 lays here:

http://softsolder.com/2009/09/29/adding-a-device-to-ltspiceiv/.

Thanks!
 

Attachments

OBW0549

Joined Mar 2, 2015
3,566
I simulate a LM386 circuit in LTSpice and I'm getting almost the right output dc offset voltage (+5V), but the frequency response I get as result can't be right.
That LTSpice model is derived from the original "No Frills" LM386 PSpice model I created back in 1995 and posted to the sci.electronics Usenet group. The original post (see here) contained a lot of design information, which was omitted in the version you are using. As the notes explain, the frequency response of this model deviates significantly from actual device behavior, so your results are not surprising. The notes also suggest ways to "tweak" the model to bring it into better conformance with actual LM386 behavior.
 

Thread Starter

vol_

Joined Dec 2, 2015
93
They are not the same.

I couldn't get the one you were using to work correctly.
Well, eetech00 the model you passed to me behaves much better for the frequency response of the chip (this is about the AC analysis in LTSpice), but again the results are in minus deciBells.. Why is this? Should i try to choose different reference than the ground? Or what? Is it happening?... This is a problem that also existed in the model i used before .

Also for the Transient analysis what i dont get is that the output swing is 2V peak-to-peak, with a bias of 5V only before the output coupling capacitor. After the cap the bias voltage is 0V. This is again a prob that also existed in the model i used before. So i think something is wrong with my settings. Specially with minus dB gain results..

I m sending screenshots of the LTSpice simulation. The bottom screens (lm386-testv01.PNG and
lm386-testv01-graphic.PNG) are for the transient analysis and the lm386-testv01-graphic-ac_analysis.PNG is for the frequency response. For the plot image the green line is measured gnd referenced after the output coupling capacitor, the blue before the output cap and the red is for the input signal. I m also sending the file of the schematic (.asc) for the new model eetech00 sent.

Cheers!
 

Attachments

Last edited:

Thread Starter

vol_

Joined Dec 2, 2015
93
And the very weird think is that the gain also has in absolute numbers its correct value. I m getting -22 dB and what i expect is 20 dB. A good result but inverted. So probably this is a good model, but smthing is wrong with my settings..

Thankzzz
 

Bordodynov

Joined May 20, 2015
3,177
You do not have fixed the value of the capacitor, as I pointed out. Instead, point your comma. I calculated the your schema. It turned 24 dB and 180 degrees. I used a different symbol.

See

LM386-testV01new.png
 

Thread Starter

vol_

Joined Dec 2, 2015
93
You do not have fixed the value of the capacitor, as I pointed out. Instead, point your comma. I calculated the your schema. It turned 24 dB and 180 degrees. I used a different symbol.

See

View attachment 101804
Actually, as i understand, what was wrong was the 50mV small AC signal at the input. For 1V value i got what bordodynov got as a result. But why is there such a big difference? Why LTSpice needs 1V ac small signal and 50mV ac small signal drive me to negative gain results?
 

eetech00

Joined Jun 8, 2013
3,856
Actually, as i understand, what was wrong was the 50mV small AC signal at the input. For 1V value i got what bordodynov got as a result. But why is there such a big difference? Why LTSpice needs 1V ac small signal and 50mV ac small signal drive me to negative gain results?
Hi:)

I don't know if your still interested, but I found and modified the no-frills LM386 model mentioned by OBW0549.
I believe it correctly models the input bias current and quiescent supply current now. If your interested in testing the model, let me know.

Also,

I believe the built in AC analysis FRA in LTspice relies on a 1v RMS input representing 0db. If you use a different input voltage level, it messes up the results (I might be incorrect on this, but I didn't spend a lot of time trying to make it work:(). You can still do the analysis using a different input voltage, but you have to use custom graphs. There is a way to do this in transient mode but it takes a really long time to simulate.;)

Anyhow...let me know if you would like to test the LM386 model.:cool:
 

crutschow

Joined Mar 14, 2008
34,280
.................
I believe the built in AC analysis FRA in LTspice relies on a 1v RMS input representing 0db. If you use a different input voltage level, it messes up the results ................
LTspice calculates all the dB measurement values in the AC analysis using 1V as the reference (thus 1V equals 0dB).
Thus if you use anything other than 1V for the input, the dB gain values will be off by the dB difference between the value you used and 1V.
Using 1V is okay, even if the amp can't tolerate 1V input for the Transient Analysis because the AC analysis assumes a linear transfer function for the amplifier, independent of the value of the AC signal voltage.
 

eetech00

Joined Jun 8, 2013
3,856
LTspice calculates all the dB measurement values in the AC analysis using 1V as the reference (thus 1V equals 0dB).
Thus if you use anything other than 1V for the input, the dB gain values will be off by the dB difference between the value you used and 1V.
Using 1V is okay, even if the amp can't tolerate 1V input for the Transient Analysis because the AC analysis assumes a linear transfer function for the amplifier, independent of the value of the AC signal voltage.
Hi

Thanks for that clarification crutschow. I'm sure other LTspice uses have struggled performing FRA without knowing that.

thanks
 

Thread Starter

vol_

Joined Dec 2, 2015
93
Hi:)

I don't know if your still interested, but I found and modified the no-frills LM386 model mentioned by OBW0549.
I believe it correctly models the input bias current and quiescent supply current now. If your interested in testing the model, let me know.

Also,

I believe the built in AC analysis FRA in LTspice relies on a 1v RMS input representing 0db. If you use a different input voltage level, it messes up the results (I might be incorrect on this, but I didn't spend a lot of time trying to make it work:(). You can still do the analysis using a different input voltage, but you have to use custom graphs. There is a way to do this in transient mode but it takes a really long time to simulate.;)

Anyhow...let me know if you would like to test the LM386 model.:cool:
I am using the LTspice model you send me.
I attach the picture with the simulation and the circuitry that i'll use after all.

Actually, i just added an RC low pass filter to the noisy cricket, with its resistor choosen at 47K to attenuate the input signal a bit. The zobel network is for a 2 inch cheap chinese speaker, that it sounds really decent for the size and price. I still dont know if i like the LM386 or not.

Thank u all!
 

Attachments

tlg0010

Joined Nov 16, 2017
1
That LTSpice model is derived from the original "No Frills" LM386 PSpice model I created back in 1995 and posted to the sci.electronics Usenet group. The original post (see here) contained a lot of design information, which was omitted in the version you are using. As the notes explain, the frequency response of this model deviates significantly from actual device behavior, so your results are not surprising. The notes also suggest ways to "tweak" the model to bring it into better conformance with actual LM386 behavior.
Hello all,
I am new to creating and loading new components in LTSpice and am needing some help. I have added the .asy, and the .sub to my .lib folder, but when I try to simulate my circuit I get the "Could not open library file "LM386.sub" error message. I have attached my LTSpice schematic and the corresponding folders.
 

Attachments

Last edited:

OBW0549

Joined Mar 2, 2015
3,566
I am new to creating and loading new components in LTSpice and am needing some help. I have added the .asy, and the .sub to my .lib folder, but when I try to simulate my circuit I get the "Could not open library file "LM386.sub" error message. I have attached my LTSpice schematic and the corresponding folders.
I'd love to help you, but I can't; I don't use LTSpice so I'm not familiar with how to add new models to its libraries. We've got many people here who use LTSpice, though, and surely one of them can help you.

When I wrote that LM386 model back in 1995 it was for whatever version of PSpice was in use at the time; if there are any differences between that version and today's PSpice, that may complicate things.

Sorry I can't help more...
 

Alec_t

Joined Sep 17, 2013
14,280
The .sub file should go in the ......lib/sub folder. The .asy file should go in the appropriate ......lib/sym folder.
However, if you're running LTspiceXVII on Windows10, the lib folder that gets read is the Documents/LTspice/lib one.
 
Top