0% found this document useful (0 votes)
49 views62 pages

1.0.LTspice Basic Tutorial

Uploaded by

duc04112005
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)
49 views62 pages

1.0.LTspice Basic Tutorial

Uploaded by

duc04112005
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/ 62

LTspice XVII Basic Lab Class

©2019 Analog Devices, Inc. All rights reserved. 1


How Do I Get LTspice and Documentation?

❖ Go to http://www.analog.com/LTspice
❖ Left-Click on Download LTspice for Windows 7, 8 and 10
❖ Follow the instructions to install
❖ LTspice is a standalone application that runs on your computer

❖ At this link, you will also find:


✓ LTspice Download Links
✓ LTspice Demo Circuits
✓ LTspice Documentation
✓ LTspice Technical Articles & Videos
✓ SPICE Models

2 ©2019 Analog Devices, Inc. All rights reserved.


Using the Schematic Editor in LTspice

3 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit

► The completed exercise:

4 ©2019 Analog Devices, Inc. All rights reserved.


Toolbar and Keyboard Shortcuts

Place Circuit Element [F2]


Zoom In Place Diode [D]
Pan Place Inductor [L]
Zoom Out Place Capacitor [C]
Autoscale Place Resistor [R]
Label Node [F4]
Place Ground [G]
Draw Wire [F3]

Move [F7]
Drag [F8]
Undo [F9]
Delete [Del] Redo [Shift+F9]
Duplicate [Ctrl+C] Rotate [Ctrl+R]
Paste b/t Schematics [Ctrl+V] Mirror [Ctrl+E]
Find [Ctrl+F] Place Comment/text [T]
Place SPICE directive [S]
5 ©2019 Analog Devices, Inc. All rights reserved.
How to Wire up a Simple RC Circuit

► Step 1: Open up a blank schematic screen


▪ Select “File” Menu and “New Schematic”

6 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit

► Step 2: Add the passives and grounds


▪ Using the toolbar, select Resistor, Capacitor and Ground. Place these symbols on the schematic as shown below. Use
Ctrl+R to rotate before placement.

Select and place


res, cap & GND, or
use keyboard keys
R, C, and G
Tip: Ctrl+R to rotate
before placement

7 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit

► Step 3: Add the voltage source


▪ Select “Edit” Menu and “Component”. From the component window, start typing “voltage” in the dialog box,
and click “OK”

2. Type
“Voltage”

3. Click “OK”

1. Edit menu, select


“Component”
8 ©2019 Analog Devices, Inc. All rights reserved.
How to Wire up a Simple RC Circuit (cont.)

► Step 4: Wire up the circuit


▪ Using the toolbar, select Wire, or, press F3

1. Select
“Wire” button

9 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit (cont.)

► Step 4: Wire up the circuit (cont.)

Left-Click ground “Pull” wire through the resistor “Pull” wire down through the capacitor
“Pull” wire up through the source Left-Click here to anchor Left-Click here to anchor & finish
Left-Click here to anchor

Hint: Press the ESC key at any time to clean up the schematic

10 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit (cont.)

► Step 5: Add net labels


▪ Using the toolbar, select Label Net (or press F4). Label the input/output nodes as shown below

1. Select “Label
Net”
2. Enter net
name

3. Place on wire

11 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit (cont.)

► Step 6a: Component values


▪ Right-Click on each component symbol to change its value as shown below

Right-click on
symbol

Or Right-click on
value

12 ©2019 Analog Devices, Inc. All rights reserved.


Using Labels to Specify Units for Component Attributes

► M = m = milli = 10-3 ► K = k = kilo = 103


► U = u = micro = 10-6 ► MEG = meg = 106
► N = n = nano = 10-9 ► G = g = giga = 109
► P = p = pico = 10-12 ► T = t = tera = 1012
► F = f = femto = 10-15

Hints
 Use MEG (or meg) to specify 106, not M
 Enter 1 for 1 Farad, not 1F

13 ©2019 Analog Devices, Inc. All rights reserved.


Editing Components

► Right-Click on the component to edit attributes

► You can also edit the visible attribute and label by pointing at the text with the mouse and
then right-clicking
► Mouse cursor will turn into a text caret

14 ©2019 Analog Devices, Inc. All rights reserved.


Component Database

► Resistors, capacitors, inductors, diodes, Bipolar transistors, MOSFET transistors, JFET transistors,
Independent voltage and current sources
► You can access a database of known devices

15 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit (cont.)

► Step 6b: Source parameters


▪ Right-Click on the voltage source and enter the parameters shown below under the “Advanced” tab.

Click
“Advanced”

Right-click source

16 ©2019 Analog Devices, Inc. All rights reserved.


How to Wire up a Simple RC Circuit (cont.)

► Step 6b: Source parameters


▪ Select the PULSE button and enter the parameters shown below:

17 ©2019 Analog Devices, Inc. All rights reserved.


Running and Probing a Circuit in LTspice

18 ©2019 Analog Devices, Inc. All rights reserved.


Running the RC Circuit Simulation – Transient Analysis

► With the RC circuit in the active window, click on the RUN button on the toolbar
C:\NewPresentation\ShortCut2.bmp

► The Edit Simulation Command window will appear. Set the Stop Time to 60m and click OK.
► Using the mouse, click on the IN node and OUT node to display the input and output voltage
waveforms.
Run
Click here for
output
waveform

RCFilterTimeDomain.asc
19 ©2019 Analog Devices, Inc. All rights reserved.
Running the RC Circuit Simulation – Transient Analysis

► To add a measurement cursor to the waveform window, left+click the mouse on the waveform name.

► To add a second Click to display


measurement cursor measurement
(paired cursors), just cursor. Click
and drag cursor
left+click on the position.
waveform name again.

RCFilterTimeDomain.asc

20 ©2019 Analog Devices, Inc. All rights reserved.


Running the RC Circuit Simulation – Transient Analysis

► To display the current in the resistor, just left+click on the resistor.

Click here for


resistor current
waveform

RCFilterTimeDomain.asc
21 ©2019 Analog Devices, Inc. All rights reserved.
Running the RC Circuit Simulation – Transient Analysis

► Split the plot pane by selecting “Add Plot Pane” under the Plot Settings pull-down menu.
► Drag and drop the I(R1) waveform title into the new plot pane

22 ©2019 Analog Devices, Inc. All rights reserved. RCFilterTimeDomain.asc


Summary of the Waveform Viewer

► LTspice integrated waveform viewer:


▪ Plot the voltage on any wire by a simple point and click

Voltage probe cursor

▪ Plot the current through any component by clicking


on the body of the component

Current probe cursor

► When using the current probe, the convention of


positive current is from netlist pin #1 to pin #2.
► Add a waveform measurement cursor by left+clicking on
the waveform name. Add a second measurement cursor
by left+clicking on the waveform name again.
23 ©2019 Analog Devices, Inc. All rights reserved.
AC Analysis

24 ©2019 Analog Devices, Inc. All rights reserved.


AC Analysis Overview

► Performs small signal AC analysis linearized about the DC operating point


► Useful for analysis of filters, networks, stability analysis, and noise considerations

25 ©2019 Analog Devices, Inc. All rights reserved.


Simulating AC Analysis – RC Filter

► Single pole filter using RC network


► Syntax: .ac <oct, dec, lin> <Nsteps> <StartFreq> <EndFreq>
► Example: RC network and .ac dec 100 .01 1MEG

-3dB point:
1/(2*pi*R*C) = 159Hz

AC amplitude of 1 sets
magnitude to 0dB

Right-click on .tran
command and select
“AC Analysis”

26 ©2019 Analog Devices, Inc. All rights reserved.


Simulating AC Analysis – RC Filter

► Right-click on the .tran command


► Select AC Analysis tab
► Enter the following parameters:

27 ©2019 Analog Devices, Inc. All rights reserved.


Simulating AC Analysis – RC Result C:\NewPresentation\ShortCut2.bmp

C:\NewPresentation\ShortCut2.bmp

Click here for


Bode plot

28 ©2019 Analog Devices, Inc. All rights reserved.


Simulating AC Analysis – Active Filter

► Single pole active filter using an opamp (AD8672)


C:\NewPresentation\ShortCut2.bmp

Click here for


Bode plot

ActiveFilterACSweep.asc
29 ©2019 Analog Devices, Inc. All rights reserved.
Defining a Component Value as a Variable
(a taste of intermediate & advanced topics)

30 ©2019 Analog Devices, Inc. All rights reserved.


Defining a Component Value as a Variable (Using Parameters)

► The .param SPICE directive allows the creation of user-defined variables.


► To define a component value as a variable, replace the component value with a variable name
enclosed in curly braces. Example: {X}
Right+click to
change the
component
value to {X}

Add the
.param SPICE
directive (press
S on the keyboard)

RCFilterACAnalysis_Param.asc

31 ©2019 Analog Devices, Inc. All rights reserved.


Defining a Component Value as a Variable (Using Parameters)

► The simulation results are the same as when the component value was defined as 10K.
C:\NewPresentation\ShortCut2.bmp

Click here for


Bode plot

RCFilterACAnalysis_Param.asc
32 ©2019 Analog Devices, Inc. All rights reserved.
Defining a Component Value as a Variable (Stepping Parameters)

► The .STEP command can be used to vary a component variable over a range of values to plot a
family of curves.
► This is very powerful and can be used for sensitivity and Monte Carlo Analysis.

Right+click to
change SPICE
directive to the
.step command

RCFilterACAnalysis_Step Command.asc

33 ©2019 Analog Devices, Inc. All rights reserved.


Defining a Component Value as a Variable (Stepping Parameters)

► For this AC analysis example, the simulation result includes three Bode plots, one each for R = 10K,
20K, and 30K C:\NewPresentation\ShortCut2.bmp

Click here for


Bode plot

RCFilterACAnalysis_StepCommand.asc
34 ©2019 Analog Devices, Inc. All rights reserved.
Running a DC/DC Converter Simulation
and Analyzing Circuit Performance

35 ©2019 Analog Devices, Inc. All rights reserved.


Running a DC/DC Converter Simulation

► Access the LTC3412A circuit


▪ Click File ---> Open, and navigate to the LTspice Lab folder on your desktop. Look for the file titled
“LTC3412A_DC_Load.asc”
C:\NewPresentation\ShortCut2.bmp

▪ Or click “c” symbol on the right

©2019 Analog Devices, Inc. All rights reserved. LTC3412A_DC_Load.asc


36
Viewing Voltage Waveforms

► Plot the voltage on any wire by Left-Clicking it


▪ Tip: All Demo Circuits have INs and OUTs clearly labeled to help you quickly select them

Click here for


output
waveform

LTC3412A_DC_Load.asc
37 ©2019 Analog Devices, Inc. All rights reserved.
Viewing Current Waveforms

► Plot the current through any component by Left-Clicking on the body of the component
▪ Current flowing into a node is defined as being positive

Click here for


inductor current
waveform

LTC3412A_DC_Load.asc
38 ©2019 Analog Devices, Inc. All rights reserved.
Zooming In and Out on a Waveform

► In the waveform window, use the mouse to zoom in and out. Click and drag a box about the region
you wish to see drawn larger
► Using the toolbar, click on “Zoom full extents”, to zoom back out

Zoom Full Extents

LTC3412A_DC_Load.asc

39 ©2019 Analog Devices, Inc. All rights reserved.


Measuring V, I and Time in the Waveform
(Measurement Using Cursors)
► Right-Click on the waveform name in the waveform window
► For “Attached Cursor”, select “1st & 2nd”
► Position cursors to make desired measurements

1. 2. 3.

Result

LTC3412A_DC_Load.asc
40 ©2019 Analog Devices, Inc. All rights reserved.
Measuring V, I and Time in the Waveform
(Measurement Using Zoom Window)
► Drag a box about the region you wish to measure
▪ Left-Click, drag, and hold
► View the lower left corner of the window for the status bar. The dx and dy measurement data is
displayed here.
► Use Undo from the File menu or press “F9”

LTC3412A_DC_Load.asc
41 ©2019 Analog Devices, Inc. All rights reserved.
Viewing Differential Voltage Waveforms

► Left-Click on one node and drag the mouse to another node


▪ Red voltage probe at the first node
▪ Black probe on the second

LTC3412A_DC_Load.asc
42 ©2019 Analog Devices, Inc. All rights reserved.
Viewing Differential Voltage Waveforms

► To create a measurement reference node, Right-Click on the desired node and select “Mark
Reference”
▪ A black voltage probe is anchored to the selected node
► All measurements in the circuit are now referenced to the node with the black probe
► Hit the ESC key to remove the reference mark

LTC3412A_DC_Load.asc

43 ©2019 Analog Devices, Inc. All rights reserved.


Viewing Wire Current Waveforms

► Plot the current through any wire by Alt+Left-Clicking on the wire


▪ An ammeter will appear to indicate that the wire current will be displayed

LTC3412A_DC_Load.asc

44 ©2019 Analog Devices, Inc. All rights reserved.


Average & RMS Calculations

► Average & RMS Current, Voltage, or Power Dissipation


▪ Calculated only for the visible area of the plot window
► Click on inductor L1 to display the inductor current waveform
▪ Ctrl+Left-Click the I(L1) trace label in the waveform view

Example:
Measure average and RMS
current for inductor in
LTC3412A circuit. Zoom in
as shown for this
waveform.

LTC3412A_DC_Load.asc
45 ©2019 Analog Devices, Inc. All rights reserved.
Instantaneous & Average Power Dissipation

► Instantaneous Power Dissipation


▪ Alt+Left-Click on the symbol of the LTC3412A
▪ Waveform is displayed in units of Watts

► Average Power Dissipation


▪ Click, hold, and drag in the waveform window to
display waveform at steady state
▪ Ctrl+Left-Click on the Power Dissipation Trace
Label in the waveform view
▪ Waveform summary window will appear which
shows power dissipation in the IC
Example:
Measure the power dissipation in the
LTC3412A IC
LTC3412A_DC_Load.asc

46 ©2019 Analog Devices, Inc. All rights reserved.


Deleting Waveforms

► Method #1: Right-Click on a trace label to be deleted


▪ Select “Delete this Trace”
▪ Deletes only the selected trace

LTC3412A_DC_Load.asc

47 ©2019 Analog Devices, Inc. All rights reserved.


Deleting Waveforms

► Method #2: If the plot window is active hotkey F5 is equivalent


▪ Cursor turns into scissors
▪ Left-Click on one or more trace labels to delete. ESC to quit

©2019 Analog Devices, Inc. All rights reserved. LTC3412A_DC_Load.asc


48
Deleting Waveforms

► Method #3: Plot the same waveform twice in succession


▪ Deletes all but that waveform

Click,
click

LTC3412A_DC_Load.asc
49 ©2019 Analog Devices, Inc. All rights reserved.
Net Labeling

50 ©2019 Analog Devices, Inc. All rights reserved.


Advantages of Labeling

► Replaces the default SPICE node names with node names and waveform titles that are easy to
understand and remember
► Allows LTspice circuit nodes to match those on your production schematic, i.e. “TP15”
Without With

51 ©2019 Analog Devices, Inc. All rights reserved. LTC3412A_DC_Load.asc


Labeling - Trick

► Highlight net from waveform viewer


▪ Alt-Left-Click on the label in the waveform viewer (i.e. V(n006)) and it will now highlight that particular net on
the schematic. You can also use the search function ( )

Alt-Left-
Click

Net
Highlighted

LTC3412A_DC_Load.asc
52 ©2019 Analog Devices, Inc. All rights reserved.
Importing Third Party SPICE Models

53 ©2019 Analog Devices, Inc. All rights reserved.


Importing Third Party SPICE Models

Steps for importing a third-party SPICE model:


1.) Download the SPICE model file from the manufacturer’s website
2.) Place the SPICE model file in the same directory as the LTspice simulation file
(simplest). It can be placed in another folder on your computer or even on a network
drive.
3.) Open up the SPICE model file and note the device name
4.) Add the following SPICE directive to the LTspice simulation schematic (Edit pull-
down menu ---> SPICE Directive):
.include spice_model_file_name.abc
5.) Modify the device name on the LTspice schematic to match the device name
listed in the SPICE model file (Right+Click on the device name on the simulation
schematic and modify accordingly).

54 ©2019 Analog Devices, Inc. All rights reserved.


Importing Third Party SPICE Models

The following items are CRITICAL!


1.) The file name in the .include statement must match the SPICE model file name
identically! The file name syntax is can be anything, just make sure that all of the
characters match.
2.) The device name on the LTspice simulation schematic must match the device
name in the SPICE model file identically! The device name syntax can be
anything, just make sure that all of the characters match.

55 ©2019 Analog Devices, Inc. All rights reserved.


Importing Third Party SPICE Models

SPICE Model File name = 1N5244B.mod


Example #1:
Model name = 1N5244B1

Summary: The file and device


names are irrelevant. Just make
sure that the LTspice simulation
device name and .include file name
match those of the SPICE model file.

SPICE Model File name = Joe.txt


Example #2:
Model name = Everest

56 ©2019 Analog Devices, Inc. All rights reserved.


Importing Third Party SPICE Models

Hands-on Exercise:
1.) Navigate to the LTspice Training Files folder
C:\NewPresentation\ShortCut2.bmp

2.) Open up the simulation file titled “Zener Import


Example.asc”
3.) Open up the SPICE model file titled
“1N5244B.mod” and note the device name.
4.) Modify the simulation file so that it uses the
1N5244B third-party SPICE model based on the
instructions provide on the previous slides
5.) Run the simulation and probe the IN and OUT
nodes

57 ©2019 Analog Devices, Inc. All rights reserved.


Importing Third Party SPICE Models

Solution:
1.) Zener name changed to 1N5244B1
to match device name in the SPICE
model file. Right+Click on the diode
name text to change.
2.) .include SPICE directive added to link
to the SPICE model file. Use the Edit
pulldown menu ---> SPICE Directive to
add this SPICE directive to your
simulation.
3.) Result after clicking on the Running
Person symbol on the toolbar and
probing the IN and OUT nodes.

58 ©2019 Analog Devices, Inc. All rights reserved.


Importing Third Party SPICE Models: Practical Example Using AD8237

Steps:
1.) Download the AD8237 SPICE model from the ADI website
2.) Open up the AD8237 SPICE model using LTspice
3.) Use LTspice to autogenerate the schematic symbol (right-click on the .SUBCKT statement)

4.) Wire up the circuit


59 ©2019 Analog Devices, Inc. All rights reserved.
Importing Third Party SPICE Models: Practical Example Using AD8237

Autogenerated Schematic Symbol:

60 ©2019 Analog Devices, Inc. All rights reserved.


Importing Third Party SPICE Models: Practical Example Using AD8237

Final Implementation:

61 ©2019 Analog Devices, Inc. All rights reserved.


Other Resources

► LTspice forum: Use simulation circuits posted on LTspice Yahoo! User’s Group
▪ Go to https://groups.yahoo.com/neo/groups/LTspice/info
▪ Also contains many very helpful discussion threads

► Educational Files: Check out LTspice capabilities using the education examples
▪ Available on C:\Program Files\LTC\LTspiceXVII\examples\Educational

► LTspice videos: Video tutorials by Linear’s technical staff


▪ LTspice Videos at www.analog.com

► LTspice Videos on YouTube!


▪ https://www.youtube.com/results?search_query=ltspice

► LTwiki: Undocumented features …


▪ http://ltwiki.org/

► Wurth LTspice Book – available at Amazon, or, contact your local Wurth field sales engineer

62 ©2019 Analog Devices, Inc. All rights reserved.

You might also like