# I'm trying to simulate an audio amplifier circuit but I couldn't find how to add LM386 to LTSpice like image. Is there any suggestions?

LTspice circuit.

I couldn't find solution for this part of my simulation.

## What I will do here

It isn't even clear to me what you actually want. One one hand, I think you may want a symbol. On the other hand, I think you may want a model. Or maybe both. I really cannot tell.

So I'm going to assume both, as that's probably more helpful to you and to others, and try and show you how to do all this stuff on your own with LTspice.

## LTspice model sources

LTspice is pretty good about providing built-in models for their own Linear Tech branded parts. LTspice is particularly bad at providing models for their competition. It may provide models for LEDs, some BJTs, etc. That's not really competing with their ICs. But if it is a competitor's part, it's very unlikely you will see it included in the distribution set.

So, as a general rule for parts that come from anywhere other than Linear Tech, when looking for a model you should try to find it at the primary web site for that part's manufacturer. Many manufacturers will provide some models for some parts. None I know of provide models for all of their parts, though. So you may very well come up short, when looking.

If the above steps fail, then there is a remaining primary place to go, which is more likely to have what you need. And that's the LTspice group's (located at Groups.IO) file folder. And there will be times you want to go here, anyway, because you may find better (or worse) models, too. Sometimes, you can find quite sophisticated models that include features that other models lack. So if you have a specialized model requirement, you might try here to see if someone has already provided it.

You will have to sign in and that may mean you need to be admitted into the group by asking. But I've not heard of a case where someone was turned away without cause. So just asking and giving a short explanation about what you are looking for should be sufficient, I'd imagine.

Once there, you can perform this search for the LM386 and there will be a number of results spanning some years. One I picked out from there was added by John Woodgate -- someone you can pretty much just trust. He provides two models: A tested TI version (with testing schematics) and one from Dave Dilatush.

However, John provides two different symbols because the two different models use two different symbol pin assignment orderings. Which is a problem if you want to build a symbol that supports multiple models for testing.

The ORCAD libraries are also floating around the internet. So you might also try and search for ORCAD when looking for some specific model or collections of models.

## Symbols

LTspice requires some kind of symbol if you are using a schematic to create your circuit. The symbol is primarily just a collection of vector drawing commands so that the symbol can be drawn. But it also is a "convenient" repository for other information, such as the pins, the pin names, and their spice ordering when LTspice needs to run a .SUBCKT model for it. It also includes some info on what attributes to show in the schematic and what not to show. So it is a little more than just a list of drawing commands.

You can create your own symbols. But you do need to know a few things. I've written an earlier post here that provides a lot of information about this process. Please refer to it for more details.

You can also grab up the symbols that others have created for you. But here, I'd probably refer you back to the LTspice group's (located at Groups.IO) file folder. It's a lot of what the contributors there do, in fact -- creating convenient to use symbols for others.

## Caution with models and symbols

When grabbing symbols and models from various places be aware of these:

• The models will have a certain ordering of their parameters. Although two different models for the same device may each work just fine, the ordering of the parameters when calling them may be different from each other. In such cases, you will either require a different schematic symbol for each different model, or else you will need to edit the models in order to cause the parameter ordering to line up with each other.
• The symbols themselves will have a certain ordering number assigned to their visible pins. If a symbol's ordering is different than the model ordering, once again you have a problem and will need to edit either the symbol or the model so that the pin ordering matches up.

In short, don't expect everything to "just work right." If the model and the symbol come from the same source, chances are that they will work without you needing to examine them. But if you pick up a model from one place and a symbol from another, or you create a symbol but find a model elsewhere, then you will need to do a hand-verification that everything makes sense. No way to avoid that. Otherwise, you'll just be in a lot of hurt trying to figure things out.

## My LM386 files

Here's what I happen to have as the two related files you can use:

LM386.ASY:

Version 4
SymbolType CELL
LINE Normal -32 0 64 64
LINE Normal -32 128 64 64
LINE Normal -32 0 -32 128
LINE Normal -28 32 -20 32
LINE Normal -28 96 -20 96
LINE Normal -24 100 -24 92
LINE Normal 16 0 16 32
LINE Normal -16 128 -16 117
LINE Normal -21 19 -13 19
LINE Normal -17 15 -17 23
LINE Normal -20 110 -12 110
LINE Normal 48 0 48 53
LINE Normal -16 0 -16 11
LINE Normal 32 85 32 128
LINE Normal -32 32 -48 32
LINE Normal -32 96 -48 96
LINE Normal 64 64 80 64
TEXT -43 39 Left 1 2
TEXT -43 87 Left 1 3
TEXT -10 10 Left 1 6
TEXT -12 119 Left 1 4
TEXT 17 26 Left 1 1
TEXT 37 40 Left 1 8
TEXT 22 98 Left 1 7
TEXT 65 71 Left 1 5
TEXT 14 43 Left 1 G
TEXT 33 56 Left 1 G
TEXT 0 81 Left 1 Byp
WINDOW 0 64 16 Left 2
WINDOW 38 64 112 Left 2
SYMATTR SpiceModel LM386_TI
SYMATTR Prefix X
SYMATTR Description LM386 Audio Power Amplifier
SYMATTR ModelFile LM386.LIB
PIN -48 32 NONE 0
PINATTR PinName In-
PINATTR SpiceOrder 2
PIN -48 96 NONE 0
PINATTR PinName In+
PINATTR SpiceOrder 3
PIN 32 128 NONE 8
PINATTR PinName B
PINATTR SpiceOrder 7
PIN 16 0 NONE 0
PINATTR PinName COMP2
PINATTR SpiceOrder 1
PIN 48 0 NONE 0
PINATTR PinName V+
PINATTR SpiceOrder 8
PIN 80 64 NONE 0
PINATTR PinName OUT
PINATTR SpiceOrder 5
PIN -16 0 NONE 0
PINATTR PinName COMP1
PINATTR SpiceOrder 6
PIN -16 128 NONE 0
PINATTR PinName V-
PINATTR SpiceOrder 4


The above text can be copied into Notepad or some other text editor and then saved into a file residing in the SYM subdirectory within your LTspice file folders. I used the name "LM386.ASY" as LTspice looks for the .ASY extension there.

LM386.LIB:

*    ---------------------------------------------------------------
*    All models here must comform to the 8-pin DIP package ordering.
*    ---------------------------------------------------------------
*
*    ==============================
*    LM386 MODEL 1 -- Dave Dilatush
*    ==============================
*
.subckt LM386_DD1 g1 inn inp gnd out vs byp g8
* input emitter-follower buffers:
q1 gnd inn 10011 ddpnp
r1 inn gnd 50k
q2 gnd inp 10012 ddpnp
r2 inp gnd 50k
* differential input stage, gain-setting
* resistors, and internal feedback resistor:
q3 10013 10011 10008 ddpnp
q4 10014 10012 g1 ddpnp
r3 vs byp 15k
r4 byp 10008 15k
r5 10008 g8 150
r6 g8 g1 1.35k
r7 g1 out 15k
* input stage current mirror:
q5 10013 10013 gnd ddnpn
q6 10014 10013 gnd ddnpn
* voltage gain stage & rolloff cap:
q7 10017 10014 gnd ddnpn
c1 10014 10017 10pf
* current mirror source for gain stage:
i1 vs 10004 dc 5m
* Sziklai-connected push-pull output stage:
q10 10018 10017 10003 ddpnp
q11 10004 10004 10009 ddnpn 100
q12 10009 10009 10017 ddnpn 100
q13 vs 10004 10002 ddnpn 100
rup 10002 out .5
q14 10003 10018 gnd ddnpn 100
rdown out 10003 .5
* generic transistor models generated
* with MicroSim's PARTs utility, using
* default parameters except Bf:
.model ddnpn NPN(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=400 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)
.model ddpnp PNP(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=200 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)
.ends
*
*
*    ==============================
*    LM386 MODEL 2 -- Dave Dilatush
*    ==============================
*
.subckt LM386_DD2 g1 inn inp gnd out vs byp g8
* input emitter-follower buffers:
q1 gnd inn 10011 ddpnp
r1 inn gnd 50k
q2 gnd inp 10012 ddpnp
r2 inp gnd 50k
* differential input stage, gain-setting
* resistors, and internal feedback resistor:
q3 10013 10011 10008 ddpnp
q4 10014 10012 g1 ddpnp
r3 vs byp 15k
r4 byp 10008 15k
r5 10008 g8 150
r6 g8 g1 1.35k
r7 g1 out 15k
* input stage current mirror:
q5 10013 10013 gnd ddnpn 1.1
q6 10014 10013 gnd ddnpn
* voltage gain stage & rolloff cap:
* m was 1
q7 10017 10014 gnd ddnpn 10
c1 10014 10017 15pf
* current mirror source for gain stage:
i1 10002 vs dc 5m
q8 10004 10002 vs ddpnp
q9 10002 10002 vs ddpnp
* Sziklai-connected push-pull output stage:
* m=10 for q10
q10 10018 10017 out ddpnp 10
q11 10004 10004 10009 ddnpn 100
q12 10009 10009 10017 ddnpn 100
q13 vs 10004 out ddnpn 100
q14 out 10018 gnd ddnpn 100
* generic transistor models generated
* with MicroSim's PARTs utility, using
* default parameters except Bf:
* BF was 400, Is=10f
.model ddnpn NPN(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=150 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)
* BF was 200, Tf=1n, Tr=10n, Is=10f
.model ddpnp PNP(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=40 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=100n
+ Tf=10n Itf=1 Xtf=0 Vtf=10)
.ends
*
*
*    =====================================================
*    Source File: LM386Blk.asc
*    Developer: ETech (eetech00@yahoo.com)
*    Created: Feb 28 2016
*    Revision: NA
*
*    This TI LM386 spice model has
*    been tested with LTSpice. Temperature is not modeled.
*    =====================================================
*
* block symbol definitions
.subckt LM386_TI G1 INN INP DGND OUT VS BYPASS G8
Q3 N011 N011 DGND 0 NP .2
Q2 N011 N009 N004 0 PN .2
Q1 DGND INN N009 0 PN .2
R1 INN DGND 50k
Q4 N007 N011 DGND 0 NP .2
R2 G1 G8 1.35k
Q5 N007 N010 G1 0 PN .2
Q6 DGND INP N010 0 PN .2
R3 INP DGND 50k
Q7 N008 N007 DGND 0 NP .2
Q8 N006 N012 DGND 0 NP 20
C1 N008 N007 10p
Q9 N012 N008 N006 0 PN .2
R4 OUT N006 0.5
R5 N003 OUT 0.5
R6 OUT G1 15k
Q10 VS N002 N003 0 NP 20
Q11 N002 N001 VS 0 PN .2
R7 BYPASS N004 15k
R8 N001 BYPASS 15k
QD2 N002 N002 N005 0 NP 20
R9 N001 DGND 3400
R10 G8 N004 150
Q12 N001 N001 VS 0 PN .2
QD1 N005 N005 N008 0 NP 20
*
* generic transistor models generated
* with MicroSim's PARTs utility, using
* default parameters except Bf.
* (but default parameters do not match LTspice defaults):
.model NP NPN(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=400 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)
.model PN PNP(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=200 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)
.ends LM386


The above text can be copied into Notepad or some other text editor and then saved into a file residing in the SUB subdirectory within your LTspice file folders. Unless you edit the name in the .ASY file I provided above, then you must use the name "LM386.LIB" here. LTspice will look into the .ASY file to find the name of this file. If they don't match up, there will be a problem. If you don't like the name "LM386.LIB" and would prefer "LM386.MOD" then you can do that. But you will have to edit the .ASY file I earlier provided so that it also names the same file.

Once you do this, you can fire of LTspice and create a new schematic and use F2 to select the part from the list. Once it is on the schematic, you can right-click the part (at least, in Windows) and see this:

Here, you can move the mouse over the SpiceModel, underneath the Value column where it says "LM386_TI", left-click that line, right-click in the highlighted Value column and select the little drop-down arrow to see:

And there you can see the three LM386 model choices. Pick any one of them you want.

If you find other models you'd like to add, you can do that by editing them into your LM386.LIB file. LTspice will automatically find them and add them to the list of choices.

All the above is largely untested by me. I just cobbled up a few pieces I had laying about and created the symbol for them. I did have to edit the models to line them up with the symbol. I may have made mistakes here. Just FYI. If you find a problem, feel free to say something about it. I'll try to rectify problems I created here.

## Notes

I provided a symbol above. But there are times when you just don't care to go to the trouble of making one. LTspice also provides a number of convenient generic symbols.

For example, if you dig into their lib/sym/Misc folder you will find a DIP8, DIP10, DIP14, DIP16, and DIP20. I could have just selected the DIP8 symbol and edited that, instead, saving it perhaps under the name "LM386_DIP8.ASY".

Here's the result of that editing process that you can use instead of the above symbol:

LM386_DIP8.ASY:

Version 4
SymbolType CELL
LINE Normal -20 -128 -20 -112
LINE Normal 20 -128 20 -112
LINE Normal -8 -100 8 -100
RECTANGLE Normal -112 -128 112 128
ARC Normal -20 -124 4 -100 -20 -112 -8 -100
ARC Normal -4 -124 20 -100 8 -100 20 -112
WINDOW 0 0 -144 Center 2
WINDOW 38 1 145 Center 2
SYMATTR Prefix X
SYMATTR Description LM386 Audio Power Amplifier
SYMATTR SpiceModel LM386_TI
SYMATTR ModelFile LM386.LIB
PIN -112 -96 LEFT 8
PINATTR PinName 1
PINATTR SpiceOrder 1
PIN -112 -32 LEFT 8
PINATTR PinName 2
PINATTR SpiceOrder 2
PIN -112 32 LEFT 8
PINATTR PinName 3
PINATTR SpiceOrder 3
PIN -112 96 LEFT 8
PINATTR PinName 4
PINATTR SpiceOrder 4
PIN 112 96 RIGHT 8
PINATTR PinName 5
PINATTR SpiceOrder 5
PIN 112 32 RIGHT 8
PINATTR PinName 6
PINATTR SpiceOrder 6
PIN 112 -32 RIGHT 8
PINATTR PinName 7
PINATTR SpiceOrder 7
PIN 112 -96 RIGHT 8
PINATTR PinName 8
PINATTR SpiceOrder 8


Same behavior. Just a different-looking symbol.

• As you said, my question is not very clear, but your answer was helpful enough. thank you so much!
May 15 at 22:40
• @ade When you feel you've waited long enough to see if there may be answers you like better, you can select an answer. The reason to do this isn't because you want to please someone else who wrote an answer. In fact, I hope that is never your reason. But doing so does help others avoid wasting their own time, thinking you didn't get what you needed already and where they take a lot of their time because they just want to help you out in a different way.
– jonk
May 16 at 6:13

The symbol pattern is not the same but looks like an Op Amp. If you keep digging you might find your preference.

Version 4
SymbolType BLOCK
LINE Normal -32 48 -32 -49
LINE Normal 64 0 -32 -49
LINE Normal -32 48 64 0
LINE Normal 8 -48 -8 -48
LINE Normal 0 -39 0 -56
LINE Normal 5 57 -9 57
LINE Normal -16 -41 -16 -48
LINE Normal 48 -8 48 -16
LINE Normal 48 8 48 16
LINE Normal 16 24 16 32
LINE Normal -16 40 -16 48
LINE Normal -32 16 -64 16
LINE Normal -32 -16 -64 -16
WINDOW 123 16 0 Center 2
SYMATTR Value2 LM386
SYMATTR Prefix X
SYMATTR Value LM386
SYMATTR SpiceModel LM386.sub
PIN 48 16 LEFT 8
PINATTR PinName g1
PINATTR SpiceOrder 1
PIN -64 -16 BOTTOM 8
PINATTR PinName inn
PINATTR SpiceOrder 2
PIN -64 16 TOP 8
PINATTR PinName inp
PINATTR SpiceOrder 3
PIN -16 48 LEFT 8
PINATTR PinName gnd
PINATTR SpiceOrder 4
PIN 64 0 LEFT 8
PINATTR PinName out
PINATTR SpiceOrder 5
PIN -16 -48 BOTTOM 8
PINATTR PinName vs
PINATTR SpiceOrder 6
PIN 16 32 LEFT 8
PINATTR PinName byp
PINATTR SpiceOrder 7
PIN 48 -16 LEFT 8
PINATTR PinName g8
PINATTR SpiceOrder 8


I wasn't happy with these results so I found a better source, so disregard the above.

https://oshwlab.com/example/Demonstrating_the_EasyEDA_LM386_spice_subckt_model-pgoiAgM4m

• Thank you so much for the explanation. it helped me a lot.