LTspice – adding an element model to the schema

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.


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 *
* Contains Proprietary Information *
* Which is The Property of *
*Commercial Use or Resale Restricted *
* by Symmetry License Agreement *
* Model generated on Dec 9, 03
* 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
* 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
*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.

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:

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:

*---------- DMG3402L Spice Model ----------
 .SUBCKT DMG3402L 10 20 30 
 M1 1 2 3 3 NMOS L = 1E-006 W = 1E-006 
 RD 10 1 0.01938 
 RS 30 3 0.001 
 RG 20 2 2.05 
 CGS 2 3 4.156E-010 
 EGD 12 0 2 1 1 
 VFB 14 0 0 
 FFB 2 1 VFB 1 
 CGD 13 14 5.7E-010 
 R1 13 0 1 
 D1 12 13 DLIM 
 DDG 15 14 DCGD 
 R2 12 15 1 
 D2 15 0 DLIM 
 DSD 3 10 DSUB 
 .MODEL NMOS NMOS LEVEL = 3 VMAX = 5.378E+005 ETA = 0.001 VTO = 1.394 
 TOX = 6E-008 NSUB = 1E+016 KP = 32.82 U0 = 400 KAPPA = 10 
 .MODEL DCGD D CJO = 3.123E-010 VJ = 0.6 M = 0.6 
 .MODEL DSUB D IS = 2.225E-010 N = 1.229 RS = 0.02329 BV = 35 CJO = 2.22E-010 VJ = 0.6 M = 0.6211 
 .MODEL DLIM D IS = 0.0001 
 *Diodes DMG3402L Spice Model v1.0M Last Revised 2016/5/9 

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.