LTspice Lecture326
LTspice Lecture326
LTspice Lecture326
LTSpice Tutorial
By Wei Wu
Contents
SPICE
Netlist
SPICE Netlist text file containing circuit description
INPUT
OUTPUT
Netlist
Circuit description
* Demo of a simple AC circ.
v1 1 0 ac 12 sin ; v1 is an AC source of 12V amp.
r1 1 2 30 ; r1 is 30 Ohm between nodes 1 and 2
c1 2 0 100u ; c1 is 100uF between nodes 2 and 0
.ac lin 1 60 60 ; directive to perform AC analysis
.print ac v(2) ; print out the voltage from node 2
.end ; anything after .end will be ignored
SPICE directives
Commands starting with dot (.ac, .end, etc.) are known as
SPICE directives
http://www.linear.com/designtools/software/#LTspice
w
o
D
a
o
nl
e
c
i
p
s
T
L
d
Place Diode / D
Place Inductor /L
Toolbar Summary
Place Capacitor /C
Place Resistor /R
Label Node /F4
Place Ground /G
Draw Wire /F3
Simulate
Zoom In/
Ctrl +Z
Move/F7
Pan
Zoom Out/Ctrl +B
Find
Copy/F6
Paste
Drag/F8
Undo/ F9
Redo/ Shift+F9
Rotate/ Ctrl +R
Mirror/Ctrl+E
Place Comment /T
8
Color
Press Tools-> Color Preference
To change background color or wire
color
Change both Schematic & Waveform
background color to White for your
report. Save printer ink!!
Rotation
10
Add Component
Click R add resistor
Right-click component to
enter component value
Or Click
Or Click F2 or Component
to add components.
Or Right-click R to
enter component value
Right-click R1 to
change designator
11
Add Source
Right-click component to
enter DC value
12
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
A Simple Example
14
SPICE analysis
After finishing your circuit, 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)
15
16
Simulation Results
After run the simulation, a
new window will show up.
Its the waveform viewer
with .raw extension.
Left click on any wire in the
schematic file to plot the voltage
of that point on the waveform
viewer.
Simulation Results
Voltage at node n001
Current across Rx
Voltage Value
Time
Current Value
Apparent Power
18
Add Labels
Add Labels to signals/ netlist
19
19
Simulation Types
Recall, there are many simulation options such
as:
Transient analysis
AC small signal anlysis
DC sweep
Noise analysis
DC transfer function
DC operating point (Q-pt)
20
Transient Analysis
Transient Analysis:
It computes the time response of all
components in any circuit. Isa a non-linear,
time domain analysis. X-axis is the timed in
seconds and y-axis will be any electrical
variables.
You can specify several parameters such as:
*Stop Time (duration of simulation)
*Time to start saving data (set up starting
time other than 0)
*Maximum Time step: smallest interval of
time step
21
DC sweep
DC Sweep
It will show the transfer function of an
amplifier, DC characteristic curves of a
transistor.
23
Noise
Noise
Test the response of an audio amplifier
under noise conditions.
Specify input and output nodes.
Noted, click on resistor R1 and R2, it will show
the noise contribution of these resistors. If we
would like to ignore the noise caused by R1,
just add noiseless note behind the resistor
value.
It also can provide gain plot. When use Add
Trace command
24
DC Transfer Function
DC Transfer Function
This is an analysis mode that finds the dc
small signal transfer function of a node voltage
or branch current due to small variations of an
independent source.
25
DC operating point
DC Operating Point:
It determines the DC conditions of a biased
transistor. ( operation region of BJT/ MOSFET)
Computes DC node voltages and loop currents
of an electric network. AC sources are
disconnected
26
Cursor:
For accurate measurement / data reading, apply just left click
on V(out) , a cursor will show up(#1). Hold left click and drag
the cursor to any point you want to measure. Left click once
again will give you another cursor (#2). A small windows will
show up on the most right corner of your desktop that provides
extra information.
27
Math
Math function
Right click on monitored signals
(V(out)). A expression editor will
show up that allows you to apply
some simple math function on this
signal.
for example abs(V(out)) will
give the absolute value of V(out)
signal.
28
FFT
FFT
Select waveform viewer , go to
View -> FFT
Select signals, for example V(out),
you can change the time range and
other parameters.
Click ok, the FFT result window
will provide you the result.
29
Initial Condition
Initial Condition
In some cases, especially for transient analysis, set up a starting voltage for certain component
(capacitor/ inductor) will be very helpful. Ltspice has a spice directive .IC that allows to set
initial condition.
Use
30
Parameter
Parameters:
If there are lots of same components in the schematic that may subject to change
occasionally. It will be very convenience to use parameter definition. Its a spice directive.
First, right click on the component, instead of adding a real value, use {parameter name}.
For example,
use
command to insert a spice directive: .param Rpa = 1k and add this directive
into the schematic. The resistor value of RL is equal to 1k in this case.
31
Step
Set up step:
LTSpice can do much more stuff, for example, sweep parameters. For example, if we
would like to check the circuit performance with various load conditions and compare the
result. Set up a load parameters will be the easiest way.
Use
command to add spice directive. Type: .Step param Rpa 100 1k 100 dont
forget to replace the real value of load with {Rpa}
32
33
34
Example
35
Example
36
Transformer
There is no transformer model exists in LTSpice software, however, we can simulate it by
using inductors.
*Draft an inductor for each transformer winding
*Couple them using a single mutual inductance (K) statement via a SPICE directive
K [inductor 1] [inductor 2] [coupling coefficient]
*Add the K statement will displays the dot on the inductors, adjust the transformer
polarity position
*Give values to two inductors, notice the relationship between inductor value and turns
ratio:
*Ideal transformer, very large inductance and coupling
coefficient =1.
Note: A series resistance in primary side is required for
computation, say 0.1 ohm (make it small); The
inductance should be much larger than the series
resistance ;
37