LTSpice Tutorial
LTSpice Tutorial
For
Electronic Devices
10th Edition
Thomas L. Floyd
Prepared by
Gary D. Snyder
Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto
Delhi Mexico City Sao Paolo Sydney Hong Kong Seoul Singapore Taipei Tokyo
i
______________________________________________________________________________
Copyright © 2018 by Pearson Education, Inc. or its affiliates. All Rights Reserved. Printed in the United States of
America. This publication is protected by copyright, and permission should be obtained from the publisher prior to
any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise. For information regarding permissions, request forms and the
appropriate contacts within the Pearson Education Global Rights & Permissions Department, please
visit www.pearsoned.com/permissions/.
The LTSpice IV application, models, and subcircuits are the property of their respective copyright holders.
Instructors of classes using Electronic Devices, Tenth edition, by Thomas L. Floyd, may reproduce material from the
Instructor’s Resource Manual and Test Bank for classroom use.
10 9 8 7 6 5 4 3 2 1
www.pearsonhighered.com
Page ii
Contents
Preface ............................................................................................................................ v
1. Introduction to the LTSpice Software .................................................................. 1
2. Creating Circuits with LTSpice ............................................................................. 9
3. Transient Circuit Simulation ............................................................................... 27
4. AC Circuit Simulation .......................................................................................... 49
5. Models .................................................................................................................. 63
6. Subcircuits ........................................................................................................... 83
7. In Summary ........................................................................................................ 101
Page iii
Preface
Using Windows
This workbook assumes that you are familiar with using Microsoft ® Windows® (starting applications, opening files,
saving files, etc.) and with standard Windows operations and terminology (double-clicking icons, minimizing
windows, etc.). If you have any questions about Windows software, refer to the on-line help or standard Windows
documentation.
LTSpice IV Software
This workbook also requires you to have a copy of the LTSpice IV software (referred to as “LTSpice” throughout this
tutorial). Although the chapters may reference and discuss material specific to a particular version of LTSpice the
information is generally applicable to all versions.
v
Section 1 - Introduction to the LTSpice Software
Page 2 of 106
Section 1 - Introduction to the LTSpice Software
Page 3 of 106
Section 1 - Introduction to the LTSpice Software
Page 5 of 106
Section 1 - Introduction to the LTSpice Software
Page 6 of 106
Section 1 - Introduction to the LTSpice Software
greatly simplify working with circuit designs. In the following section you will learn how to use some of
these tools to create, modify, and save your circuit designs.
Page 7 of 106
Section 2 - Creating Circuits with LTSpice
Page 10 of 106
Section 2 - Creating Circuits with LTSpice
Page 11 of 106
Section 2 - Creating Circuits with LTSpice
6. Move the capacitor into the workspace, as shown in Figure 2-7.
Page 12 of 106
Section 2 - Creating Circuits with LTSpice
Page 13 of 106
Section 2 - Creating Circuits with LTSpice
Page 15 of 106
Section 2 - Creating Circuits with LTSpice
Page 16 of 106
Section 2 - Creating Circuits with LTSpice
Page 17 of 106
Section 2 - Creating Circuits with LTSpice
Prefix Prefix
Multiplier Multiplier
Metric LTSpice Metric LTSpice
-15 0
10 femto- f or F 10 None None
10-12 pico- p or P 103 kilo- k or K
-9 6
10 nano- n or N 10 mega- meg or MEG
10-6 micro- u, U, or µ* 109 giga- g or G
-3 12
10 milli- m or M 10 tera- t or T
*To enter “µ”, as shown in Figure 2-24, press and hold the ALT key while quickly entering 230 (ALT+230).
Page 18 of 106
Section 2 - Creating Circuits with LTSpice
The unit prefixes in LTSpice are case-insensitive, so that either upper case, lower case or a mix of
upper and lower case is acceptable. Note that there must be no spaces between the value and the
unit prefix.
4. Click the OK button. Your schematic now should like something like Figure 2-25.
Page 19 of 106
Section 2 - Creating Circuits with LTSpice
Page 20 of 106
Section 2 - Creating Circuits with LTSpice
Page 21 of 106
Section 2 - Creating Circuits with LTSpice
Page 22 of 106
Section 2 - Creating Circuits with LTSpice
Page 23 of 106
Section 2 - Creating Circuits with LTSpice
If you have saved the file before, LTSpice will save it to location in which the file was previously saved
with the same name.
Page 24 of 106
Section 2 - Creating Circuits with LTSpice
Page 25 of 106
Section 3 - Transient Circuit Simulation
Page 27 of 106
Section 3 - Transient Circuit Simulation
Page 28 of 106
Section 3 - Transient Circuit Simulation
Page 30 of 106
Section 3 - Transient Circuit Simulation
Page 31 of 106
Section 3 - Transient Circuit Simulation
Von(V): The active level for the output of the voltage source. For this simulation the
active level of the voltage source is 1 V.
Tdelay(s): The time before the output of the voltage source becomes active. For this
simulation the output of the voltage source will remain inactive (0 V) for
1 ms.
Trise(s): The time for the output of the voltage source to change from its inactive to
active level. For this simulation the output of the voltage source takes 10
ns to change from an inactive (0 V) to active level (1 V).
Tfall(s): The time for the output of the voltage source to change from its active to
inactive level. For this simulation the output of the voltage source takes
10 ns to change from an active (1 V) to inactive (0 V) level.
Ton(s): The time that the output of the voltage source remains active. For this
simulation the output of the voltage source is active (1V) for 5 ms.
Tperiod(s): The time for the voltage source to complete one cycle (one active level
followed by one inactive level). For this simulation the period of the
voltage source is 10 ms, corresponding to a frequency of 100 Hz and duty
cycle of 50%.
Ncycle: The number of cycles for the voltage source to repeat. If no value is given,
the output of the voltage source will generate cycles until the simulation
ends.
4. Click the OK button to exit the Independent Voltage Source configuration window and return to
the LTSpice workspace. The schematic should now appear similar to Figure 3-12.
Page 32 of 106
Section 3 - Transient Circuit Simulation
3) It simplifies circuit design by allowing modular sub circuits to be added, deleted, and modified
more easily.
Whether or not to use net labels is a matter of personal preference, but for this simulation use net labels to
connect the terminals of the voltage source to the RC circuit. Since a net label for the input to the RC
circuit already exists, the existing net label can be duplicated and connected to the voltage source.
1. From the LTSpice tool bar, click the Copy tool, shown in Figure 3-13.
Page 33 of 106
Section 3 - Transient Circuit Simulation
Page 34 of 106
Section 3 - Transient Circuit Simulation
Figure 3-18: Schematic with Output Net Label for Signal Source.
9. Finally, wire the IN net label and ground to the terminals of the signal source, as shown in Figure
3-19.
Page 35 of 106
Section 3 - Transient Circuit Simulation
Page 36 of 106
Section 3 - Transient Circuit Simulation
Page 37 of 106
Section 3 - Transient Circuit Simulation
Page 38 of 106
Section 3 - Transient Circuit Simulation
Page 39 of 106
Section 3 - Transient Circuit Simulation
3. Click the Attached Cursor: button.
4. From the drop-down list, select 1st as shown in Figure 3-30.
Page 40 of 106
Section 3 - Transient Circuit Simulation
Figure 3-34: Waveform Display with Cursors Assigned to V(in) and V(out)
Note that the Cursor Information window shows the difference in time and voltage between the
V(in) and V(out) waveforms to simplify differential measurements.
7. Position the Windows cursor over the LTSpice cursors so that LTSpice displays a yellow “1”.
8. Click and drag Cursor 1 to the left until the horizontal (time) position is 14 ms, as shown in Figure
3-35 and Figure 3-36. Note how the horizontal and vertical measurements change for V(in) as the
cursor is moving.
Page 41 of 106
Section 3 - Transient Circuit Simulation
Page 42 of 106
Section 3 - Transient Circuit Simulation
Figure 3-43: Cursor Information Window for Manually Rescaled Horizontal Axis
Page 43 of 106
Section 3 - Transient Circuit Simulation
Page 44 of 106
Section 3 - Transient Circuit Simulation
Figure 3-46: Resized and Reorganized Waveform Display with Added Plot Pane
Page 45 of 106
Section 3 - Transient Circuit Simulation
Page 46 of 106
Section 3 - Transient Circuit Simulation
Page 47 of 106
Section 3 - Transient Circuit Simulation
Page 48 of 106
Section 4 - AC Circuit Simulation
4. AC Circuit Simulation
4.1 Introduction
The last chapter demonstrated how to use transient circuit simulation in LTSpice to simulate and measure
circuit quantities such as voltage, current, and power in the time domain. In this chapter you will learn how
to use ac circuit simulation to simulate and measure the amplitude and phase of circuit quantities in the
frequency domain.
Much of what you learned for running a transient circuit simulation applies to ac circuit simulation. Just as
with transient circuit simulation, ac circuit simulation in LTSpice requires you to specify a signal source to
stimulate the circuit, configure the ac simulation, and specify which signals you wish to monitor. You also
can change the vertical and horizontal axes of the waveform display and use cursors to measure the
amplitude and phase of selected circuit quantities for specific frequencies.
In this chapter you will
Page 49 of 106
Section 4 - AC Circuit Simulation
Page 50 of 106
Section 4 - AC Circuit Simulation
5) Move the cursor to the left to reposition the circuit, as shown in Figure 4-6. If you wish, press the
ESC key to escape and terminate the move operation. This will leave the circuit position
unchanged.
Page 51 of 106
Section 4 - AC Circuit Simulation
Page 52 of 106
Section 4 - AC Circuit Simulation
7) Repeat Steps 4 through 6 to place another copy of R and C into the circuit, using either R1 and C1
or R2 and C2 as the original. The circuit should now look similar to Figure 4-13.
Page 53 of 106
Section 4 - AC Circuit Simulation
Page 54 of 106
Section 4 - AC Circuit Simulation
Page 55 of 106
Section 4 - AC Circuit Simulation
If “AC 1” is over other text for the signal source, use the Move tool to reposition it.
Page 56 of 106
Section 4 - AC Circuit Simulation
Page 57 of 106
Section 4 - AC Circuit Simulation
2) Click on the circuit file window to make it active, and select the IN net. The ac simulation window
will be similar to Figure 4-25.
Page 58 of 106
Section 4 - AC Circuit Simulation
Page 59 of 106
Section 4 - AC Circuit Simulation
5) Right-click the V(out) label at the top of the waveform display to open the Editor Expression
window.
6) Select “1st” from the “Attached Cursor” drop-down list. The simulation window should look like
Figure 4-28.
Page 60 of 106
Section 4 - AC Circuit Simulation
Because you did not assign net labels to the nets for the junctions of R1 and C1 and R2 and C2,
LTSpice uses the default node names assigned to them (i.e., n001 and n002). If you plan to probe
numerous parts of the circuit, assigning net labels to them is a good idea to avoid possible
confusion.
10) Add the currents through resistors R1, R2, and R3 to the simulation display.
11) Use the Add Plot Pane in the Plot Settings menu in the LTSpice simulation toolbar to add an
additional plot pane to the simulation display.
12) Move the voltage waveforms to the plot pane. The display should look similar to Figure 4-31.
Page 61 of 106
Section 5 - Models
5. Models
5.1 Introduction
One aspect of LTSpice that this chapter will cover is how it “knows” how to simulate the circuits you have
constructed. The simplest explanation is that it applies Ohm’s Law, Kirchhoff’s Laws, and other
mathematical functions to the circuit file just as you would to a circuit diagram. To do so, LTSpice uses
models to determine how circuit components will respond to voltages and currents that are applied to them.
Some components (resistors, capacitors, and inductors) are assumed to be ideal and the LTSpice models
them as such, although you can specify some parasitic effects (such as series resistance for inductors) using
the component properties window. Other components, such as diodes and transistors, use more complicated
models. These models incorporate real-world factors, such as junction capacitance, barrier potential, and
reverse breakdown voltage that cause real-world components to deviate from their ideal behavior.
LTSpice includes models for many common manufacturer parts, but sometimes the exact model you want
is not included. When the model for a part you wish to simulate is not available within LTSpice, you have
several options.
1) Use a part similar to the part you wish to use.
2) Check the manufacturer web site for a SPICE model. Some will have a model specifically
designed for LTSpice, but others may have models for PSPICE or other SPICE-based simulation
programs. LTSpice typically can use these models with little or no modification.
3) Use component parameters to edit the model for a similar part.
In this section you will learn:
The general format of SPICE models
How to locate manufacturer parts in LTSpice
How to modify existing models using the SPICE directive editor
How to use LTSpice help menu
Page 64 of 106
Section 5 - Models
Page 66 of 106
Section 5 - Models
Page 67 of 106
Section 5 - Models
Page 68 of 106
Section 5 - Models
Page 69 of 106
Section 5 - Models
Page 70 of 106
Section 5 - Models
Page 71 of 106
Section 5 - Models
Page 72 of 106
Section 5 - Models
Page 74 of 106
Section 5 - Models
Page 75 of 106
Section 5 - Models
Figure 5-38: Input and Output Waveforms for 1N750 Zener Diode
If you carefully compare the V(out) waveform for the 1N750 zener diode with those using the
modified MyDiode model of a generic diode you should notice that the zener diode waveform
differs as the input voltage approaches the zener breakdown voltage. This is because zener diodes
are optimized to operate in the reverse breakdown region, so that their behavior in the breakdown
region differs from that for regular diodes.
9) Save the plot settings.
Page 76 of 106
Section 5 - Models
Figure 5-40: Copying the 1N750 Model into the Text Editor
The model directive for the 1N750 is rather long, so edit it to add a line break so that it will be
easier to edit and place into the circuit.
8) Use the left arrow key to position the test insertion cursor just before the “Ivb=20.245m”
parameter shown in Figure 5-41.
Page 77 of 106
Section 5 - Models
Figure 5-43: Adding the “+” Continuation Symbol to the New Line
11) From the Justification drop-down list, select “Center”, as shown in Figure 5-44.
Page 78 of 106
Section 5 - Models
Page 79 of 106
Section 5 - Models
20) Right-click 1N750 to open the dialog box shown in Figure 5-52.
Page 80 of 106
Section 5 - Models
Figure 5-55: Input and Output Waveforms for 1N750 Modified Model
As waveform measurements will show, the breakdown voltage for the modified 1N750 zener
diode model is now about 5.0 V.
5.4.4 Conclusion
Although this has been a very basic introduction to using and modifying models in LTSpice, the general
principles for other devices and models are the same. Much of the information required for working with
models is understanding the parameters of each device and knowing how LTSpice references them in the
model directive. The former is beyond the scope of this tutorial, but the latter can be found using the
LTSpice Help menu.
Page 81 of 106
Section 6 - Subcircuits
6. Subcircuits
6.1 Introduction
Building and modifying models in LTSpice are ways to ensure that component simulations more closely
match the behavior of their real-world counterparts. Another way is to use sub circuits. Subcircuits are
similar to models, in that they allow users to specify how components will respond to voltages and currents.
Subcircuits even can include models in their descriptions. Unlike models, subcircuits do not specify
physical parameters that determine how basic components like diodes or transistors respond to currents and
voltages. Instead, they specify components and how they are interconnected to model devices, such as
operational amplifiers and voltage regulators, so that LTSpice can simulate the behavior of these devices.
In this section you will
Learn what a netlist is and how to interpret them
Learn the syntax and structure for LTSpice sub circuits
Learn how to associate sub circuits with components
6.2 Netlists
6.2.1 What is a Netlist?
A netlist is essentially a textual description of a circuit that specifies what components make up the circuit
and how they are connected together. The netlist specifies components by using reference designators and
their associated values, and shows how they are connected together by indicating to which points in the
circuit, or nodes, the components connect. LTSpice uses netlists to describe sub circuits.
Page 83 of 106
Section 6 - Subcircuits
As an example, consider the example circuit shown in Figure 6-1. The circuit consists of three components,
resistors R1 and R2 and capacitor C1, and four nodes, numbered from 1 to 4. Note that the node
assignments are arbitrary but once assigned the node references must be used consistently. Note also that in
netlists node 0 is reserved and must always refer to the circuit ground reference.
Page 86 of 106
Section 6 - Subcircuits
Page 87 of 106
Section 6 - Subcircuits
You may have noticed that this circuit and subcircuit description differs from that of the previous op-amp
descriptions. Specifically, an input called VS associated with Node 6 has been added, with a 1 MΩ resistor
to VREF. This addition appears to have nothing to do with the operation of the circuit, and in fact does not.
However, it has been added because the LTSpice symbol has a voltage supply pin and VS allows the
subcircuit to associate a node with that pin. Any value of resistance would do, but 1 MΩ is about what a
voltages supply would see with most micropower op-amps.
Page 88 of 106
Section 6 - Subcircuits
Page 89 of 106
Section 6 - Subcircuits
Page 90 of 106
Section 6 - Subcircuits
10) Select Close from the File menu in the Symbol Editor menu bar to exit the symbol editor and
return to the LTSpice workspace.
11) Right-click on the value opamp2 and enter “MyOpAmp” as the new op-amp value. Your circuit
should know look similar to Figure 6-16.
Page 92 of 106
Section 6 - Subcircuits
21) Change the value of feedback resistor R2 to 1 kΩ and 50 kΩ and re-simulate the circuit for each
change to verify that the op-amp circuit produces gains of -1 and -50, as shown in Figure 6-22 and
Figure 6-23, respectively.
6.4 Libraries
A final topic that this chapter will cover is that of libraries. Just as an actual library contains multiple
publications, such as books and magazines, an LTSpice library contains multiple LTSpice subcircuits and
their associated entities, such as components, models, and parameters. Libraries make it convenient for
users to change components that require custom sub circuits without having to change the .lib SPICE
directive each time. For this example, you will modify the MyOpAmp.sub circuit you created by adding the
subcircuit for a compensated version and saving it as MyOpAmps.lib, Then you will modify the generic
op-amp circuit to select the original and compensated op-amp sub circuits in turn and run an ac simulation
to compare the frequency response for both.
Page 93 of 106
Section 6 - Subcircuits
3) Select Copy from the Edit menu of the Notepad menu bar.
4) Click at the end .ENDS MyOpAmp in the text window to position the cursor.
5) Press the Enter key twice to add a blank line below the existing subcircuit description.
6) Select Paste from the Edit menu of the Notepad menu bar. This will place a copy of the existing
subcircuit description below the original, as shown in Figure 6-25.
Page 94 of 106
Section 6 - Subcircuits
Page 95 of 106
Section 6 - Subcircuits
1) Right-click on the ac signal source to open its properties window.
2) Enter “1” for the AC Amplitude in the Small signal AC analysis (V) section, as shown in Figure
6-30.
Figure 6-31: Generic Op-Amp Circuit with Small Signal AC Amplitude Added
4) Right-click on the .tran 0 5m 0 directive to open the Edit Simulation Command dialog box.
5) Select the AC Analysis tab.
6) Set the ac analysis simulation parameters as shown in Figure 6-32.
Page 96 of 106
Section 6 - Subcircuits
Page 97 of 106
Section 6 - Subcircuits
The simulation shows two things. First, it shows that LTSpice was able to locate the MyOpAmp
subcircuit in the MyOpAmps.lib file. Second, it shows that the output of the uncompensated op
amp does not change with frequency. Although this may seem like a good thing, it actually is not.
Because the phase changes with frequency, the negative feedback from the output can actually
become positive feedback and causing the amplifier circuit to become unstable and oscillate rather
than amplify. That is why op-amps and op-amp circuits use compensation to ensure that the
amplitude of the feedback is too low at high frequencies to sustain oscillation. To see what
compensation does, run the simulation using the compensated op-amp subcircuit.
3) Right-click on the MyOpAmp value for U1 to open the properties dialog box.
4) Change “MyOpAmp” to “MyCompOpAmp”, as shown in Figure 6-35.
6.5 In Conclusion
This has been only a very brief and rudimentary look at the use of sub circuits and libraries in LTSpice.
Understanding the complexities of and potential issues with sub circuits and libraries and using them in
LTSpice takes a great deal of study. The LTSpice Help menu and other resources are good sources if you
wish to research into the subjects further.
Page 99 of 106
Section 7 - In Summary
7. In Summary
Recap
This tutorial has introduced you to fundamental aspects and operation of LTSpice IV. These include
Using the most common LTSpice tools and menus
Creating schematics by placing, configuring and connecting components
Saving and opening circuit files
Running transient (time-dependent) and ac (frequency-dependent) simulations
Working with simulation plots
Saving plot settings
Using and modifying models
Using and modifying sub circuits
Using libraries
Exploring Further
LTSpice is a very complex and versatile tool whose application generally is limited only to the
resourcefulness of the user. Although further discussion of the listed topics is beyond the scope of this
tutorial, other sources that more fully discuss them, should you wish to go further, include
LTSpice Help menu
Included LTSpice examples (the default installation location is C:\Program Files
(x86)\LTC\LTspiceIV\examples)
Online LTSpice user forums
Happy exploring!