- To add an intrinsic component, a ‘.model’ file needs to be saved in the LTC LTspiceIV lib sub directory and for an extrinsic component, a ‘.subckt’ file needs to be added. Steps to include new device/ component models into an LT Spice schematic: METHOD 1: 1) Firstly, one needs to download the required device model having a.lib extension.
- Sound like the symbol is missing parameters needed with the CD4000.lib library file. Open the symbol and: 1. Add this to the 'Spiceline' field: VDD=5 SPEED=1.0 TRIPDT=5e-9 VDD sets the supply voltage. Change 5 to whatever voltage your circuit uses. Add this to the 'Spicemodel' field: VDD 0 This is for internal use by the library.
LTSpice has a large built-in library of elements. But sometimes we need an element that is not in the library. Electronics manufacturers themselves provide models of elements that they publish in the form of text files.The easiest way is to add an element to the library.But sometimes I want to be able to send someone a simulated circuit.In this case, we had to attach all the elements in the library, and someone else would have to import it.But there is another way out of this situation and I will present this solution.
Ltspice Add Library
Diode
LTSpice has a large built-in library of elements. But sometimes we need an element that is not in the library. Electronics manufacturers themselves provide models of elements that they publish in the form of text files. The easiest way is to add an element to the library. But sometimes I want to be able to send someone a simulated circuit. Locating the library directory. In case of Windows installation of LTspice XVII; usually the library directory is located inside of LTspice folder in 'My Documents' directory. After opening the LTspice folder you will have to open 'lib' folder. This directory represents the library location composed of 'cmp', 'sub' and 'sym' folders.
Suppose we want to add a MM5Z6V2S diode to the diagram.We go to the manufacturer’s website and search for our diode. On the website, go to the tab: “Technical Documentation & Design Resources”. We have a position there “Simulation Models”.
After hovering over the menu, you will see a list with 2 types of files.

For example, click on the first item (“PSpice Model”), then download the text file with the model of our diode. When you open this file in any text editor we will see:
.SUBCKT mm5z6v2st1 2 1
**************************************
* Model Generated by MODPEX *
*Copyright(c) Symmetry Design Systems*
* All Rights Reserved *
* UNPUBLISHED LICENSED SOFTWARE *
* Contains Proprietary Information *
* Which is The Property of *
* SYMMETRY OR ITS LICENSORS *
*Commercial Use or Resale Restricted *
* by Symmetry License Agreement *
**************************************
* Model generated on Dec 9, 03
* MODEL FORMAT: PSpice
* anode cathode
*node: 2 1
* Forward Section
D1 2 1 MD1
.MODEL MD1 D IS=3.36832e-08 N=2.4425 XTI=1 RS=0.562
+ CJO=9e-11 TT=1e-08
* Leakage Current
R 1 2 MDR 8e+07
.MODEL MDR RES TC1=0 TC2=0
* Breakdown
RZ 2 3 1.66202
IZG 4 3 0.12
R4 4 3 100
D3 3 4 MD3
.MODEL MD3 D IS=2.5e-12 N=0.0205799 XTI=0 EG=0.1
D2 5 4 MD2
.MODEL MD2 D IS=2.5e-12 N=0.0645282 XTI=0 EG=0.1
EV1 1 5 6 0 1
IBV 0 6 0.001
RBV 6 0 MDRBV 6169.05
.MODEL MDRBV RES TC1=0.000331656
*– PSpice DIODE MODEL DEFAULT PARAMETER
* VALUES ARE ASSUMED
*IS=1E-14 RS=0 N=1 TT=0 CJO=0
*VJ=1 M=0.5 EG=1.11 XTI=3 FC=0.5
*KF=0 AF=1 BV=inf IBV=1e-3 TNOM=27
.ENDS mm5z6v2st1
It is very important that the “.SUBCKT” command is in the file. Otherwise, this method may not work. After downloading, we open LTSpice and create a new schematic. After that, click “Spice Directive“:
In the new window, paste the contents of the text file diode model:
It is very important that the Spice directive position is selected, not Comment. Click OK and click on schemat. Then we will paste our directive.
After that we add elements of our scheme. Of course, we must have a diode in the schematic.
Right click on the diode with the Ctrl key pressed simultaneously. In the new window, we need to change the prefix, for example, to “X”, and Value to the value from the model. The model name can be found after the .SUBCKT directive.
Add To Library Lt Spicewood
Click Ok and run the simulation.If there is no problem with our model, an additional window to the charts should be displayed.If an error occurs, an additional text window will open with information about the error.
We will click, for example, on the cathode of the diode, we will see its potential:
Now we can give our diagram to anyone. There is no need to include a library of elements.
N-MOSFET Transistor.
Now let’s add the N-MOSFET transistor. Let it be a DMG3402L transistor.
We go to the manufacturer’s website and find the transistor we are interested in: https://www.diodes.com/products/discrete/mosfets/mosfet-master-table/n-channel/n-channel-30v/
In the “Spice Model” column, click on the file with the Spice model of our transistor. A plain text file with the content of the model will open:
Remember that the file must contain the “.SUBCKT” directive.
The content of the file should be pasted as “SPICE directive”.
Then we create a simple circuit consisting of the general symbol of the N-MOSFET transistor, two voltage sources, and a resistor.
If we try to run the simulation now, we can see that the transistor is not working. Despite the input signal, the transistor output is not turned on:
Click with the right mouse button together with the Ctrl key pressed on the symbol of the N-MOSFET transistor. We change the value of Prefix to “X” and in the Value field we enter the value from the directive .SUBCKT, in this case “dmg3402l”.
After that, we run the simulation again:
Now we can see that the model is working properly. This time we added the N-MOSFET model of the transistor to our simulation.
Just last day I was searching all over the net to find out how this is done. In order for you to not have the trouble I went through, I am posting it here.
TRYING TO CREATE IRF540N from IRF540N.SPI
This is the process I have used to add .LIB files from ONsemi and .SPI files from IRF into my LTSPICE program.
In case of SPI file just rename it to a LIB file. Then place the LIB file in /SPICE/LIB/sub directory
Select a component file (with extension .asy) that looks like your new one from libsym
Lets say nmos.asy
(If you want to place the new component under a new category, create a new Directory here as CATEGORYNAME) and copy the file libsymnmos.asy to libsimCATEGORYNAMEIRF540N.asy
Open 1N5338B.asy in a text editor, and make the following changes:
* change SYMATTR Prefix D to SYMATTR Prefix X
(This says that the model we're using is a .subckt.)
* change SYMATTR Value D to SYMATTR Value IRF540N
(This says that the name that will show up on the schematic is IRF540N.)
* add a line SYMATTR ModelFile IRF540N.LIB
(This says that the name of the file containing the subcircuit we're using is 1N5338B.LIB.)
* add a line SYMATTR SpiceModel IRF540N
Restart LTSpice and you will have the component there.
DERIVED from what was found on this page : https://denethor.wlu.ca/ltspice/