Adding transistor library to LTSpice

Thread Starter

SamR

Joined Mar 19, 2019
5,031
Need a basic transistor library and found what I think I want on the LTS wiki. http://ltwiki.org/index.php?title=Standard.bjt This is a large text file and not broken down into .asy components. Would some kind person lead me through this maze? At this point I just want some basic BJTs but know that I will need to expand on this to many different semiconductors. Some components are already in the basic load that I have but not the BJTs. I will also be needing opamps, SCR, Darlington, diode, JFET and MOSFET.

Thanks, Sam
 

ericgibbs

Joined Jan 29, 2010
18,766
hi Sam.
One way I do it is to use a text editor, Copy the 'model' description of the transistor text you are wanting from the link you have posted.
Open standard.bjt folder in your LTSpice and Paste in the Copied text.
That added transistor should appear in the F2 window and transistor types.
Tell me which transistor type you are hunting for and I will go thru the steps, if you need further help.
E

example:
.model kt3102e npn bf=5000 br=5 is=.2p tf=.4n cjc=12p cje=12p vaf=100 tr=45n rc=.5 rb=1.5k rbm=80 irb=10u ikf=50m xcjc=0.3 kf=5f eg=1.11 ne=1.35 ise=0.1p nc=2 isc=1p Vceo=20 Icrating=100m mfg=USSR
AAA 448 18.03.gif
 
Last edited:

Thread Starter

SamR

Joined Mar 19, 2019
5,031
OK I already copied the file to a plain.txt file. So I need to add a BJT subdirectory to

1595870260649.png
And paste in the entire text file? For now, maybe just the 2N3904 to see how it's done. I sure don't need all the USSR xstrs in that file I will never use.
 

Papabravo

Joined Feb 24, 2006
21,159
You can also copy a single line from the large library into a file in the folder with your schematic named "2Nxxxx.mod". Actually the filename and the extension can be chosen arbitrarily. Then in you schematic put in a spice directive that says: ".include 2Nxxxx..mod". On the schematic call up either the "npn" generic NPN, or the "pnp" generic PNP device and change the symbol name to "2Nxxxx"

Alternatively you can paste the model statement into your schematic as a spice directive.

When you are happy with it and want to keep it just put a copy in %HOMEPATH%\LTspiceXVII\lib\sub

The stuff in the \sub directory can be any kind of thing as long as the spice engine understands the syntax and semantics. Also checkout the ".lib" which has slightly different search rules than ".include". You might also be able to have a separate BJT library in the \cmp folder. Read the Help pages on .lib and .include
 
Last edited:

ericgibbs

Joined Jan 29, 2010
18,766
Hi Sam,
Find the standard.bjt folder in your LTSpice, I use Microsoft Explorer to display the files
This is my Path to the folder, Yours should be the same.
Use a text editor to open standard.bjt file, you should see the list of all the transistors you have available.
Paste the the transistor model text into that folder.
Ask if you have problem.


AAA 449 18.19.gif


Update:

For reference this is the Path in C Hard Drive,
AAA 450 19.24.gif
 
Last edited:

Thread Starter

SamR

Joined Mar 19, 2019
5,031
Okay, I have a screwup. Somehow my LTC is pointing to another location where the libraries are located. NOT the libraries under the application but elsewhere under my stored documents. Somehow I have it pointing to the wrong location. I found that under CMP there are already several of the basic BJTs already but they are not showing up in the application.
1595872124316.png
The correct path should be under
"C:\Program Files\LTC\LTspiceXVII\XVIIx64.exe"

Somehow (when I installed the libraries?) it is pointing to the wrong place OR
I need to install it where it is currently pointing. What I can't do is see what is already there under CMP?
 

Papabravo

Joined Feb 24, 2006
21,159
The libraries are no longer kept in the Program Folders. The reason for this change is that Windows locks down the program folders on some machines for users without Administrator status. So they moves the active libraries to the Documents folder. If you compare the two they should be the same except for the stuff you add to your documents folder. This way LTspice can update it own stuff and leave yours alone.
 

Papabravo

Joined Feb 24, 2006
21,159
This is my ....\sym folder after merging @Bordodynov 's huge archive
The blue color signifies folders and files in my Documents folder, but no in the Program Files folder

LTspice_lib_sym.png

The files in blue show up in the select component dialog box at the top level. For all of Alex's other gems you dive into the ValVol or ZZZ subfolders and it's all there. Russian transistors and all. Reminds me of the old saying about being careful what you wish for. This embarrassment of riches has increased the time it takes to backup my drive.
 
Last edited:

Thread Starter

SamR

Joined Mar 19, 2019
5,031
1595874915283.png
And in standard.bjt is plenty of what I need.
* Copyright (c) 2000-2020 Analog Devices, Inc. All rights reserved.
*
.model 2N2222 NPN(IS=1E-14 VAF=100 BF=200 IKF=0.3 XTB=1.5 BR=3 CJC=8E-12 CJE=25E-12 TR=100E-9 TF=400E-12 ITF=1 VTF=2 XTF=3 RB=10 RC=.3 RE=.2 Vceo=30 Icrating=800m mfg=NXP)
.model 2N2907 PNP(IS=1E-14 VAF=120 BF=250 IKF=0.3 XTB=1.5 BR=3 CJC=8E-12 CJE=30E-12 TR=100E-9 TF=400E-12 ITF=1 VTF=2 XTF=3 RB=10 RC=.3 RE=.2 Vceo=40 Icrating=600m mfg=NXP)
.model 2N3904 NPN(IS=1E-14 VAF=100 Bf=300 IKF=0.4 XTB=1.5 BR=4 CJC=4E-12 CJE=8E-12 RB=20 RC=0.1 RE=0.1 TR=250E-9 TF=350E-12 ITF=1 VTF=2 XTF=3 Vceo=40 Icrating=200m mfg=NXP)
.model 2N3906 PNP(IS=1E-14 VAF=100 BF=200 IKF=0.4 XTB=1.5 BR=4 CJC=4.5E-12 CJE=10E-12 RB=20 RC=0.1 RE=0.1 TR=250E-9 TF=350E-12 ITF=1 VTF=2 XTF=3 Vceo=40 Icrating=200m mfg=NXP)

EDITED OUT ~95% of it for brevity
 

ericgibbs

Joined Jan 29, 2010
18,766
hi Sam.
If you use a text editor to open the 'standard.bjt' you see a complete list of all your transistor models, Paste the new transistor models to that list and then save the standard.bjt folder.
When you start LTS choose a NPN or PNP from the F2 opened menu, place the transistor symbol it on your drawing and click to select a new transistor, find the one you have just pasted in and select.
E
 

Papabravo

Joined Feb 24, 2006
21,159
There is no Add Component that I am aware of:

There is the F2 Key or the "Componet" icon. either one of those takes you to the "Select Component Symbol" Dialog Box. The contents of that Dialog Box represent the files and the sub-folders in the ...\sym folder underneath your %HOMEPATH%\Documents\LTspiceXVII\lib . So you place an NPN generic transistor symbol and right click the mouse to say "Done" with placing symbols. Now you hover over the symbol with the cursor and right click to bring up the Bipolar Transistor Dialog Box which contains a button that is labeled "Pick New Transistor". When you press that button you go to the ...\cmp folder and to the file "standard.bjt". This is how you get so called "standard" parts.

As has been previously mentioned there are alternate to make this happen including the use of the .lib and .include spice directives. If you set these up properly LTspice will find the specific file you are looking for. All you have to in that is change the name of the symbol from NPN to the desired part name. Use the part name from inside the included file and not the file name itself.

I also may not have mentioned that you can paste a transistor model into a schematic as a spice directive and be done with paths and libraries and such.

PS - Don't feel like you're all alone out there. It took me a while and some experimentation to figure it all out. I still go astray from time to time.
 

eetech00

Joined Jun 8, 2013
3,859
Need a basic transistor library and found what I think I want on the LTS wiki. http://ltwiki.org/index.php?title=Standard.bjt This is a large text file and not broken down into .asy components. Would some kind person lead me through this maze? At this point I just want some basic BJTs but know that I will need to expand on this to many different semiconductors. Some components are already in the basic load that I have but not the BJTs. I will also be needing opamps, SCR, Darlington, diode, JFET and MOSFET.

Thanks, Sam
For future reference, you don't need to paste anything into the existing standard.bjt file. The standard.bjt from LTwiki is meant to REPLACE the existing file. All you need to do is:

1. Shutdown LTspice.
2. Find the existing native standard.bjt file, then rename it to something like "standard_bjt.orig".
3. Copy the replacement standard.bjt to the same folder as the original.
4. Done

5. Start LTspice and open a schematic.
6. Choose a transistor symbol from the component selector and place on schematic.
7. Rht-Clk the transistor symbol, then select "Pick a new transistor". All the transistor models in the replacement standard.bjt will be shown in the list. Pick one.:)
 

Thread Starter

SamR

Joined Mar 19, 2019
5,031
Copy the replacement standard.bjt to the same folder as the original.
That is what I surmised. The original, once I figured out how I was supposed to be doing it, has all I need for now. Nice thing about LTS is I can model the problems in it to see if my answers are correct when the book doesn't show one. Was very helpful when I was doing resistive and reactive circuits but now moving on to semiconductors for a while. New tricks to learn!
 

ericgibbs

Joined Jan 29, 2010
18,766
hi Sam,
You did say you wanted to expand the semiconductor BJT models with some basic BJTs, Copying and Pasting a specific BJT addition is a simple way to go.
If I had realised you wanted to replace the existing standard.bjt file with the LTwiki bjt, renaming the old bjt folder to say bjt.old and then Copy the LTwiki, as described by eetech, would have been suggest.

A point to note if your original bjt had any added 'unusual' bjt models included, they may not be in the LTwiki.

E
 

Thread Starter

SamR

Joined Mar 19, 2019
5,031
My immediate problem was NO BJTs available when adding a component other than the generic NPN and PNP. What I missed was after adding the generic NPN was the ability to click on it and change it to a specific model. That was all I need for now. I also kept the LT Wiki file for future consideration if the need arises and know what to do to add it in if needed. Thx for the help guys. Much appreciated.

Sam
 
Top