LTSpice Tutorial New PDF
LTSpice Tutorial New PDF
(compiled by Andrew Szeto using internet sources plus helpful hints from students)
LT Spice IV is a high performance SPICE simulator, schematic capture and waveform viewer with enhancements and
models for easing the simulation of switching regulators. Included in this download are LT Spice IV, Macro Models
for 80% of Linear Technology's switching regulators, over 200 op amp models, as well as resistors, transistors and
MOSFET models. LT Spice is just as robust and useful as OrCad except that it is free (no licensure issues), minimal
circuit size limitations, and works readily on your laptops. There are a few differences between OrCad and LT Spice
(noted below). Once these are learned, any simulation that could be done using OrCad’s PSPICE also can be done
using LT Spice.
The windows version of LT Spice can be used on all versions of Windows from XP through 10. There’s also a version
of LT Spice that will work on Mac OS 10.7 and above.
To Save the files, go to File → Save and give it a descriptive name. Suggestion: Create a new folder for each new
project because every schematic produces several ancillary files that get placed in the same folder as the schematic.
Just like OrCad, LT Spice has hotkeys for each of the functions in
the tool bar. The default hotkeys for them are different from
OrCad, but they are reconfigurable by selecting: Tools → Control
Panel → Drafting Options Tab → Hotkeys Button
Suggestion: If your schematic does not show grid points and you
wish to show them. Go to Tools>Control Panel and check the
“Show schematic grid points (*)” box. You can also change the
colors of your schematic by clicking the “Color Scheme(*)”
button.
p. 1
Move and Drag Commands:
Unlike OrCad, where you can just click and drag a part or a net to move it, in LT Spice you first must select the option
to “move” or “drag” a part and then clicking on it to move it.
- move button – this command disconnects the selected wire segment or part from all its associated nodes and
allows you the place it disconnected anywhere on the schematic
Unlike OrCad, there are not separate voltage or current sources for AC, DC, Pulse, etc. One signal source can be
programmed to perform all these functions. After selecting, placing, and connecting a voltage or current source on
your schematic, right click on the source to open the window at right:
Clicking the “Advanced” button will take you to the window shown below. From this window, you can select any of
the useful functions on the left and specify the DC and AC voltages and phase on the right. When assigning
magnitudes of voltages, standard postfixes apply:
p. 2
f = F =femto = 10-15 p = P = pico = 10-12
n = N = nano = 10-9 u = U = micro = 10-6
m = M = milli = 10-3 k = K = kilo = 103
MEG = mega = 106 g = G = giga =109
Note: m or M ≠ Mega
Open the schematic capture window and create the schematic. Using any
text editor (e.g., Notepad), create a custom component file with the
extension “.sp3”, and saved it in the same folder location as this schematic.
p. 3
To use this custom part in your project, you must click the “add spice directive button”:
To link a particular transistor model to a transistor on your schematic, right click on the transistor’s name on your
schematic and input the model name from the library. For the Q1 BJT in the circuit example above, you would right-
click on “NPN” and change it to “NPNtutorial.” For the above example, the text box would look like this:
.lib C:\Users\szeto\Documents\PSPICE\tutorial\NPNtutorial.sp3
Clicking “OK” will return you to the main schematic screen with a box containing the tag for the new spice directive.
Click anywhere in the schematic to place the resulting tag and thus add this spice directive to the simulation.
C:\Program Files
(x86)\LTC\LTspiceIV\lib\cmp
IMPORTANT NOTE: If (for some reason) your computer does not allow you to edit the parts file, e.g., “standard.BJT”
or “2N2222,” save your work and exit LT Spice. Using windows explorer, search for the library file that contains the
components for LT Spice (see probable path name above). Then click on the file’s “Properties” and “Security” to
change its property so that this file can be edited (you need to be logged on with “administrator” level privileges).
Then save the changes by clicking “Apply.”
Now that you have permission to edit the library parts file, open it using a text editor. Then you’ll see a list of parts
with their various parameters. Locate and edit the part that needs to be customized -- usually by copying pasting the
part to be modified, make the changes to it -- and giving it a NEW MODEL name. For example, the BJT named
“2N2222-Spice 1” shown below has new parameters for BF and VAF. Suggestion: Keep your custom parts at the top
of your parts list for easier identification, but the order of your parts list does not matter. Now save the modified
component library file and exit your text editor. Restart LT Spice to have your modified library file take effect.
p. 5
Inserting a “custom” model directly into the schematic drawing:
This method works well if you are using a computer that will not allow you to edit the built-in library files or will not
allow you to save your edits and you have only one or two custom models that you want to use.
Open file which contains the model you want to use, and copy the model into the clipboard.
Insert a SPICE directive from the edit menu, by using the icon, or by typing 'S'.
In the text box, paste the model from the clipboard onto your schematic and then change its model name and
model parameters as desired.
Change the name of the component in your schematic to exactly match the name of your customized model.
The model name appears immediately after the word “.model” in the model definition syntax.
Now when you simulate, your new model will be used. Note: Because you have now made the custom model a part
of your schematic, your simulation circuit is self-contained and should work on another computer running LT SPICE.
Place the desired MOSFET symbol on the schematic. Must use 4 terminal MOSFETs (“NMOS4” or “PMOS4”)
Right-click on the MOSFET symbol and then specify W and L as desired (must be in microns)
To check the W/L ratio for each MOSFET, hit VIEW SPICE netlist. The transistor’s length and width are
given by L = ? and W = ? respectively.
p. 6
Running Simulations:
In the commands above, you must use <...> to designate one of the simulation options or else the default option will
be used. Choosing among the available options by using [....] is optional, however. Here are some USEFUL options:
.op (detailed DC operating point information) can be run in conjunction with other simulations. Otherwise
only one simulation type can be run at a time. This is a simple, but incredibly useful DC analysis (all caps =
open circuits and all inductors = short circuits). It will not give you anything to plot, but it will indicate the DC
voltages at all nodes and DC currents through all devices in the circuit. To have node voltages appear on the
schematic, .op must be selected together with any other simulation type.
When .op is run by itself, Node voltages, drain/collector currents, transistors’ operating point parameters,
and junction voltages & capacitances all can be viewed within the Error Log (i.e., the Spice output text file).
Open the Error Log (a text file) as follows: View → Spice Error Log or by pressing the hotkey “Ctrl+L.” This
file can now be printed also.
.tf (small-signal transfer function) When the small-signal transfer function (.tf) is selected, a pop up
window will appear after the simulation and display the values based on the input and output terminals that
was specified earlier.
.trans (or Transient analysis) is probably the most important analysis you can run in LTspice, and it computes
various values of your circuit over time. Two very important parameters in the transient analysis are: Stop
Time, Time to Start Saving Data, Maximum Timestep size
The ratio of Stop Time: Maximum Timestep determines how many calculations LTspice must make to plot a wave
form. LTspice always defaults the start time to zero seconds and going until it reaches the user defined final time. It
p. 7
is incredibly important that you think about what timestep you should use before running the simulation, if you make
the timestep too small the probe screen will be cluttered with unnecessary points making it hard to read, and taking
extreme amounts of time for LTspice to do the simulation. If you set the timestep too high you might miss important
phenomenon that are occurring over very short periods of time in the circuit. Therefore play with step time to see
what works best for your circuit and will give you smooth and accurate waveforms. You can set a step ceiling which
will limit the size of each interval, thus increasing calculation speed.
.Fourier (Fourier analysis) is another handy feature that allows you to specify the fundamental frequency and the
number of harmonics desired in analyzing the signal at any node. LT Spice defaults to calculating the nine lowest
harmonics unless you specify
otherwise. Nine harmonics will
allow you to decompose a square
wave to see it's components and to
find the total harmonic distortion by
summing the harmonics.
Naming Nets/Nodes:
Suggestion: give descriptive names to key nodes or nets such as Vout or Vin. Use the following procedure to name a
node or net in LT Spice.
The top choice is for grounds; the middle choice is for assigning power rails
like VCC and VDD ; and the bottom choice is for specifying custom node/net
names, e.g., Vout or Vin.
Alternatively, you can simply right-click on the desired node and select “Label Net.” This will bring up the above pop-
up window. Then follow same procedure as above.
.OP & ERROR LOG: Displaying Node Voltages in the Schematic and the Transistor’s Operating Point Parameters
Valuable diagnostic information can be found in the .OP and Error-Log files. In order to know the node voltages in
your schematic, the “.op” simulation must be performed. Then left click on the desired net or node to bring up a box
above the cursor. This box is the node voltage tag. Simply place this tag on the node to display its voltage.
Unlike OrCad’s PSPICE, LT Spice does not show branch currents on the schematic itself. To view the node voltages,
branch currents or the transistors’ operating point parameters, the simulation option .op must be activated. To view
the node voltages and branch currents after your simulation, do the following: Toolbar → View → .op
p. 8
The transistor currents and key parameters can then be viewed in the .OP output file as follows: Toolbar → View →
Spice Error Log. Using the hot key “Ctrl+L” also will bring up the error log (i.e., the Spice output text file). To print the
Error Log, copy and paste it into a text editor such as Notepad.
How do I run a netlist? LTspice IV will recognize the file as a netlist if it has file extension of ".cir” Just open the text
file first and then run it.
Start LTSpice open the *.cir file from the "file" menu click anywhere in the file to be sure its active click
the Run button (Running Man symbol).
As part of your SPICE documentation, submitting a complete record of the simulation results is often required. Such
a file would include the net list; simulation commands; circuit errors; name, time, and date of the simulation; default
transistor parameters; characteristics of each transistor at its operating point; node voltages (if the .op option was
picked); output currents of the voltage sources; power dissipation; small signal input resistance, small signal output
resistance, and transfer gain; and harmonic distortion.
In OrCad’s PSPICE, all this information would be found in one large text file having the “__.out” extension. Search for
the location of this file and then copy and paste it into a text editor or your word processor program.
In LT Spice, such valuable information would be found in the Net List, .OP file, and the Error Log. To view the “SPICE
Error log.” Click tool bar View SPICE Error Log (or press CTRL-L shortcut). Copy and paste the desired
portions of the simulation results into a text editor (e.g., WordPad) or a word processing program. A similar
procedure would be used for the Net List and .OP files.
Average power dissipation (PD) at circuit’s operating point for any given component will be shown at the
screen’s bottom by placing your cursor over that component. To obtain PD for your entire circuit, place your
cursor over +VCC and sum. Note: you must first simulate your circuit with the .OP option activated.
Instantaneous power dissipation for each circuit component can be viewed by holding down the ALT key and
left clicking on the component of interest. The pointer will change to a thermometer and a plot of the
instantaneous PD will be shown. Note: you must first perform a transient simulation of your circuit.
Once a simulation that yields a waveform or bode plot is run, an empty window will pop up to allow you to insert
plots. For bode plots, magnitude will be automatically expressed in dB and phase in degrees. The transient plots and
DC sweeps are plotted in volts. Right clicking on a trace allows you to edit its line color, thickness, and other
parameters.
p. 9
To mark key points on a plot or to more closely investigate them, left click on the name of the trace name at the top
of the graph to bring up a movable cursor. The exact value of the magnitude, phase, and frequency at the cursors’
location will be shown in a nearby pop up window. To investigate additional points, clicking on the trace name again
to bring up a second cursor and repeat.
Hit “CTRL-P” to print the plot using black lines on a white background. You also can export as a pdf file your SPICE
plots for later printing. Avoid using “Print Screen” or screen shot if you do NOT want to print your waveform using
light colored lines on a very dark background. Such plots are not very readable and very wasteful of ink. Also make
sure that your plots are sized for easy readability.
Select from your command bar Plot Settings Notes & Annotations Label Cursor Position. This places a label
(frequency and either the magnitude or phase) at the active cursor’s last location. To select which label, choose
between magnitude and phase in the pop-up window when a cursor is activated.
p. 10