Importing models into LTSpice

Status
Not open for further replies.

Thread Starter

shortbus

Joined Sep 30, 2009
10,045
I'm trying to learn to use LTSpice. Not too good with computer programs, so please have mercy on me!

Would some one walk me step by step on how to add spice models and outlines to the library? I found the model files, some are zipped some not. But I can't figure out how to add them to the program.

I need help!
 

Ron H

Joined Apr 14, 2005
7,063
Let's do one at a time. Start with something you want to add. Post the contents of the file here, or post a link to the file.
 

Thread Starter

shortbus

Joined Sep 30, 2009
10,045
Let's do one at a time. Start with something you want to add. Post the contents of the file here, or post a link to the file.
Thank you. Here is a file for a lm339, it was zipped and I opened it and copied it. It was from the TI web site; http://focus.ti.com/docs/prod/folders/print/lm339.html

I really appreciate the help!



* LM339 VOLTAGE COMPARATOR "MACROMODEL" SUBCIRCUIT
* CREATED USING PARTS VERSION 4.03 ON 03/07/90 AT 14:17
* REV (N/A)
* CONNECTIONS: NON-INVERTING INPUT
* | INVERTING INPUT
* | | POSITIVE POWER SUPPLY
* | | | NEGATIVE POWER SUPPLY
* | | | | OPEN COLLECTOR OUTPUT
* | | | | |
.SUBCKT LM339 1 2 3 4 5
*
F1 9 3 V1 1
IEE 3 7 DC 100.0E-6
VI1 21 1 DC .75
VI2 22 2 DC .75
Q1 9 21 7 QIN
Q2 8 22 7 QIN
Q3 9 8 4 QMO
Q4 8 8 4 QMI
.MODEL QIN PNP(IS=800.0E-18 BF=2.000E3)
.MODEL QMI NPN(IS=800.0E-18 BF=1002)
.MODEL QMO NPN(IS=800.0E-18 BF=1000 CJC=1E-15 TR=807.4E-9)
E1 10 4 9 4 1
V1 10 11 DC 0
Q5 5 11 4 QOC
.MODEL QOC NPN(IS=800.0E-18 BF=20.29E3 CJC=1E-15 TF=942.6E-12 TR=543.8E-9)
DP 4 3 DX
RP 3 4 46.3E3
.MODEL DX D(IS=800.0E-18)
*
.ENDS

 

Ron H

Joined Apr 14, 2005
7,063
1. On the link you posted, scroll down to the PSpice model, unzip the folder, and open LM339_5.1 with notepad. Save the file in C:/program files/LTC/LTspiceIV/lib/sub as LM339.sub. Change "save as type" to "All files".

2. If LTspice is already open, close and then reopen it.
3. Open a new schematic window (Leftmost icon on toolbar).
4.Click on the component icon (the AND gate on the toolbar).
5. Double-click on [Opamps].
6. Scroll all the way to the end and select opamp2.
7. Click OK.
8. Left-click to place opamp2 symbol on schematic.
9. Right-click on symbol to open Component Attribute Editor.
10. Left-click on Value.
11. In the edit window that says Value = opamp2, change opamp2 to LM339. In general, the value you enter here must be identical to the subcircuit name in the subcircuit file. In this case, that line reads
.SUBCKT LM339 1 2 3 4 5
12. Left-click on the .op icon (rightmost on the toolbar). This is the spice directive icon .
13. Type .lib LM339.sub in the window. Left-click on OK.
14. Place this spice directive on the schematic by dragging it to where you want to place it, and then left-clicking.
15. You are now ready to place and connect other components before simulating.

Your schematic should resemble the one attached below.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Mike33,
You might need to change Trtol to something higher, around 7.

Click on Tools -> Control Panel -> SPICE tab.
Trtol's default is 1.

If this doesn't help, upload your schematic.
 

Thread Starter

shortbus

Joined Sep 30, 2009
10,045
Ron, THANK YOU! If you don't mind I have another question. Do you always use opamp2, even if the component is a different type? The 339 is basically a opamp so I understand using the opamp2. but what about something like a IR2110? Would you still use opamp2 to enter that?

Sorry that I'm so dumb about this, guess I shouldn't have waited until I am in my 60's to get started in computer/electronics :confused::eek:

Thank you again for all your help, cary
 

SgtWookie

Joined Jul 17, 2007
22,230
You'll find that there are a number of DIP packages available in the lib\misc subdirectory.

You can use file/open, select File of type: Symbol (*.asy), and then navigate to that subdirectory.

If available, I'll open up an existing .asy symbol file, and then immediately save it as the eventual name I want to use. That way I won't mess up and overwrite the original file.
 

Mike33

Joined Feb 4, 2005
349
Thanks, Sgt, that - plus making sure my opamp feedback resistors were of an appropriate value so as not to confuse the program - worked out great :eek:)
 

Ron H

Joined Apr 14, 2005
7,063
Ron, THANK YOU! If you don't mind I have another question. Do you always use opamp2, even if the component is a different type? The 339 is basically a opamp so I understand using the opamp2. but what about something like a IR2110? Would you still use opamp2 to enter that?

Sorry that I'm so dumb about this, guess I shouldn't have waited until I am in my 60's to get started in computer/electronics :confused::eek:

Thank you again for all your help, cary
The opamp2 symbol is only applicable to op amps and comparators, and even then they must have exactly 5 I/O pins and be ordered (in the subcircuit file) as follows: in+ in- V+ V- out.
Other subcircuits can use the generic symbols, as SgtWookie pointed out, or you can create your own symbols. I recommend not trying to create your own symbols until you are very comfortable with LTspice.
If you have a spice model for IR2110, post it and we can talk about putting it in a sim.
 

SgtWookie

Joined Jul 17, 2007
22,230
Here's something handy for you; a component model of the LM555 timer.

Now, LTSpice comes with an "idealized" NE555 timer. Simulations with that timer will run faster than a component model, and for many purposes it works OK.

However, if you want to get a better idea of how a real LM555 timer will act in a circuit, give this one a spin. I copied the .sub out of another simulator; and made up an .asy file that's a bit more convenient to use in a simulation than the standard pin configuration.

Attachments in the .zip file:
LM555.sub - this goes in ..\lib\sub
LM555.asy - I suggest putting it in ..\lib\sym\misc

You don't need to use the .include Spice directive with it, as LM555.sub is called out in the symbol itself.
 

Attachments

Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
Here's another generally useful item - a potentiometer.
It was originally named potentiometer, but I shortened it up to just pot.

Attached in pot.zip:
pot.sym - extract to the ..\lib\sym directory
pot.sub - extract to the ..\lib\sub directory

By default, it's a 10k pot with the wiper set halfway between the two ends.

It's a bit more handy than using two separate resistors.
You can set wiper in a range of about 0.001 to 0.999
 

Attachments

Thread Starter

shortbus

Joined Sep 30, 2009
10,045
SgtWookie and RonH, thank you both! I haven't had a chance to play around with this yet but I will. It's got to the point that I think my brain is going to explode!

Sgt, you don't happen to have one for the IR2110 do you? I really appreciate the pot and 555 as those were on my list too.

Again thank you guy's, cary
 

PRS

Joined Aug 24, 2008
989
I need an rf transformer. I'd like to tap its primary or secondary at any point I choose. Any suggestions? I'd like to specify its AL value and the coefficient of coupling, k.
 

SgtWookie

Joined Jul 17, 2007
22,230
Look in the Examples\Educational folder.
Two files:
Transformer.asc - 1:3 transformer, just 2 windings.
Transformer2.asc - A transfomer with 3 windings.

Extrapolate from there.

Note that if you right-click on an inductor, you can add several more parameters; like resistance, capacitance, etc.
If you use Ctrl+rightclick, you can click boxes on the right to make them appear in the schematic with the symbol. An "X" means they will show up. You don't type an X, you just click on the box to the right until the X shows up.

[eta]
OK, I missed the part about you wanting to specify AL.
But, the inductor component wants it specified in Henries.
You could have the simulation do the math:
uH=AL*Nturns^2/1000
And you could use the model pot.sub as a basis, where the wiper would be the percentage of the entire number of turns.
However, are you actually using a wiper on a transformer, like an autotransformer?
Or are you talking about a slug-tuned inductor?
Or something entirely different?
 
Last edited:
Status
Not open for further replies.
Top