Professional Documents
Culture Documents
Electronic Ciriuct Simulation LTspice Softwer
Electronic Ciriuct Simulation LTspice Softwer
LTspice
By
Ketema Tullu
email:- ketematullu@gmail.com
1
SPICE
Simulation Program with Integrated Circuit Emphasis
Originally developed at EE Berkeley
Uses mathematical models to describe circuit elements
SPICE3 is the latest variant.
It allows DC and time transient analysis of nonlinear circuits
(transistors, diodes, capacitors, etc., also digital circuitry)
Command line driven interface
Available in public domain (written in C)
Has become de-facto the industry standard
Many spin-offs exist (use modified SPICE2 or SPICE3 as their
engine), such as HSPICE, PSPICE, WinSPICE (commercial)
2
LTspice IV
A freeware circuit simulator (Windows or *nix/Wine)
Mac users: install http://winebottler.kronenberg.org/
Netlist syntax is powerful but hard to visualize
LTspice has schematic capture and is much easier to use
than traditional text-based SPICE. The user can enter a
circuit to be simulated via a graphical user interface
Has virtual scope, makes Bode plots, performs FFT, etc.
Worth learning about
– It is fast, expandable, powerful, and free
– Most widely used noncommercial CAD electronics software
3
Why Use LTspice?
Stable SPICE circuit simulation with:
Unlimited number of nodes
Schematic/symbol editor
Waveform viewer
Library of passive devices
Fast simulation of switch mode power supplies
Steady state detection
Turn on transient
Step response
Efficiency / power computations
Advanced analysis and simulation options
Not covered in this lab class (sort of)
Outperforms or as powerful as pay-for tools
In other words LTspice is free!
Automatically builds syntax for common tasks 4
How Do I Get Started Using LTspice?
JIG Files: Use a pre-drafted test fixture (JIG)
Provides a good starting point, but is not production-ready
Used to prove out part models, and are not complete designs
Components are typically “ideal” components and will need to
be modified based on your operating conditions
Use simulation circuits posted on the LTspice Yahoo! User’s Group
URL = https://groups.yahoo.com/neo/groups/LTspice/info
Also contains many very helpful discussion threads and tutorials
Use the schematic editor to create your own design
LTspice contains models for most LTC power devices, opamps,
and many more
ADI opamp models are being added to the LTspice library
(nearly 100 ADI models to date)
LTspice can be used to simulate any analog circuit you can
think of! 5
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
6
http://www.linear.com/designtools/software/
i ce
Tsp
d L
lo a
w n
D o
7
To begin drawing the circuit, click New
Schematic, or Ctrl+N
Enable grid if not shown by clicking
Ctrl+G
8
wire “Component”
ground
(required)
Simulate
Move
Zoom In
Drag
Pan
Undo
Zoom Out Find
Auto Scale Redo
Delete Rotate
Copy Mirror
Paste Place Comment
11
Place SPICE Directive
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]
aste b/t Schematics [Ctrl+V] Mirror [Ctrl+E]
Find [Ctrl+F] Place Comment/text [T] 12
Place SPICE directive [S]
Prefixes are case insensitive: T = t, G = g, and so on
• T = terra = 1012
• G = giga = 109
• MEG = meg = 106
• K = kilo = 103
• M = milli = 10-3
• U = micro = 10-6
• N = nano = 10-9
• P = pico = 10-12
• F = femto = 10-15
No need to enter units, they are assumed (e.g. “1M” is
1mV if entered for voltage, 1ms if entered for time, etc.)
13
How to Wire up a Simple RC Circuit
Step 1: Open up a blank schematic screen
Select “File” Menu and “New Schematic”
14
Cont.…
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.
15
•
Cont.…
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. T
“Vo ype
ltag
” e
el ect
u , s
men ent”
3. K”
d i t on
E p
1. Com
Cli
“O
“
ck
16
Cont.…
• Step 4: Wire up the circuit
– Using the toolbar, select Wire, or, press F3
1. Sele
ct
“Wire”
button
17
Step 4: Wire up the circuit (cont.)
18
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
19
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
20
Running and Probing a Circuit in LTspice
The following hotlinks are used in this presentation for opening up
LTspice simulation files
Note: Presentation Mode must be used for the hotlinks to work
Class exercise
Solution to exercise
Circuits to explore at your leisure
21
Running the RC Circuit Simulation – Transient Analysis
With the RC circuit in the active window, click on the RUN button
on the toolbar
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
Run
Click here for
output
waveform
22
Cont.…
To add a measurement cursor to the waveform window, left+click
the mouse on the waveform name.
To add a second measurement cursor (paired cursors), just
left+click on the waveform name again.
Click to display
measurement
cursor. Click
and drag cursor
position.
23
Cont..
To display the current in the resistor, just
left+click on the resistor.
24
Cont..
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
25
Summary of the Waveform Viewer
26
SPICE analysis
“Draw” your circuit, then specify all of the components,
then select Simulate Edit Simulation Cmd
Your choices:
Transient analysis
AC small signal anlysis
DC sweep
Noise analysis
DC transfer function
DC operating point (Q-pt)
Highlighted is what you will
be using in this course
27
Adding SPICE directives
After setting up the simulation command, you are set to
go. Simply click Run button
Run command is a SPICE directive itself
You can add other SPICE commands directly by clicking
on Spice Directive button
Refer to HELP for details on the syntax
28
SPICE use in this course
Your home assignment for this week includes working
your way through Supplement Part 1 (a tutorial) then
working home problems using LTspice.
Install LTspice on your own computer. LTspice is
installed on all lab computers and in A&EP computer
room
Supplement Part 2 contains LTspice experiments.
They will start after the break and are to be done in the
same way as the usual lab experiments, but using
LTspice. Print out results using the lab printers, attach
them to your lab report, etc.
You can do LTspice experiments anywhere you have
29
access to LTspice, not just in the lab
Two examples
We will look at how to setup two examples
o Example1: crossover corrected push-pull amp (ex6.10)
o Example2: active filter
Any additional files not included with LTspice but
required for this course are found under Spice models on
the Blackboard.
30
First example demonstrates transient analysis
31
Assigning Vin
• Right-click on Vin, then click Advanced. You will see a
window like this. Choose SINE Function.
Enter:
DC offset[V] : 0
Amplitudep[V]: 0.05
Freq[Hz]: 100
Tdelay[s]: 20m
32
Assigning Diodes and Transistors
If you do not assign diode and transistors, LTspice will use
some default models. It may be OK for a simple circuit like
the one we are looking at. Real-life situations require more
accurate model specific to the actual component being
used. E.g. to assign a specific diode model, right-click on it,
then click “Pick New Diode” and choose IN914.
33
Assigning Transistors and opamp
Similarly, assign the transistors to be 2N3904 and
2N3906
Note: you will find some familiar components missing
(e.g. LM741 op-amp); you have to add them to LTspice
All major manufacturers will have SPICE model files
online
34
How to add LM741
Google for LM741, you will get to the manufacturer’s
web-site with link to Model file LM741.MOD
Download it, it is an ASCII file in SPICE format:
component model
describes frequency
response, input and
output impedance, etc.
can be a subcircuit that
includes other elements
35
How to add LM741
Place this file where LTspice will look for it, preferably in
the local directory (where you circuit file is saved)
Add generic opamp (opamp2) to your circuit
Right-click on the symbol to invoke
Component Attribute Editor
Enter Value = LM741/NS
(must match the first line in LM741.MOD file,
which is not a comment, i.e. not preceded
by *, something like .SUBCKT
LM741/NS …)
Add SPICE directive
36
Time Transient Analysis
Choose Simulate Edit Simulation Cmd
Indicate Stop Time of 0.1 s
Click OK and place SPICE
directive somewhere on
your circuit
Ready to go!
37
Looking at the result
LTspice has nice tools to look at the waveforms, voltages
or currents, FFT (Fourier Analysis), gain amplitude and
phase (in AC analysis)
You can open multiple panes, plot signals versus time
or signal versus another signal
You can zoom in, zoom out, also activate scope-like
cursor(s) for more accurate measurements on waveforms
By default the mouse cursor transforms into voltage
probe, however, when hovering over a component (or
pressing Alt over wire), it transforms into current probe
Pressing Alt over an element will report instantaneous
power drawn by the element (thermometer icon) 38
Second example will Must include with this opamp!
demonstrate AC analysis
39
Assigning Vin
Right-click on Vin, then click Advanced. Use Small
signal AC analysis section.
AC amplitude
1 volt
40
AC Analysis
Choose Simulate Edit Simulation Cmd
On AC analysis tab specify
type of sweep (decade),
number of points per decade,
initial and final frequencies
Click OK, plant SPICE
directive somewhere
Ready to go!
41
• Click on Vout to
display Bode
plot
42
Few gotchas
“M” and “m” are interpreted the same by SPICE. Thus, a
resistor value of 10M is the same as 10m (ten milliohms)
Use 10MEG (or 10E6) to specify ten megohms
Do not enter “1F” or “1f” as the capacitance for a one-
farad capacitor (enter “1”). “F” and “f” designate the
prefix femto (10-15)
When simulating astable circuits (multivibrator), specify
some small nonzero initial voltage in the positive
feedback to seed the oscillations
44
Additional resources
LTspice Supplement (read Part 1 Tutorial this week)
Documentation and examples installed with LTspice
Our PHYS3360 mailing group
Yahoo! LTspice group (great resource, kept active by many
thousands of users)
45
Links
http://www.intusoft.com/models.htm#freemodels
http://www.penzar.com/links.htm
http://ee.cleversoul.com/simulation.html
http://cmosedu.com/videos/videos.htm
http://cmosedu.com/cmos1/book.htm
http://www.onsemi.com/site/support/models
http://www.coilcraft.com/modelsswcad.cfm
http://tech.groups.yahoo.com/group/LTspice/
http://ltspice.linear.com/software/scad3.pdf
46
nk
h a
•T u
o