0% found this document useful (0 votes)
40 views106 pages

LTSpice Tutorial

This document is an introductory tutorial for LTSpice IV, designed to help users develop a working knowledge of the software for circuit design and analysis. It covers topics such as creating circuits, transient and AC circuit simulations, and using models and subcircuits. The tutorial is intended to supplement the official documentation and assumes familiarity with Microsoft Windows.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views106 pages

LTSpice Tutorial

This document is an introductory tutorial for LTSpice IV, designed to help users develop a working knowledge of the software for circuit design and analysis. It covers topics such as creating circuits, transient and AC circuit simulations, and using models and subcircuits. The tutorial is intended to supplement the official documentation and assumes familiarity with Microsoft Windows.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 106

An Introductory Tutorial to LTSpice IV®

For

Electronic Devices
10th Edition
Thomas L. Floyd

Prepared by
Gary D. Snyder

Boston Columbus Indianapolis New York San Francisco Hoboken

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

About This Tutorial


The intent of this tutorial is to help you develop a basic working knowledge of the Linear Technology Corporation
LTSpice IV software for entering and analyzing circuit designs. For best results, you should use this tutorial to
supplement, rather than replace, the documentation that accompanies the LTSpice software and discusses each topic in
depth

Using This Tutorial


Screen Images
The images in this tutorial may differ somewhat from what you will see depending upon your version of Windows.
Generally, however, the images will be very similar.

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

1. Introduction to the LTSpice Software


1.1 Introduction
The world of electronics is continually changing and at an ever more rapid pace. To remain competitive,
electronics companies must rapidly design, prototype, test, manufacture, and market their products. In the
past two-sided boards and leaded components were the standard and companies could use perfboard,
protoboards, and wire-wrap boards to evaluate new parts and to build and test circuit prototypes. In modern
electronics multilayer boards and surface-mount components are the standard, so creating physical
prototypes from scratch is both problematic and expensive. To help solve this problem, component
manufacturers often provide evaluation kits so that customers can determine whether a new part will meet
their needs and better understand the practical requirements for using the part in circuits. Another valuable
resource is specialized software to quickly design, evaluate, and modify circuit designs.
LTSpice is a program that acts as a virtual electronics laboratory. You can use the LTSpice program not
only to create electronic circuits on your computer, but also to simulate (“run”) the circuits, use virtual
probes to make electronic measurements, and even perform calculations on measured quantities like
voltage and current
In this chapter, you will:
 Learn how to start and close the LTSpice application.
 Familiarize yourself with the LTSpice workspace.
 Identify the various LTSpice toolbars and their components.

1.2 Starting the LTSpice Program


You can use standard Windows methods to start the LTSpice program. You will learn one more way in the
next section.

1.2.1 Starting the LTSpice Program from the Windows Desktop


If you added an LTSpice shortcut to your desktop during installation, then you can use the desktop shortcut
to start the LTSpice program. To do so:
1. Navigate to the desktop.
2. Double-click the LTSpice icon. The icon for your version of LTSpice may differ from that of
Figure 1-1.

Figure 1-1: LTSpice Icon

1.2.2 Starting the LTSpice Program from the Start Menu


Note that the following instructions assume that you accepted the default locations for your version of the
LTSpice software.
Page 1 of 106
Section 1 - Introduction to the LTSpice Software
1. Right-click the Start button in the lower left corner of the Windows screen.
2. Click Open Windows Explorer.
3. Navigate to the C:\Program Files (x86)\LTC\LTSpiceIV folder, as shown in Figure 1-2.

Figure 1-2: Location of LTSpice Application


4. Double-click the scad3.exe application file. Alternately, you can right-click on the file and select
Open or Run as administrator (if you have Administrator privileges) from the context menu.

1.3 The LTSpice Interface


Once the LTSpice program starts you will see the window (or one much like it) shown in Figure 1-9. The
exact window will depend upon your versions of Windows and how the LTSpice workspace is configured.

Page 2 of 106
Section 1 - Introduction to the LTSpice Software

Figure 1-3: LTSpice Window

1.3.1 The Title Bar


At the top of the window is the window title bar, shown in Figure 1-4 which shows the name of the
application and provides standard Windows controls at the left to minimize, restore, and close the
application.

Figure 1-4: LTSpice Title Bar

1.3.2 The Windows Menu Bar


The top row below the title bar, shown in Figure 1-5, is the standard Windows menu bar for the
applications, and is used for performing common Windows tasks, such as opening and closing files,
activating toolbars, and accessing help about the application.

Figure 1-5: Windows Menu Bar for LTSpice


Note that the available menus in the menu bar will change depending upon the active workspace and its contents.
When the workspace contains a circuit file, for example, the menu bar will appear as shown in Figure 1-6.

Figure 1-6: Windows Menu Bar with Circuit File Loaded

Page 3 of 106
Section 1 - Introduction to the LTSpice Software

1.3.3 The LTSpice Toolbar


The area below the menu bar, shown in Figure 1-7, is the LTSpice toolbar. These provide tools for you to
perform common LTSpice tasks with circuits, such as opening, creating, modifying, simulating, printing,
and saving circuit files.

Figure 1-7: LTSpice Toolbar


Note that tools that are grayed out are not active. The tools that are active and not active will depend upon the active
workspace and its contents. When the workspace contains a circuit file, for example, the menu bar will appear as
shown in Figure 1-8.

Figure 1-8: LTSpice Toolbar with Circuit Loaded

1.3.4 The Workspace


The larger area below the Windows menu bar and LTSpice toolbar, outlined in Figure 1-9, is the
workspace. This is the area in which you will create and simulate circuit designs.

Figure 1-9: LTSpice Workspace


The following sections provide a brief description of some of the toolbars that you will use in this
workbook.

1.3.5 Tool Tips


With so many toolbars and tools available the LTSpice interface may seem rather confusing at first. To
help you, LTSpice supports tool tips to help you identify each tool. A tool tip is a small text box that tells
you what the tool is. To activate a tool tip, simply let the pointer hover, or remain stationary, over the tool
you wish to identify. After a short time the tool tip for that tool will appear, as shown in Figure 1-10. The
tool tip indicates that the highlighted tool (the tool with the border around it) is the tool to activate the
LTSpice control panel.
Page 4 of 106
Section 1 - Introduction to the LTSpice Software

Figure 1-10: Control Panel Tool Tip


Table 1-1 shows some examples of LTSpice tools, the identity of the tool, and its function. Don’t be
concerned at this point as to what exactly these controls do. They will be discussed later in the tutorial.

Table 1-1: LTSpice Tool Identification

Tool Graphic Tool Identity Tool Function

Wire Connect components

Resistor Place generic resistor

Capacitor Place generic capacitor

Inductor Place generic inductor

Component Place component

Move Move object

Rotate Rotate selected objects

Mirror Mirror selected objects

Copy Copy selected objects

Print Print workspace contents

New Start new circuit file

Open Open existing circuit file

Save Save workspace contents

Page 5 of 106
Section 1 - Introduction to the LTSpice Software

Tool Graphic Tool Identity Tool Function

Open window to edit Spice


Spice directive
directive

Run Simulate circuit file

1.4 Closing the LTSpice Program


There are two standard ways to close the LTSpice program. If you made any changes to the circuit file
(even if the net effect of those changes did not change the circuit file, such as adding a component and then
deleting it) the program will warn you by displaying a dialog box similar to that in Figure 1-11.

Figure 1-11: File Save Reminder Dialog Box


If you receive this notification (although you shouldn’t at this point), click the No button. You will learn
about saving files in the next chapter.

1.4.1 Closing the LTSpice Application from the File Menu


1. Click File in the LTSpice menu bar.
2. Click Close.

1.4.2 Closing the LTSpice Program with the Close Button


To use the Close button to close the LTSpice application, click the Close () button at the far right of the
title bar, shown in Figure 1-12.

Figure 1-12: Close Button in Title Bar


If you click the Close () button in the LTSpice menu bar, shown in Figure 1-13, then you will close the
circuit file but not the program.

Figure 1-13: Close Button in LTSpice Menu Bar

1.5 Chapter Summary


The LTSpice interface provides a variety of toolbars and tools for creating, modifying, and simulating
circuit designs. Knowing which tools the LTSpice software provides and where you can find them will

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

2. Creating Circuits with LTSpice


2.1 Introduction
A schematic is a graphical representation of a circuit design. Each symbol represents a specific type of
component, and typically displays such electrical information as the component value, tolerance, and power
rating. A component symbol can also show user-oriented information such as a reference designator and
manufacturer part number, and manufacturing information that indicates the physical package or footprint.
One of the primary functions of LTSpice is to allow you to create schematics on your computer. This
process is called schematic capture and closely resembles the process of building an actual circuit.
Schematic capture consists of
 selecting the necessary components,
 arranging the components in the workspace, and
 connecting the components together to create the desired circuit.
Designs can range from simple circuits that consist of a few parts (such as a flashlight or transistor switch)
to complicated circuits (like a multi-stage amplifier or digital state machine). Regardless of the size or
complexity of the circuit, however, the basic schematic capture process is the same.
In this chapter you will:
 Construct a new circuit.
 Learn how to save a circuit file.
 Learn how to open an existing circuit file.
 Learn how to modify an existing circuit.

2.2 Constructing a New LTSpice Circuit


In this section you will build a simple RC circuit, or at least a schematic representation of one. This circuit
will consist of a resistor, capacitor and ground connection.

2.2.1 Starting a New Schematic


1. Use one of the methods from Section 1.2 to start the LTSpice program.
2. Start a new schematic using one of the following methods.
Method 1:
On the LTSpice toolbar, click the New Schematic tool, shown in Figure 2-1.

Figure 2-1: New Schematic Tool


Method 2:
a) On the Windows menu bar, click File.
Page 9 of 106
Section 2 - Creating Circuits with LTSpice
b) From the drop-down menu, click New Schematic.
Method 3:
Enter the keyboard shortcut Ctrl-N (pressing the Ctrl and N keys simultaneously). Keyboard
shortcuts exist for any menu item that has an underlined letter. For example, Ctrl-F would
have done the same thing as clicking on File in the Windows menu bar.
Method 4:
a) Right-click anywhere inside the LTSpice window.
b) Click on New Schematic in the context menu.
Note that this method will work if another schematic is not already loaded.
3. The LTSpice window should now appear as shown in Figure 2-2.

Figure 2-2: LTSpice Window with New Schematic Started


There are two changes to the window that you should notice. First, the Windows menu bar and
LTSpice toolbar have changed and offer more selection choices. Second, the workspace now
contains rows and columns of dots, called the grid, which will assist you in placing objects in the
workspace.

2.2.2 Placing Components


Next, you will place the resistor and capacitor in the workspace.
1. In the LTSpice toolbar, click the Resistor tool shown in Figure 2-3.

Figure 2-3: Resistor Tool


2. Move the cursor into the workspace area. A ghosted image of the resistor will appear as you
prepare to place the resistor, as shown in Figure 2-4.

Page 10 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-4: Preparing to Place Resistor


3. Move the ghosted resistor to a suitable location near the center of the workspace.
4. Click the mouse to place the resistor in the workspace, as shown in Figure 2-5.

Figure 2-5: Workspace with Resistor Placed


The ghosted image will still appear, indicating that you can place more resistors in the workspace.
From time to time you also may accidentally select the wrong component and not wish to place it
in the workspace. To cancel placing a selected component in the workplace, either
a) left-click the mouse,
b) press the Esc key, or
c) click on the tool you initially wished to select.
As you work with LTSpice you probably will adopt a preferred method for cancelling component
placement and other tasks.
5. Click on the Capacitor tool, shown in Figure 2-6.

Figure 2-6: Capacitor Tool

Page 11 of 106
Section 2 - Creating Circuits with LTSpice
6. Move the capacitor into the workspace, as shown in Figure 2-7.

Figure 2-7: Capacitor Moved into Workspace


The ghosted capacitor shows that the capacitor will be oriented vertically when placed in the
workspace. For this example you will orient the capacitor horizontally.
7. Move the cursor to the LTSpice toolbar and click on the Rotate tool, shown in Figure 2-8.

Figure 2-8: Rotate Tool


8. Move the capacitor back into the workspace. The ghosted capacitor now should be oriented
horizontally, as shown in Figure 2-9.

Figure 2-9: Preparing to Place Capacitor


9. Click the mouse to place the capacitor above and to the left of the resistor, so that your schematic
appears similar to Figure 2-10.

Page 12 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-10: Workspace with Capacitor Placed


10. Use one of the methods in Step 4 to cancel placing capacitors.
11. In the LTSpice toolbar, click on the Ground tool, shown in Figure 2-11.

Figure 2-11: Ground Tool


12. Place the ground beneath the resistor so that your schematic appears similar to Figure 2-12.

Figure 2-12: Workspace with Ground Placed


13. Use one of the methods in Step 4 to cancel placing grounds.

2.2.3 Connecting Components


Once components are placed in a schematic, you must establish electrical connections between them. To do
so, you will use the Wire tool, shown in Figure 2-13.

Page 13 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-13: Wire Tool


LTSpice will let you insert wires anywhere in a schematic, even if they connect only to one component or
even nothing at all. This may or may not create problems when you choose to simulate the circuit, so (as
with real circuits) verify that the wiring in your LTSpice circuit is what you intend it to be.

1. Click on the Wire tool.


2. Move the cursor into the workspace. A crosshair, indicating the attachment point for the wire, will
appear as shown in Figure 2-14.

Figure 2-14: Preparing to Connect Components


The crosshair allows you to line up the wire attachment point with the target location, simplifying
the process of drawing wire segments.
3. Click on the right connection point of the capacitor, shown as a blue box, to initiate the wiring.
4. Move the crosshair to right until it aligns with the top connection point of the resistor, as shown in
Figure 2-15. The workspace will show a black preview of the wire segment as you move the
crosshair.

Figure 2-15: Crosshair Aligned with Resistor


Page 14 of 106
Section 2 - Creating Circuits with LTSpice
5. Click the mouse to anchor the horizontal wire segment, as shown in Figure 2-16. The anchored
wire segment will now be blue.

Figure 2-16: First Segment Anchored


6. Move the crosshair down to the top of the resistor.
7. Click the connection point of the resistor to complete the wire connection, as shown in Figure
2-17.

Figure 2-17: Capacitor Wired to Resistor


When you wire two components together, the wired connection boxes will disappear and LTSpice
will prepare to start a new wire segment automatically. Next, wire the resistor to the circuit
ground.
8. Click on the bottom connection box of the resistor.
9. Click on the ground connection box. Your schematic now should look similar to Figure 2-18.

Page 15 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-18: Resistor Wired to Ground


10. Click on the capacitor left connection box to initiate a wire stub. A stub is a wire that connects to
only one component.
11. Move the crosshair a short distance to the left, as shown in Figure 2-19.

Figure 2-19: Connecting a Hanging Wire Segment to Capacitor


12. Click the mouse to anchor the wire segment, as shown in Figure 2-20.

Page 16 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-20: Anchoring the Wire Segment


13. Cancel the wire operation by pressing the Esc key. Your schematic now should look something
like Figure 2-21.

Figure 2-21: Schematic with Completed Wiring

2.2.4 Editing Components


You undoubtedly noticed that the circuit is lacking some elements for the schematic to be complete. In
particular, the components have no values and the circuit connects to nothing. For now you will specify the
resistance and capacitance values. You will connect the circuit to various sources in the next chapter when
you simulate the circuit.
1. Move the cursor over the “C” beneath the capacitor, so that it becomes an I-bar (text insertion
cursor). A message will appear at the bottom of the window with instructions for changing the
value of the capacitor, as shown in Figure 2-22.

Page 17 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-22: Preparing to Specify Capacitance Value


2. Right-click the mouse to open the component values box, shown in Figure 2-23.

Figure 2-23: Component Values Box


3. Enter the desired value for the capacitor. For this circuit the value will be 0.47 µF.

Figure 2-24: Entering Capacitor Value


LTSpice knows the units associated with each component, so that it requires you to enter only the
value and unit prefix when you specify a component value. Table 2 shows how to specify unit
prefixes in LTSpice.

Table 2: LTSpice Component Unit Prefixes

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.

Figure 2-25: Capacitor Value Entered


5. Move the cursor over the “R” to the right of the resistor.
6. Right-click the mouse to open the component values box.
7. Type the desired value for the resistor. For this circuit, the value will be 2.2 kΩ, as shown in
Figure 2-26.

Figure 2-26: Entering the Resistor Value


8. Click the OK button. Your schematic now should look something like Figure 2-27.

Figure 2-27: Resistor Value Entered

Page 19 of 106
Section 2 - Creating Circuits with LTSpice

2.2.5 Labeling Nets


An optional but very useful feature of LTSpice is the ability to label nets (i.e., electrical signal paths) using
ports. A port in LTSpice is essentially a point at which signals can enter or exit the circuit. Adding net
labels is useful for two reasons.
1) It allows you to connect components without drawing a physical wire between them. This keeps
schematics from becoming cluttered and allows you to modify the circuit simply by changing the
name of the net to which it connects.
2) It simplifies analyzing circuit simulations by allowing you to provide user-friendly labels.
LTSpice by default assigns each net its netlist node value, such as N053. Using net labels will
override the default values and give nets the names specified by the label. When simulating a
circuit, net labels make it much easier to understand the nature of the signals and to relate current
or voltage waveforms to the schematic.
For this circuit you will label two nets by adding an input port and output port, called IN and OUT,
respectively.
1. In the LTSpice toolbar, click on the Label Net tool shown in Figure 2-28.

Figure 2-28: Label Net Tool


2. The Net Name dialog box will open, as shown in Figure 2-29.

Figure 2-29: Net Name Dialog Box


3. Type “IN” in the text box, as shown in Figure 2-30.

Figure 2-30: Specifying Net Name


4. From the Port Type: drop-down list, shown in Figure 2-31, select Input.

Page 20 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-31: Specifying Net Label Port Type


5. In the Net Name dialog box, shown in Figure 2-32, click the OK button.

Figure 2-32: Completed Dialog Box Selections


6. Move the cursor into the workspace. You will see a ghosted input net label, as shown in Figure
2-33.

Figure 2-33: Preparing to Place Net Label


7. Move the ghosted net label so that the port connection box touches the left end of the hanging wire
segment, as shown in Figure 2-34.

Page 21 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-34: Positioning Net Label


8. Click the mouse button to attach the net label to the wire segment, as shown in Figure 2-35.

Figure 2-35: “IN” Net Label Placed in Circuit


As the ghosted net label indicates, LTSpice can connect the “IN” net label to more nets in the
circuit. Connecting the net label to any other net in the circuit will electrically connect them to nets
with the same label, effectively shorting them together. For this circuit we will have only one net
labeled “IN” for now.

9. Press the ESC key to cancel the Label Net operation.


10. Create an output net label called “OUT”.
11. Place the net label a short distance to the right of the junction between C1 and R1 so that your
schematic now should look something like Figure 2-36.

Page 22 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-36: Placing “OUT” Net Label in Circuit


12. Cancel the Label Net operation.
13. Use the Wire tool to connect the OUT label to the wire between C1 and R1, so that your
schematic now looks something like Figure 2-37.

Figure 2-37: “OUT” Net Label Placed in Circuit


14. Cancel the Wire tool operation.
Congratulations! You’ve just completed your first LTSpice circuit!

2.3 Saving an LTSpice Circuit File


A good idea is always to save your work, especially after working for more than a few minutes. There are
two basic methods for saving an LTSpice circuit file. Use one of the standard methods below to save your
circuit to your computer. You will be using this circuit in the next chapter.

2.3.1 Using the Save Tool to Save a Circuit File


To save the file without specifying a name or location, click the Save tool in the LTSpice toolbar, shown in
Figure 2-38.

Page 23 of 106
Section 2 - Creating Circuits with LTSpice

Figure 2-38: File Save Tool


If you are saving the file for the first time, LTSpice will use the default filename (Draft1.asc, as shown in
the title bar for the circuit window) to the default working location (the folder containing the LTSpice
executable file).

If you have saved the file before, LTSpice will save it to location in which the file was previously saved
with the same name.

2.3.2 Using the File Menu to Save a Circuit File


1. Click File on the Windows menu bar.
2. To save the file without specifying a name or location, or if you have previously saved the file,
click Save in the File menu.
3. If you wish to save the file under a new name in a new location, click Save As… in the File menu.
The Save As window will appear, as shown in Figure 2-39.

Figure 2-39: LTSpice Save As Window


4. Use the Save in: drop-down list to navigate to the folder in which you wish to save the file.
5. Enter the name of the file you wish to use in the File name: box.
6. Once you have finalized the file name and location for your circuit file, click the Save button.

2.3.3 Closing the Circuit File


Once you have saved the circuit file, you can close it in one of two ways.
Method 1:
1. Click File on the Windows menu bar.
2. Click Close in the File menu.
Method 2:
Click the Close () button in the Windows menu bar.

Page 24 of 106
Section 2 - Creating Circuits with LTSpice

2.4 Chapter Summary


Schematic capture in LTSpice consists of
1) starting a new schematic,
2) placing components in the workspace,
3) electrically connecting components together,
4) editing component properties, such as part values,
5) optionally using ports to label nets, and
6) saving the circuit file.
In the following section you will learn how to simulate LTSpice circuits.

Page 25 of 106
Section 3 - Transient Circuit Simulation

3. Transient Circuit Simulation


3.1 Introduction
Schematic capture is only the first step in designing a practical circuit. Correcting problems with actual
circuits is much slower and more expensive than correcting problems in a schematic. Before a layout tool
to build a real circuit, designers will simulate the operation of the design to identify and correct any
problems in the design. One of the first circuit simulation programs was SPICE (for Simulation Program
with Integrated Circuit Emphasis). SPICE originally was a text-based program that processed text-based
circuit description files, or netlists, that identified the circuit components and node numbers that described
how components were connected together. Modern versions, like LTSpice, add a graphical user interface to
simplify building circuits but typically allow users to output text netlist files like those originally used with
SPICE.
In this chapter you will:
 Learn about basic LTSpice transient simulation.
 Run a transient simulation of the RC circuit from Chapter 2.
 Learn how to measure voltage, current, and power in LTSpice.
 Learn how to save plot settings for the circuit simulation.

3.2 LTSpice Simulation Modes


LTSpice has a variety of simulation modes for evaluating the operation of a circuit. Two of the most
commonly used that this tutorial will cover are transient simulation and ac simulation.
Transient simulation shows how the voltages and currents in a circuit vary over time, much like an
oscilloscope. Transient simulation allows you to view and measure such signal parameters as rise and fall
times, delays, and frequencies. It also allows you to identify potential circuit issues, such as over- and
undershoot, ringing, and oscillation.
AC simulation shows how the voltages and currents in a circuit vary with the frequency of an applied
signal, much like a spectrum analyzer. AC simulation allows you to view and measure such circuit
parameters as signal amplitude and phase through the circuit. It also allows you to identify potential issues,
such as unintended resonances in the circuit design. This tutorial will cover ac simulation in the next
chapter.

3.3 Signal Sources


To run a circuit simulation, the example circuit you created and saved in Chapter 2 must include a signal
source.

3.3.1 Opening the Circuit File


Method 1:
1. On the LTSpice toolbar, click the Open tool, shown in Figure 3-1.

Page 27 of 106
Section 3 - Transient Circuit Simulation

Figure 3-1: Open Tool


The Open an existing file dialog box, shown in Figure 3-2, will open.

Figure 3-2: Open an Existing File Dialog Box


2. Use the Look in: drop-down list to navigate to the folder containing your LTSpice circuit.
3. Double-click your LTSpice circuit file to open it.
Method 2:
1. On the Windows menu bar, click File.
2. From the recent files list at the bottom of the File drop-down menu, click the name of your circuit
file to open it.
Your circuit should look similar to that shown in Figure 3-3.

Figure 3-3: Example RC Circuit

3.3.2 Adding the Signal Source


To simulate a circuit, LTSpice requires a signal source, or stimulus, to drive the circuit. For this simulation,
you will add a signal source that generates a pulse waveform.
1. On the LTSpice toolbar, click the Component tool, shown in Figure 3-4.

Page 28 of 106
Section 3 - Transient Circuit Simulation

Figure 3-4: Component Tool


The Select Component Symbol window, shown in Figure 3-5, will open.

Figure 3-5: Select Component Symbol Window


2. From the list in the component selection window, double-click [Misc] (or click once on [Misc]
and click the OK button). The Select Component Symbol window for the available
miscellaneous component symbols, shown in Figure 3-6, will open.

Figure 3-6: Miscellaneous Symbols Window


3. From the list of miscellaneous symbols in the component selection window, double-click on
signal (or click once on signal and click the OK button).
4. A ghosted image of the signal source will appear in the workspace. Position the signal source to
the left of RC circuit, as shown in Figure 3-7, and left-click to place it in the schematic, as shown
in Figure 3-8.
Page 29 of 106
Section 3 - Transient Circuit Simulation

Figure 3-7: Positioning the Signal Source in the Schematic

Figure 3-8: Schematic with Signal Source in Place


As with placing other LTSpice components, the ghosted image will remain after you place the
signal source in the schematic. This allows you to place more than one of the same component at
the same time. Because you will need only one signal source for this circuit, press the ESC key to
escape and end the component placement operation.

3.3.3 Configuring the Signal Source


Next, you must configure the signal source to generate the signal you wish to drive the circuit. For this
simulation, set up the signal source to generate a 1 V 100 Hz pulse waveform with a 50% duty cycle.
1. Right-click on the signal source to open the Independent Voltage Source configuration window,
as shown in Figure 3-9.

Page 30 of 106
Section 3 - Transient Circuit Simulation

Figure 3-9: Independent Voltage Source Configuration Window


2. Click the PULSE radio button to select a pulse function for the signal source, as shown in Figure
3-10.

Figure 3-10: Selecting a Pulse Waveform Function


3. Enter the waveform parameters shown in Figure 3-11 to configure the characteristic for the pulse
waveform.

Figure 3-11: Pulse Waveform Parameters


The waveform parameters set up the following characteristics for the pulse waveform:
Vinitial(V): The starting (inactive) voltage for the output of the voltage source. For this
simulation the output of the signal source is 0 V.

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.

Figure 3-12: Schematic with Configured Signal Source


If the displayed characteristics of the pulse waveform overlap the RC circuit, use the Move or
Drag tool to separate the signal source and circuit.
Alternately, you can right-click on the signal source and uncheck the Make this information
visible on the schematic box in the Independent Voltage Source configuration window.
Usually, however, it is convenient to have the schematic show the characteristics of the signal
source.

3.3.4 Connecting the Signal Source


The next step is to connect the signal source to the circuit. One way is to simply use wires to connect the
source terminals to the RC circuit, but using net labels generally offers several advantages over this
method.
1) It supports a cleaner design by minimizing the number of interconnecting wires.
2) It supports modular design by physically isolating functional sub circuits.

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.

Figure 3-13: Copy Tool


The cursor will change to a copy cursor resembling the Copy tool icon, indicating that you can
select entities to copy.
2. Window around the IN net label. The net label will be highlighted, as shown in Figure 3-14.

Figure 3-14: IN Net Label Ready for Copying


3. Move the ghosted image of the net label between the signal source and RC circuit, as shown in
Figure 3-15.

Figure 3-15: Positioning the Net Label


4. Left-click to place the net label in the schematic, as shown in Figure 3-16.

Page 33 of 106
Section 3 - Transient Circuit Simulation

Figure 3-16: Schematic with IN Net Label in Place


After you place the net label in the schematic the copy cursor will still be active so that you can
copy more items. Since you will not be copying anything else, press the ESC key to escape and
terminate the copy operation.
5. Click the RC ground symbol and copy it below the signal source, as shown in Figure 3-17.

Figure 3-17: Schematic with Signal Source Ground in Place


6. Press the ESC key to escape and terminate the copy operation
You’ve undoubtedly noticed that the net label is an input port, although it should be an output port. To
correct this, open and use the Net Label dialog box to configure the port type.
7. Click the Port Type selection button and select Output from the drop-down list.
8. Click the OK button to close the Net Label dialog box. Your schematic should know appear
similar to that of Figure 3-18.

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.

Figure 3-19: Signal Source Wired into Schematic


The circuit is now ready for simulation…almost.

3.4 Configuring the Simulation Command


Before running a simulation, LTSpice must know the type and settings for the simulation you wish to run.
You provide these through a simulation command. If you try to run a simulation without a simulation
command LTSpice will automatically open the Edit Simulation Command dialog box for you to create
one. Typically, however, you will set up one using the LTSpice Menu bar.
1. From the LTSpice Menu bar, select the Simulate menu.
2. From the Simulate menu, select Edit Simulation Cmd. The Edit Simulation Command dialog
box will open, as shown in Figure 3-20.

Page 35 of 106
Section 3 - Transient Circuit Simulation

Figure 3-20: Edit Simulation Command Dialog Box


3. Enter the simulation parameters shown in Figure 3-21.

Figure 3-21: RC Circuit Simulation Parameters


As the command syntax window at the bottom indicates, the simulation command will be
.tran 0 20m 0
For this simulation only the two mandatory parameters are entered. This sets up the simulation to
run from 0 (<Tstart>) to 260 ms (<Tstart>), which is enough time for 5 cycles at 100 Hz), and to
start collecting (printing) simulation data at 0 s (<Tprint>), or as soon as the simulation starts. The
other parameters, which are used for more sophisticated simulations, will not be covered in this
tutorial can be found using the LTSpice Help menu for the .TRAN SPICE command.
4. Click the OK button to exit the Edit Simulation Command dialog box. Position the ghosted
image of the simulation command beneath the signal source parameters, as shown in Figure 3-22.

Page 36 of 106
Section 3 - Transient Circuit Simulation

Figure 3-22: Positioning the Simulation Command


5. Left-click to place the simulation command in the circuit, as shown in Figure 3-23.

Figure 3-23: Simulation Command in Place


6. Save the circuit file under a name of your choosing by using the Save tool in the LTSpice toolbar.
Alternatively, you can select Save As in the File menu in the LT Spice menu bar.
The circuit is now ready to simulate.

3.5 Running the Simulation


Once you have configured the signal source and simulation for the circuit, you can run the simulation.
1. From the LTSpice tool bar, click on the Run tool, shown in Figure 3-24.

Figure 3-24: Run Tool


Alternatively, you can select Run from the Simulate menu in the LTSpice Menu bar.
2. A simulation results window will appear in addition to the LTSpice workspace window, as shown
in Figure 3-25. The window name will have the same name as the circuit file, but with a .RAW
rather than .ASC extension.

Page 37 of 106
Section 3 - Transient Circuit Simulation

Figure 3-25: LTSpice with Simulation Window


Nothing appears to happen when LTSpice simulates the circuit, which seems anticlimactic. However,
although LTSpice has simulated and generated data for the circuit, you have not specified what it is that
you wish to display. In real-world terms, this is similar to powering up a circuit but not connecting the
probes of an oscilloscope to it. With LTSpice you can view the voltage at any point in the circuit (relative
to ground) or the current through any component in the circuit.
3. Click the LTSpice workspace window to make it the active window.
4. Move the cursor to a point in the circuit you wish to observe. For the first measurement, move it
so that the cursor touches a segment of the IN net. The cursor will change to a voltage probe.
5. Click the IN net with the voltage probe. The simulation window should look similar to Figure
3-26.

Figure 3-26: Simulation IN Net Voltage Waveform


6. Next, click on the OUT net with the voltage probe. The simulation window should now look
similar to Figure 3-27.

Page 38 of 106
Section 3 - Transient Circuit Simulation

Figure 3-27: Simulation IN and OUT Net Voltage Waveforms


7. Finally, move the cursor to over the capacitor. The cursor will change to a current probe. Note that
the current probe has an arrow, indicating the direction of positive current. When the measured
current is positive it means that current is flowing in the direction of the arrow, and when negative
the current is flowing the direction opposite to the arrow.
8. Click the capacitor with the current probe. The simulation window should now look similar to
Figure 3-28.

Figure 3-28: Simulation Window with Capacitor Current Added

3.5.1 Waveform Measurements


The waveforms shown are useful for qualitative observations (i.e., what the voltages look like over time),
but typically you also will want specific quantitative data (i.e., the voltage and current values at specific
points in time). To help provide quantitative data, LTSpice provides two cursors that allow you to take
voltage and current measurements at specific points of interest.
1. Select the simulation window to make it active.
2. Right-click the V(in) label at the top of the simulation display area. The Expression Editor dialog
box, as shown in Figure 3-29, will appear.

Figure 3-29: Expression Editor Dialog Box

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.

Figure 3-30: Cursor Selection Drop-Down List


5. Click the OK button to exit the Expression Editor dialog box. LTSpice should now display the
Cursor Information window, as shown in Figure 3-31.

Figure 3-31: Cursor Information Window with Cursor 1 Active


The simulation window also should show a dotted white cursor for the V(in) waveform, as shown
in Figure 3-32. Note that the V(in) label has a dotted white box around it, indicating that it has a
cursor associated with it.

Figure 3-32: Waveform Display with Cursor Assigned to V(in)


6. Nest, assign the 2nd cursor to the V(out) waveform. The Cursor Information and simulation
window should now appear similar to Figure 3-33 and Figure 3-34.

Figure 3-33: Cursor Information Window with Cursors 1 and 2 Active

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.

Figure 3-35: Cursor Information Window with Cursor 1 Repositioned

Figure 3-36: Waveform Display with Cursor 1 Repositioned


9. Reposition Cursor 2 to 11 ms, as shown in Figure 3-37 and Figure 3-38.

Page 41 of 106
Section 3 - Transient Circuit Simulation

Figure 3-37: Cursor Information Window with Cursor 2 Repositioned

Figure 3-38: Waveform Display with Cursor 2 Repositioned


V(out) should be at its maximum at t = 11 ms, but because of factors such as the LTSpice simulation
timestep and the signal source rise time that is not the case. To move the cursor closer to the maximum
value of V(out), the display must be scaled to provide better resolution on the horizontal scale. One way is
to use the Windows cursor to window around the area of interest.
10. Position the Windows cursor just to the left of and above the V(out) maximum near 11 ms. The
arrow will change to a crosshair.
11. Click and drag the Windows cursor just to the right of and below the V(out) minimum near 16 ms.
The waveform display should now look similar to Figure 3-39.

Figure 3-39: Rescaled Waveform Display


12. Move Cursor 2 slightly to the left of 11 ms. The Cursor Information window now should be
similar to Figure 3-40.

Page 42 of 106
Section 3 - Transient Circuit Simulation

Figure 3-40: Cursor 2 Repositioned in Rescaled Waveform Display


If necessary, the window can be rescaled as often as necessary to provide the necessary resolution for
voltage or current measurements (up to the limitations of the simulation). This can be done by windowing
around the area of interest as previously, or alternatively by manually rescaling the horizontal axis.
13. Move the cursor to the bottom of the waveform display until it changes to a horizontal ruler.
14. Left-click to open the Horizontal Axis dialog box, shown in Figure 3-41.

Figure 3-41: Horizontal Axis Dialog Box


15. Enter the horizontal axis values shown in Figure 3-42.

Figure 3-42: New Horizontal Axis Limits


16. Click the OK button to exit the Horizontal Axis dialog box. The Cursor Information window and
Waveform Display should now look similar to Figure 3-43 and Figure 3-44.

Figure 3-43: Cursor Information Window for Manually Rescaled Horizontal Axis

Page 43 of 106
Section 3 - Transient Circuit Simulation

Figure 3-44: Waveform Display for Manually Rescaled Horizontal Axis


An alternate method of rescaling the horizontal axis is using Manual Limits in the Plot Settings menu of
the LTSpice menu bar.
Note that the vertical axis can be rescaled using procedures similar to those for the horizontal axis.

3.5.2 Adding Plot Panes


Sometime the number of waveforms you will want to see is so large that the waveform display becomes
confused. In this case, you can create additional plot panes to organize the waveforms and reduce the total
number of waveforms in any pane.
1. Select the Plot Settings menu in the LTSpice menu bar.
2. Select Add Plot Pane in the Plot Settings menu. The waveform display should now look similar
to Figure 3-45.

Figure 3-45: Waveform Display with Plot Pane Added


3. Click and drag the V(in) label from the bottom pane to the top pane.
4. Click and drag the V(out) label from the bottom pane to the top pane.
5. Select Zoom to Fit in the View menu of the LTSpice Toolbar, which will rescale the horizontal
and vertical axis to their original extents. The waveform display should now look like Figure 3-46.

Page 44 of 106
Section 3 - Transient Circuit Simulation

Figure 3-46: Resized and Reorganized Waveform Display with Added Plot Pane

3.6 Derived Waveforms


In addition to displaying the raw voltage and current waveforms for the circuit, LTSpice can display the
sum, difference, product, and quotient of multiple waveforms. Multiplying and dividing voltages and
currents to scale them allow large and small signals to be more easily compared directly in the same plot
pane. The product of voltage and current for a component also is useful, because it shows the dynamic
power for that component.
1. From the LTSpice Simulation window menu bar, select Add Trace from the Plot Settings menu.
The Add Traces to Plot dialog box, shown in Figure 3-47, will open, showing the voltage and
current measurements available for the circuit.

Figure 3-47: Add Traces to Plot Dialog Box


Note that the available data is not necessarily the same as that selected for the waveform display,
but that any data accessible using the voltage and currents probes will be included.
2. Click on V(out) in the Available data: list. The list item will be highlighted and appear in the
Expression(s) to add: box, as shown in Figure 3-48.

Page 45 of 106
Section 3 - Transient Circuit Simulation

Figure 3-48: Selecting First Term of Power Expression for R1


3. Click in the Expression(s) to add: box and modify the expression to “V(out)*”, so that the Add
Traces to Plot dialog box looks like Figure 3-49. LTSpice recognizes the asterisk symbol (*) to
mean a multiplication operation.

Figure 3-49: Modified Waveform Expression


4. Click on I(R1) in the Available data: list. The list item will be highlighted and be added to the
Expression(s) to add: box, as shown in Figure 3-50.

Figure 3-50: Completed Power Expression for R1


5. Click the OK button to exit the Add Traces to Plot dialog box. The waveform display should now
look similar to Figure 3-51.

Page 46 of 106
Section 3 - Transient Circuit Simulation

Figure 3-51: Waveform Display with Resistor R1 Power Added


Note that LTSpice has added a new scale to the right of the top pane, with units of watts. This is
because LTSpice recognizes that the product of voltage and current is power.
6. Use Add Trace to add the product of voltage and current for capacitor C1 using the expression
(V(in)-Vout)*I(C1). The Waveform Display should now look similar to Figure 3-52.

Figure 3-52: Waveform Display with Capacitor C1 Power Added


The top pan of the Waveform Display is once again becoming cluttered. Add another pane and move the
power waveforms to it so that the display looks similar to Figure 3-53.

Figure 3-53: Waveform Display with Power Pane Added


The top pane containing the power waveforms for R1 and C1 shows that the capacitor power (not
surprisingly) goes both positive negative, indicating that it is storing and releasing energy. As you should
know, the power in a capacitor is reactive power with units of volt-amps reactive, rather than true power
measured in watts, but there are limits even to what LTSpice can do.

Page 47 of 106
Section 3 - Transient Circuit Simulation

3.7 Saving the Plot Settings


With all the effort you have put into formatting the waveform display it would be inconvenient to do so
every time you simulate the circuit. LTSpice allows you to save the plot settings so that it will
automatically set up the Waveform Display with the selected traces when it simulates the circuit again.
1. From the LTSpice Simulation Window menu bar, select the Plot Settings menu.
2. Select Save Plot Settings from the Plot Settings menu.
Three important things you should remember about saving plot settings.
1) Unlike the circuit file, LTSpice will NOT warn you if you exit the program without saving the plot
settings.
2) The plot settings are tied to specific components and nets for a specific circuit file. If you change a
component reference designator (changing its value is acceptable), change the circuit netlist by
adding or deleting nets or by changing net labels, and/or save the circuit under a different name
then LTSpice will NOT be able to use the saved plot settings for the original circuit. If your only
change is saving the circuit file under a new name then you can copy and rename the plot settings
file (*.PLT) to match the new name, but this is not guaranteed or recommended.
3) Saving the plot settings will NOT save the cursor settings.
That said, saving the plot settings is highly recommended if you plan to run numerous simulations on the
same circuit file to determine the effects of changing component values, especially if (as can be the case) a
simulation generates numerous waveforms.

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

 Create an RC phase-shift circuit.

 Learn about basic LTSpice ac simulation.

 Run an ac simulation of a phase-shift RC circuit.

 Learn how to measure amplitude and phase in LTSpice.

4.2 Creating the RC Phase-Shift Circuit


To create the RC phase-shift circuit, modify the RC circuit you saved in Section 3.4 for the ac simulation.

4.2.1 Repositioning the Circuit


1) Open the RC circuit you saved in the previous chapter. It should appear similar to that in Figure
4-1.

Figure 4-1: RC Circuit File


2) Use the Zoom Back tool, shown in Figure 4-2, in the LTSpice toolbar to enlarge the work area.
Alternatively, you can select Zoom Back from the View menu in the LTSpice menu bar to resize
the circuit.

Page 49 of 106
Section 4 - AC Circuit Simulation

Figure 4-2: Zoom Back Tool


Resizing the circuit will give you room to add the additional components for the phase-shift
circuit, as shown in Figure 4-3. Zoom back when and as often as needed to have the necessary
space in which to work.

Figure 4-3: Resized Circuit File


3) Click the Move tool, shown in Figure 4-4, in the LTSpice toolbar.

Figure 4-4: Move Tool


4) Window around the circuit to highlight it, as shown in Figure 4-5.

Figure 4-5: Circuit Selected for Move

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.

Figure 4-6: Circuit Repositioned for Modification


6) When the circuit is in the right position, left-click to place it in the workspace and press the ESC
key to escape and terminate the move operation. The circuit should now look similar to that in
Figure 4-7.

Figure 4-7: Circuit Repositioned in the Workspace


As an aside, you could also have used the Drag tool, shown in Figure 4-8, to reposition the circuit.

Figure 4-8: Drag Tool


The only difference between the Move and Drag tools is that the Move tool will disconnect the selected
circuit entities from any nets when they are moved. The Drag tool will cause any connected nets to “rubber
band”, or stretch, so that they remain connected to the repositioned entities.

Page 51 of 106
Section 4 - AC Circuit Simulation

4.2.2 Adding the Additional Components


Next, you will add two more RC sections, or stages, to the circuit.
1) Select the Drag tool from the LTSpice toolbar.
2) Click on and drag the OUT net label to the right, noting that the associated wire remains connected
to the RC junction and net label as you move them. The circuit should look similar to Figure 4-9.

Figure 4-9: OUT Net Label Repositioned


3) Select the Copy tool from the LTSpice toolbar.
4) Window around C1 and R1, as shown in Figure 4-10.

Figure 4-10: R1 and C1 Selected for Copying


5) Move the cursor to the right, as shown in Figure 4-11.

Page 52 of 106
Section 4 - AC Circuit Simulation

Figure 4-11: Copy of R and C Positioned for Placement


6) Left-click to place the copy of R and C into the circuit, as shown in Figure 4-12.

Figure 4-12: R2 and C2 Placed in Circuit


Note that LTSpice has connected the new components into the existing net and renamed them R2
and C2.

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

Figure 4-13: R3 and C3 Placed in Circuit


8) Press the ESC key to escape and terminate the copy operation.
9) Use the Drag tool to reposition the OUT net label closer to the junction of R3 and C3, as shown in
Figure 4-14.

Figure 4-14: OUT Net Label Repositioned in Circuit


10) Click the Zoom full extents tool, shown in Figure 4-15, to resize the phase-shift circuit to the
workspace area.

Figure 4-15: Zoom Full Extents Tool


Alternatively, you can select Zoom to Fit in the View menu in the LTSpice menu bar. The circuit
should now look similar to Figure 4-16.

Page 54 of 106
Section 4 - AC Circuit Simulation

Figure 4-16: Phase-Shift Circuit Resized in Workspace


11) Save the circuit under a new name of your choice to keep your work to this point.

4.3 Configuring the Simulation


Although the circuit already has a signal source, this is configured as the stimulus for transient circuit
simulation as the LTSpice directives “PULSE(0 1 1m 10n 10n 5m 10m 5)” and “.tran 0 60m 0” indicates.
You must reconfigure the source so that you LTSpice can use it as the stimulus for ac circuit simulation.

4.3.1 Selecting the AC Analysis Source


For this example LTSpice will use the same voltage source as it did for the transient circuit simulation.
1) Right-click the signal source. This will open the Independent Voltage Source dialog box for V1,
as shown in Figure 4-17.

Figure 4-17: Independent Voltage Source Dialog Box for V1


2) In the AC Amplitude box in the Small signal AC analysis (AC) section of the dialog box, enter
“1”, as shown in Figure 4-18.

Page 55 of 106
Section 4 - AC Circuit Simulation

Figure 4-18: AC Amplitude for V1 Specified


3) Press the OK button to exit the dialog box. The circuit file will look similar to Figure 4-19.

Figure 4-19: Circuit with AC Source Selected

If “AC 1” is over other text for the signal source, use the Move tool to reposition it.

4.3.2 Configuring LTSpice for AC Circuit Simulation


Next, the circuit file must be modified
1) Right-click the “.tran 0 60m 0” LTSpice directive to open the Edit Simulation Command dialog
box, as shown in Figure 4-20.

Page 56 of 106
Section 4 - AC Circuit Simulation

Figure 4-20: Edit Simulation Command Dialog Box


2) Select the AC Analysis tab. The dialog box should look like Figure 4-21.

Figure 4-21: AC Analysis Tab


3) Enter the ac analysis parameters shown in Figure 4-22.

Figure 4-22: AC Analysis Parameters Configured


4) Click the OK button to exit the dialog box. The circuit should look similar to Figure 4-23.

Page 57 of 106
Section 4 - AC Circuit Simulation

Figure 4-23: Circuit Configured for AC Analysis


Note that the LTSpice .tran directive has been replaced with the .ac directive. In some earlier
versions of LTSpice the workspace would retain the .tran directive but prefix it with a semicolon
(“;”) to comment out and disable the directive (i.e., “;.tran 0 60m 0”).
5) The circuit file is now ready to simulate. Save the circuit file to preserve your work.

4.4 Running the Simulation


Running, viewing, and analyzing the ac simulation is identical to doing so for the transient simulation. The
only difference is the simulation data that LTSpice will return.
1) Click the Run tool in the LTSpice toolbar. LTSpice will now display an ac simulation window, as
shown in Figure 4-24.

Figure 4-24: AC Simulation Window


As you can see, the ac simulation window is very similar to the transient simulation window,
except that the x-axis represents frequency rather than time. When the simulation window is the
active window, as shown above, the menu options are identical to those for the transient circuit
analysis.

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

Figure 4-25: Simulation Window with IN Voltage Selected


Although it is not readily apparent, the simulation window is showing two waveforms as indicated
by the two y-axes. The left, with units of mdB, indicates the amplitude of the waveform and the
right, with units of m°, indicates the phase of the waveform. Because we are measuring the
amplitude and phase of the IN net relative to the input ac signal source (i.e., itself), the amplitude
and phase always will be equal to 0 dB (because VIN / V1 = 1) and 0° (because ΦVIN – ΦV1 = 0°).
3) Select the OUT net in the circuit window. The simulation window will be similar to Figure 4-26.

Figure 4-26: Simulation Window with OUT Voltage Added


The simulation for the OUT voltage shows that the phase shift circuit acts like a high-pass filter,
with the phase lag changing from −90° at low frequencies to −360° at high frequencies. Note that
LTSpice displays amplitude as a solid line, and phase as a dotted line.
4) Window around the simulation display (or manually set the X-axis range) to select the frequency
response from 100 Hz to 10 kHz, as shown in Figure 4-27.

Figure 4-27: Phase-Shift Response from 100 Hz to 10 kHz

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.

Figure 4-28: Cursor 1 Attached to V(out)


7) Move the cursor to the left, until the amplitude for V(out) is approximately −3 dB, as shown in
Figure 4-29.

Figure 4-29: −3dB Measurements for Phase-Shift Circuit


Note that the cursor information provides the frequency and phase for the −3 dB point of the
output voltage.
8) Use the Zoom to extents tool in the LTSpice toolbar to display the entire waveform.
9) Add the voltages for the nets between C1 and C2 and between C2 and C3 to the simulation
display. The simulation display should look similar to Figure 4-30.

Figure 4-30: Simulation Display with Additional Voltages

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.

Figure 4-31: Simulation Display with Resistor Currents Added


13) Use Add Trace in the Plot Settings menu in the LTSpice simulation toolbar to add the power for
the resistors to the simulation display. Note that the power expressions for R1 is V(n001)*I(r1),
R2 is V(n002)*I(r2), and R3 is V(out)*Ir3).
14) Use the Add Plot Pane in the Plot Settings menu in the LTSpice simulation toolbar to add
another plot pane to the simulation display.
15) Move the power traces to the top pane. The display should look similar to Figure 4-32.

Figure 4-32: Simulation Display with Resistor Power Waveforms Added


16) Save the plot settings for the simulation.
As you can see, obtaining and measuring frequency response information using ac circuit simulation is very
similar to obtaining time-based information us transient circuit simulation.
One point always to remember is that the frequency response amplitudes and phases are referenced to those
of the ac signal source at those frequencies. When LTSpice indicates that the amplitude of a voltage is −3
dB, for example, it means that it is −3 dB (or 70.7%) of the magnitude of the ac signal source at that
frequency. Similarly, the phase information is relative to the phase of the ac signal source at that point.

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

5.2 SPICE Models


A SPICE model is a text description summarizing the parameters for a specific type of device. The general
format of a SPICE model is
.model <model_name> <device_type> ([parameter_1] [parameter _2]…[parameter_n])
The fields of the model expression are
.model This field comes first and informs LTSpice that the expression is a model
description. The dot preceding “model” identifies the expression as a SPICE
directive, which directs, or instructs, LTSpice to process the expression to perform
some specific task. In this case, the “.model” directive instructs LTSpice to apply the
expression and parameters to circuit components that are associated with the model.
In the chapters on transient and ac simulation the “.tran” and “.ac” expressions in the
circuit file also were SPICE directives, telling LTSpice the type of simulation to run
and the parameters (start time, voltage amplitude, etc.) for the simulation.
<model_name> The next field in the expression is the model name. Each model must have a model
name so that LTSpice can determine to which components the model applies.
Page 63 of 106
Section 5 - Models
<device_type> The device type field identifies to which type of device the model applies. Each
device type has specific parameters, which LTSpice uses to simulate the behavior for
that device. Some device types are D (diode), NPN (NPN bipolar junction transistor),
and NFET (N-channel FET).
([parameter_x]) The parameter list for a device is enclosed in parentheses. Each parameter in the list
has the form
<parameter> = <parameter_value>
SPICE defines specific parameters for each device type. For the diode, for example,
some parameters are Is (saturation current), Rs (the diode ohmic resistance), and BV
(the reverse breakdown voltage). You can find the complete list of parameters for
devices using the LTSpice Help menu, which will be covered later in this chapter.
Note that models do not necessarily specify all device parameters. If a model does
not specify a device parameter, LTSpice will use a default value.

5.3 Creating a Generic Circuit with a Modeled


Component
To learn about models you first will create the simple half-wave rectifier diode shown in Figure 5-1. The
generic diode in the circuit is one of the LTSpice components that use models.

Figure 5-1: Half-Wave Rectifier


Although you could build this from scratch, for this example will modify the RC circuit of Figure 5-2 that
you saved in Section 3.4 to demonstrate a few more LTSpice tools.

Figure 5-2: Existing RC Circuit

Page 64 of 106
Section 5 - Models

5.3.1 Deleting Components


After loading the circuit of Figure 5-2, first delete, or cut, the unneeded capacitor from the circuit.
1) From the LTSpice tool bar, select the Cut tool, shown in Figure 5-3.

Figure 5-3: Cut Tool


Alternatively, you can press the Delete key. The icon will change to a cut tool, similar to a pair of
scissors.
2) Move the Cut tool so that the center of the scissors (the point where the vertical and horizontal
blades of the scissors meet) is directly over C1.
3) Left-click on the capacitor to delete it from the circuit, as shown in Figure 5-4.

Figure 5-4: Circuit with Capacitor Removed


If you accidentally cut the wrong component or net from a circuit, you can immediately correct it
by using the Undo tool, shown in Figure 5-5.

Figure 5-5: Undo Tool


4) After deleting C1, press the ESC key to escape and terminate the cut operation.

5.3.2 Repositioning the Resistor


To reposition the resistor, you will first move it from its current position in the circuit, rotate it, and then
merge it back into the circuit.
1) From the LTSpice toolbar, select the Move (not Drag) tool, shown in Figure 5-6.

Figure 5-6: Move Tool


2) Click on resistor R1. The resistor will become a ghosted image, as shown in Figure 5-7.
Page 65 of 106
Section 5 - Models

Figure 5-7: Circuit with Resistor R1 Ready to Move


3) Move the ghosted resistor away from the circuit, as shown in Figure 5-8. Note that the nets do not
stretch to maintain their connection to R1, as they do with the Drag tool.

Figure 5-8: Moving the Resistor


4) Move the ghosted resistor towards the LTSpice tool bar. When the ghosted resistor reaches the
toolbar, it will stop moving and the standard selection cursor will appear.
5) Click the Rotate tool, shown in Figure 5-9.

Figure 5-9: Rotate Tool


Each click of the tool will rotate the selected component clockwise by 90°. Rotate the ghosted
resistor so that it is oriented horizontally.
6) Position the re-oriented resistor as shown in Figure 5-10.

Page 66 of 106
Section 5 - Models

Figure 5-10: Re-Oriented Resistor Ready for Placement


7) Left-click the mouse to place the re-oriented resistor in the circuit, as shown in Figure 5-11.

Figure 5-11: Re-Oriented Resistor Placed in Circuit


8) Press the ESC key to escape and terminate the move operation.
As you can see, the resistor did not exactly match the gap between the wires that was left when
you cut C1 from the circuit. This created a net stub on the left end of R1.
9) Use the Cut tool to remove the net stub. Your circuit now should look like that of Figure 5-12.

Figure 5-12: Circuit with Net Stub Removed

5.3.3 Inserting the Diode


1) From the LTSpice toolbar, select the Diode tool, shown in Figure 5-13.

Page 67 of 106
Section 5 - Models

Figure 5-13: Diode Tool


2) Click the Rotate tool twice to orient the diode as shown in Figure 5-14.

Figure 5-14: Diode Rotated for Placement


3) Position the ghosted diode as shown in Figure 5-15.

Figure 5-15: Diode Positioned for Placement


4) Left-click to place the diode in the circuit, as shown in Figure 5-16.

Figure 5-16: Diode Placed in Circuit


5) Finally, use the Drag (not Move) tool to reposition D1 and connect the anode to the ground net, as
shown in Figure 5-17.

Page 68 of 106
Section 5 - Models

Figure 5-17: D1 Anode Connected to Ground Net

5.3.4 Reconfiguring the Voltage Source


The circuit simulation will require a 10V 1 kHz sinusoidal ac source.
1) Right-click the voltage source to open the Independent Voltage Source dialog box.
2) Configure the voltage source with values shown in Figure 5-18.

Figure 5-18: Independent Voltage Source Settings


Your circuit now should like that of Figure 5-19.

Figure 5-19: Circuit with Configured Voltage Source

Page 69 of 106
Section 5 - Models

5.3.5 Configuring the Simulation Setting


Finally, configure the simulation for 5 cycles of the voltage source. Because the frequency of the voltage
source is 1 kHz, 5 cycles will take 5 ms to complete.
1) Right-click on the “.tran 0 60m 0” LTSpice directive.
2) Change the simulation settings to those shown in Figure 5-20.

Figure 5-20: Simulation Settings for Half-Wave Rectifier


The generic half-wave rectifier circuit should know look like that in Figure 5-21.

Figure 5-21: Generic Half-Wave Rectifier Circuit


3) Save the circuit under a new name to preserve your changes. You will use this circuit again later in
this chapter.

5.3.6 Simulating the Generic Half-Wave Rectifier Circuit


Finally, simulate the circuit.
1) Run a transient simulation for the rectifier circuit by clicking the Run tool in the LTSpice tool bar.
Alternatively, you can click Run in the Simulation menu in the LTSpice menu bar.
2) Add the waveforms for the IN and OUT nets to the simulation window using voltage probes in the
circuit workspace or Add trace in the Plot Settings menu in the LTSpice menu bar.
3) Save the plot settings.
The simulation waveforms for the generic half-wave rectifier should appear similar to those in Figure 5-22.

Page 70 of 106
Section 5 - Models

Figure 5-22: Generic Half-Wave Rectifier Input and Output Waveforms


As the waveforms show, the generic diode blocks any positive voltage and clamps any negative voltage to about
−0.7 V as most practical diodes would. This is because the diode uses the default parameters for the standard diode
model. In the next section you will modify the parameters to see how they affect diode behavior.

5.4 Modifying Component Behavior


The default parameters of the diode model determine how the generic diode will respond to voltages and
currents. One way to modify how the component behaves is to modify the parameters. For a diode, two of
the most important parameters are Vj, the junction potential, and BV, the breakdown voltage. The junction
potential is the voltage drop across the diode when forward-biased, and the breakdown voltage is the
voltage at which the diode will break down and conduct significant current when reverse-biased. Because
diode (and other) models are LTSpice directives, you can modify their parameters using the SPICE
Directive Editor.

5.4.1 Using the SPICE Directive Editor


The diode model is a SPICE directive
1) From the Edit menu in the LTSpice menu bar, select SPICE Directive. The schematic text editor
will open, as shown in Figure 5-23.

Figure 5-23: LTSpice Schematic Text Editor


2) In the text box, enter the text string “.model MyDiode D(BV=5.1)”, as shown in Figure 5-24.

Page 71 of 106
Section 5 - Models

Figure 5-24: Entering the New Model


This directive specifies a diode model, named “MyDiode” with a 5.1V breakdown voltage.
3) Click the OK button to end editing the model and return to the schematic. A ghosted image of the
SPICE model directive will appear, as shown in Figure 5-25.

Figure 5-25: Preparing to Place the Model Directive


4) Position the model directive above the circuit. It doesn’t matter to LTSpice where you place it, but
placing directives near the components to which they belong helps keep the intent of the design
clear.

Figure 5-26: Positioning the Model Directive


5) Left-click to place the model directive, as shown in Figure 5-27.

Page 72 of 106
Section 5 - Models

Figure 5-27: Model Directive Placed in LTSpice Circuit


This now gives LTSpice a diode model to apply to components in the circuit, but you must now
identify the component to which the model applies.
6) Right-click on the component model value “D” to open the dialog box shown in Figure 5-28.

Figure 5-28: Editing the Component Model Value


7) Enter “MyDiode” in the text box, as shown in Figure 5-29.

Figure 5-29: Entering the New Component Value


8) Click the OK button to close the dialog box. The circuit file should now look like that in Figure
5-30 and the diode will use the MyDiode model.

Figure 5-30: Circuit with Updated Model Reference


9) Save the circuit under a new name to preserve your changes and keep the original circuit intact.
Page 73 of 106
Section 5 - Models
10) Simulate the circuit. Because you changed the name of the circuit file you will need to add the IN
and OUT net voltage waveforms to the Simulation window. The simulation waveforms should
now appear similar to those in Figure 5-31.

Figure 5-31: Waveforms for Modified Diode Model


As you can see, the diode now clamps the reverse-bias voltage at about 5.4 V because the reverse
breakdown voltage for the model is now 5.1 V rather than being infinite (the default value).
11) Save the plot settings for the new circuit.

5.4.2 Manufacturer Parts


Although modifying the model for a generic diode simulates the basic behavior of a 5.1V zener diode, the
symbol and other characteristics are those of a standard diode rather than those of a true zener diode.
Consequently, if you were to modify the model for a generic diode to simulate how a zener diode would
operate under all conditions LTSpice would not accurately depict it as a zener diode or accurately simulate
its behavior. For many components, like zener diodes, LTSpice provides a number of manufacturer parts
and models that accurately represent and simulate how those components would behave in a circuit.
1) Close the currently open file in LTSpice and open the circuit file you saved in Section 5.3.5,
shown in Figure 5-32.

Figure 5-32: Original Diode Circuit File


2) Right-click diode D1 to open the Properties dialog box, shown in Figure 5-33.

Page 74 of 106
Section 5 - Models

Figure 5-33: Diode Properties Dialog Box


3) Click the Pick New Diode button. LTSpice will display a list of available manufacturer parts,
shown in Figure 5-34.

Figure 5-34: Diode Selection List


4) Double-click on “type” at the top of the diode type column to sort the list by diode type, as shown
in Figure 5-35.

Figure 5-35: Diode List Sorted by Type


In this case you are searching for a zener diode, so sorting by diode type is the fastest way to find
one. If you knew the part number of specific zener diode you wanted, you could sort by part
number by double-clicking on “Part no.” at the top of the part number column.
5) Use the scroll bar on the right to scroll down to the section listing zener diodes.

Page 75 of 106
Section 5 - Models

Figure 5-36: Start of Zener Diode Listing


6) Double-click on the 1N750 part to select it as the zener diode for your circuit. Alternatively, you
could select the 1N750 part and click the OK button. The Diode Selection list box will close and
the schematic will update to show the zener diode in the circuit, as shown in Figure 5-37.

Figure 5-37: Circuit Updated with 4.7V Zener Diode


7) Save the circuit under a new name.
8) Simulate the circuit and add the IN and OUT net waveforms to the Simulation window. The
waveforms should look like those of Figure 5-38.

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

5.4.3 Modifying Manufacturer Models


You probably noticed that the list of manufacturer diodes did not include a 5.1 V zener diode. This does not
mean that they do not exist, simply that LTSpice does not include them. Many times some manufacturer
diodes (such as 1N400x diodes) comprise a product family, in which the different parts significantly differ
only in one or two specific parameter and the other parameters are essentially the same for all parts in the
family. Consequently, modifying the parameter of interest (in this case the zener breakdown voltage) and
leaving the rest unchanged typically will be accurate enough for most simulations . For this example, you
will use the SPICE Directive Editor to modify the zener breakdown voltage for the manufacturer’s model
from 4.7 V to 5.1 V.
1) Right-click on the 1N750 zener diode to open the Properties dialog box.
2) Click the Pick New Diode button to open list of available diodes. The list should have the 1N750
part highlighted, as shown in Figure 5-39. If not, scroll down to the 1N750 part and select it.

Figure 5-39: List with 1N750 Zener Diode Selected


3) Press CTRL+C (the “CTRL” and “C” keys simultaneously) to copy the model for the selected
part.
4) Click the Cancel button to return to the diode Properties dialog box.
5) Click the Cancel button to return to the LTSpice circuit.
6) Select SPICE Directive in the Edit menu in the LTSpice menu bar to open the SPICE Directive
Editor.
7) Press CTRL+V (the “CTRL” and “V” keys simultaneously) to paste the 1N750 model into the
editor text box, as shown in Figure 5-40.

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-41: Locating the Position for a Line Break


9) Press CTRL+M (the “CTRL” and “M” keys simultaneously to add a line break and start a new
line, as shown in Figure 5-42.

Figure 5-42: Adding a Line Break to the Model Directive


10) Enter a “+” at the start of the second line, just before the “Ibv=20.245m” parameter, as shown in
Figure 5-43. The “+” at the start of a line indicates to LTSpice that the line is a continuation of the
previous line.

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.

Figure 5-44: Changing the Directive Justification


12) Select 1N750 in the model directive, as shown in Figure 5-45.

Page 78 of 106
Section 5 - Models

Figure 5-45: Selecting the Model Name for Modification


13) Replace “1N750” to “My1N750”, as shown in Figure 5-46.

Figure 5-46: Model with New Model Name


14) Select “4.7”in the “bv=4.7” parameter, as shown in Figure 5-47.

Figure 5-47: Preparing to Edit the Zener Breakdown Voltage


15) Replace “4.7” with “5.1”, as shown in Figure 5-48.

Figure 5-48: Model with New Zener Breakdown Voltage


16) Select the “4.7” in the “Vpk=4.7” parameter, as shown in Figure 5-49.

Figure 5-49: Preparing to Edit the Peak Voltage Rating


17) Replace “4.7” with “5.1”, as shown in Figure 5-50.

Page 79 of 106
Section 5 - Models

Figure 5-50: Model with New Peak Voltage Rating


18) Click the OK button to exit the SPICE Directive Editor and return to the circuit.
19) Place the model directive at the top of the schematic, as shown in Figure 5-51.

Figure 5-51: Circuit with Modified Zener Diode Model


The My1N750 model has a 5.1V zener breakdown voltage, but because the D1 value still is
1N750 LTSpice still will use the 1N750 model. To use the modified model, change the value of
D1 from “1N750” to “My1N750”.

20) Right-click 1N750 to open the dialog box shown in Figure 5-52.

Figure 5-52: Editing the Zener Diode Model Value


21) Enter “My1N750” in the text box, as shown in Figure 5-53.

Figure 5-53: New Component Value for D1


22) Click the OK button to close the dialog box and return to the circuit, shown in Figure 5-54.

Page 80 of 106
Section 5 - Models

Figure 5-54: Circuit with Modified Zener Diode and Model


23) Save the circuit file under a new name.
24) Simulate the circuit file and add the IN and OUT net waveforms to the Simulation window. The
waveforms should look like those in Figure 5-55.

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.

6.2.2 Netlist Syntax


For LTSpice the basic syntax for a subcircuit netlist is
.SUBCKT <subcircuit name> <I/O nodes>
<reference designator> <node connections> <value>
*<Optional comment>
.ENDS <subcircuit name>
where
.SUBCKT is the SPICE directive for the start of a subcircuit description
<subcircuit name> is the name for the subcircuit
<I/O nodes> are the nodes associated with external connections to the subcircuit
<reference designator> is a unique identifier specifying the type of component
<node connections> are the nodes to which the component connects
<value> is the value of the component
.ENDS is the SPICE directive for the end of a subcircuit description

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.

Figure 6-1: Example Circuit for Netlist


One subcircuit description for the above circuit would be
.SUBCKT MyRC 1 3 4
*Terminals IN OUT REF
R1 1 2 1K
R2 2 3 2.2K
C1 2 4 1µ
.ENDS MyRC
Note that the optional comment “*Terminals” shows that the subcircuit connection nodes 1, 3, and 4 are the
circuit IN, OUT, and REF connections.
This is only “one” subcircuit description, because the order in which components appear the netlist is not
significant, provided that they appear only once and that the netlist specifies their correct nodes and values.
Consequently an equally valid netlist would be
.SUBCKT MyRC 1 3 4
*Terminals IN OUT REF
R2 2 3 2.2K
C1 2 4 1µ
R1 1 2 1K
.ENDS MyRC
Note that although nodes are typically listed in numerical order the order of nodes is not important provided
that the component is not polarized. Resistors, for example, will operate the same regardless of how they
are oriented in a circuit, but diodes will not because their orientation will affect how the circuit operates.
Therefore, both
R1 1 2 1K
and
R1 2 1 1K
are equally acceptable, but
D1 1 2 1N750
and
D1 2 1 1N750
are not, because LTSpice always associates the first node with the anode of a diode and the second node
with its cathode.
Page 84 of 106
Section 6 - Subcircuits

6.2.3 Netlist Exercise


As an exercise, see whether you can determine the circuit described by the following netlist without
looking at the associated circuit below.
.SUBCKT MyPuzzle 1 2
*Terminals IN OUT
R1 1 4 1K
R2 4 3 2.2K
L1 2 3 10m
C1 3 4 1µ
.ENDS MyPuzzle
The circuit described by the above netlist is shown (upside-down) in Figure 6-2.

Figure 6-2: Circuit Associated with Netlist Exercise

6.3 LTSpice Subcircuits


LTSpice uses sub circuits for devices that require multiple components to model their behavior. One
example is an operational amplifier, which at a minimum requires resistances to model its input and output
impedances, a voltage-controlled (or voltage-dependent) voltage source to model its open-loop gain, and a
capacitor (if the amplifier is compensated). LTSpice provides most of the sub circuits for its operational
amplifiers, but two “generic” amplifiers are provided that require sub circuits to function. This discussion
of sub circuits will develop and associate a subcircuit for one of the generic amplifiers.

6.3.1 The Op-Amp Subcircuit


Figure 6-3 shows a simple functional representation of an operational amplifier circuit.

Figure 6-3: Functional Representation of an Op Amp Circuit


The non-inverting and inverting inputs IN+ and IN- have 10 MΩ resistances to ground and between each
other. The differential voltage between IN+ and IN- is applied across Rdiff and the “+” and “−” inputs of
Page 85 of 106
Section 6 - Subcircuits
the voltage-dependent voltage source E1. E1 amplifies this applied voltage by 100,000 and applies it
through the 50 Ω output resistance Rout to the output OUT. When the 1 kHz 10 µV differential and 50
kHz 10 mV common mode signals are applied to the circuit, the input and output waveforms are as shown
in Figure 6-4.

Figure 6-4: Simulation of Op-Amp Circuit


The differential signal is not even discernable on V(in+) or V(in−), because its amplitude is 1/1000th that
of the common mode signal. However, the amplifier rejects the much larger 50 kHz common-mode signal
and amplifies the 1 kHz differential signal by 100,000 to produce a 1 V 1 kHz output. If you wish you can
build the circuit to confirm this, although the emphasis of this example is to show that the circuit behaves
the way a simple operational amplifier would. If you choose to build the circuit, access the voltage-
dependent voltage source as follows.
1) Select the Component tool, shown in Figure 6-5, from the LTSpice menu bar.

Figure 6-5: Component Tool


The Select Component Symbol dialog box will open, as shown in Figure 6-6.

Figure 6-6: Select Component Symbol Dialog Box


2) Select “e”, the voltage-dependent voltage source, as shown in Figure 6-7.

Page 86 of 106
Section 6 - Subcircuits

Figure 6-7: Selecting the Voltage Dependent Voltage Source


3) Click the OK button to exit the Select Component Symbol dialog box and return to the circuit
schematic.

6.3.2 Creating the Subcircuit Netlist


To create the subcircuit netlist for the operational amplifier circuit, first assign references to all the nodes.
Figure 6-8 shows one possibility for assigning the nodes.

Figure 6-8: Operation Amplifier Node Assignments


From the node assignments of Figure 6-8 a subcircuit description would be
.SUBCKT MyOpAmp 1 2 6 3 5
*Terminals IN+ IN- VS REF OUT
RS 3 6 1MEG
Rdiff 1 2 10MEG
R+ 1 3 10MEG
R- 2 3 10MEG
E1 4 3 1 2 100K
Rout 4 5 50
.ENDS MyOpAmp
Use a text editor, such as Windows Notepad accessory, to create the circuit above and save it to your
LTSpice working directory (the directory in which you will create your LTSpice circuit file) with the name
“MyOpAmp.sub”. If you use Notepad, you will need to select “All files (*.*)” from the “Save as type:”
dropdown list to prevent Notepad from appending a .TXT to your filename.

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.

6.3.3 Creating the Op-Amp Circuit


For this example you will create an inverting amplifier with a gain of −10 (meaning that the output voltage
will be 10 times the input voltage but with 180° out of phase with the input). Figure 6-9 shows the LTSpice
inverting amplifier circuit.

Figure 6-9: Inverting Amplifier for Subcircuit Test


1) Select the Component tool from the LTSpice toolbar.
2) From the list of components, double-click [Opamps], which is a subdirectory under the LTSpice’s
main symbol folder. The Select Component Symbol dialog box will display the available
operational amplifiers, as shown in Figure 6-10.

Figure 6-10: Operational Amplifier Selections


3) Slide the horizontal scroll bar under the op-amp list window to access the generic op-amp symbol
opamp2, as shown in Figure 6-11.

Page 88 of 106
Section 6 - Subcircuits

Figure 6-11: Accessing the Generic Op-Amp Symbol


When you right-click once on opamp2, the dialog box will show a preview of the symbol. The
symbol opamp2 has five connections, or pins: inverting and non-inverting inputs, positive and
negative supply pins, and an output. The dialog box also displays a note about using sub circuits
with this symbol, although you won’t be using the LTSpice sub circuits.
4) Click OK to place the opamp2 symbol in the schematic, as shown in Figure 6-12.

Figure 6-12: Generic Op-Amp Placed in Schematic


At this point a word about how LTSpice associates symbols and subcircuits is in order. The LTSpice
symbol has five pins, and the subcircuit you created has five terminal nodes. What ensures that the
subcircuit terminals and symbol pins match up so that circuit components connect to the right subcircuit
nodes through the symbol pins?
The answer is that each LTSpice symbol has a specific order for its pins and the terminal nodes associated
with those connections must have be in the same order in the subcircuit. In other words, LTSpice will
associate the first node in the subcircuit declaration with the first pin in the symbol, the second node to the
second pin, and so on. This requires that the subcircuit must have as many terminal nodes as the symbol
pins associated with it, explaining why VS was added to the op-amp subcircuit. To determine the pin order
for an LTSpice symbol so that you can ensure that the subcircuit node declaration matches, you must
access the Symbol Editor through the Component Attribute Editor.
5) Right click on the op-amp symbol. The Component Attribute Editor will open, as shown in
Figure 6-13.

Page 89 of 106
Section 6 - Subcircuits

Figure 6-13: Component Attribute Editor for Op-Amp Symbol


6) Click the Open Symbol: button to open the Symbol Editor, as shown in Figure 6-14.

Figure 6-14: Op-Amp Symbol in Symbol Editor


The Symbol Editor allows users to modify existing symbols or create their own custom schematic
symbols, but that is beyond the scope of this tutorial. All you will do is find the pin order for the
symbol.
7) Click on View in the Symbol Editor menu bar.
8) Click on Pin Table in the View menu. The Pin List/Netlist Order dialog box will open, as shown
in Figure 6-15

Figure 6-15: Op-Amp Pin Order


As the dialog box shows, the pin order for opamp2 is In+ (the non-inverting input), In- (the
inverting input), V+ (the positive supply pin), V- (the negative supply pin), and OUT (the op-amp
output). This corresponds to the order shown in the MyOpAmp subcircuit file, so that LTSpice
will associate the netlist and simulate the circuit correctly.
9) Click the Cancel button to exit the dialog box.

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.

Figure 6-16: Generic Op-Amp with New Value


The generic op-amp has been renamed, but still requires an association with the subcircuit. This
requires a SPICE directive, similar the directive you used to associate model directives with
components in the last chapter.
12) Select Spice Directive from the Edit menu in the LTSpice menu bar to open the SPICE Directive
Editor, shown in Figure 6-17.

Figure 6-17: Preparing to Enter the SPICE Directive


13) In the text box, enter “.lib .\MyOpAmp.sub”, as shown in Figure 6-18.

Figure 6-18: Entering the SPICE Directive


By default LTSpice searches its default library directories for sub circuits. The .lib directive
instructs LTSpice to search for a subcircuit named “MyOpAmp.sub” in (for this case) the
circuit’s working directory as well. Because sub circuits must have unique names to prevent
scoping issues (i.e., problems with LTSpice using a subcircuit file from the wrong directory) you
should ensure that filenames for your sub circuits are unique. Placing “My” at the front of
filenames or your initials at the end of filenames is generally a safe way to create unique filenames
that will not conflict with LTSpice files.
14) Click OK to accept the SPICE directive and exit editor to return to the LTSpice workspace.
15) Place the SPICE directive near the op-amp, as shown in Figure 6-19.
Page 91 of 106
Section 6 - Subcircuits

Figure 6-19: SPICE Directive Placed in Circuit


16) Complete placing the components, nets, net labels, and transient simulation directive in the circuit,
as shown in Figure 6-20.

Figure 6-20: Completed Op-Amp Circuit


17) Use Save As… in the File menu to save the circuit file under the name “MyOpAmpTest.asc”.
18) Simulate the circuit file using the Run tool in the LTSpice tool bar or Run in the Simulate in the
LTSpice menu bar.
19) Use voltage probes to add waveforms for Vin and OUT to the simulation window. The simulation
should look similar to that of Figure 6-21.

Figure 6-21: Input and Output Waveforms for Op-Amp Circuit


As the waveforms show (and you can use the cursors to verify it), the 100 mVpk output is 10 times
the amplitude of the 10 mVpk input and is 180° out of phase as expected for an inverting amplifier
circuit.
20) Save the plot settings for the simulation.

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.

Figure 6-22: Op-Amp Amplifier Waveforms for R2 = 1 kΩ

Figure 6-23: Op-Amp Amplifier Waveforms for R2 = 50 kΩ

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.

6.4.1 Creating the Library File


This procedure will use Notepad to illustrate the procedure.
1) Open the “MyOpAmp.sub” circuit in Windows Notepad or another text editor. You will need to
change the Text Documents (*.txt) dropdown to All files (*.*) to find the subcircuit file, because
it does not have a .TXT file extension.
2) Select the text for the MyOpAmp subcircuit, as shown in Figure 6-24.

Page 93 of 106
Section 6 - Subcircuits

Figure 6-24: Selecting the Existing Subcircuit Text

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.

Figure 6-25: Text File with Copy of Original Subcircuit Description


7) Change “MyOpAmp” to “MyCompOpAmp” in the .SUBCKT and .ENDS directives of the
duplicate description, as shown in Figure 6-26.

Figure 6-26: Text File with Modified Subcircuit Description


8) Add the line “Ccomp 5 0 5µ” to the modified description to add a compensation capacitor, as
shown in Figure 6-27.

Page 94 of 106
Section 6 - Subcircuits

Figure 6-27: Modified Description with Compensation Capacitor Added


9) Use Save as… in the File menu of the Notepad menu bar to save the modified circuit as
“MyOpAmps.lib” in the LTSpice working directory. Be sure to set the Save as type: drop-down
list to All files (*.*).

6.4.2 Modifying the Generic Op-Amp Circuit


The next step is to modify the circuit so that it uses the library file.
1) In the LTSpice generic op-amp circuit, right-click on the .lib .\MyOpAmp.sub directive to open
the SPICE Directive Editor.
2) Edit the directive to “.lib .\MyOpAmps.lib”, as shown in Figure 6-28.

Figure 6-28: Editing the .LIB Directive


3) Click the OK button to return to the LTSpice workspace. The directive now specifies the
“MyOpAmps.lib” file, as shown in Figure 6-29.

Figure 6-29: Generic Op-Amp Circuit with Updated .LIB Directive


4) Save the circuit to the LTSpice working directory as “MyLibTest.asc”.

6.4.3 Configuring the AC Simulation


Next, you must modify the circuit for ac simulation so that you can observe its frequency response.

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-30: Selecting the V1 as the AC Simulation Source


3) Click the OK button to return to the LTSpice workspace. The ac signal source will display “AC 1”
as one of its properties. If necessary, move any overlapping text so that the text is legible, as
shown in Figure 6-31.

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

Figure 6-32: AC Analysis Simulation Parameters


7) Click the OK button to set the simulation parameters and return to the LTSpice workspace. The
circuit should look similar to that in Figure 6-33.

Figure 6-33: Generic Op-Amp Circuit with AC Simulation Parameters Set


8) Save the circuit file as “MyLibTest.asc” in the LTSpice working directory.

6.4.4 Simulating the Circuit Using the Op-Amp Library


Finally, simulate the circuit file using the different op-amp sub circuits.
1) Run the simulation using the Run tool in the LTSpice tool bar.
2) Use the voltage probe to select the OUT net and add its waveform to the Simulation window. The
waveform should look similar to that in Figure 6-34.

Figure 6-34: Frequency Response for Uncompensated Op-Amp

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.

Figure 6-35: Entering New Value for Generic Op-Amp


5) Click the OK button to accept the new value and return to the LTSpice workspace. The circuit
should now look similar to that in Figure 6-36.

Figure 6-36: Generic Op-Amp Circuit with New Value


6) Re-run the ac simulation. The frequency response waveform should look similar to that in Figure
6-37.

Figure 6-37: Frequency Response of Compensated Waveform


As the frequency response shows, LTSpice is now simulating the circuit using the compensated
op-amp subcircuit in the library file. Rather than having to change the .lib SPICE directive to do
so, the only change was to the value for the operation amplifier, much as you have changed
Page 98 of 106
Section 6 - Subcircuits
component values in LTSpice circuits and would change parts in a real-world circuit. Additional
op-amp types can be added simply by adding additional sub circuits to the library file.

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!

Page 101 of 106


1

You might also like