Date post: | 14-Apr-2018 |
Category: |
Documents |
Upload: | harish-tella |
View: | 286 times |
Download: | 0 times |
of 13
7/30/2019 Ltspice Guide for Beginners
1/13
Using LTspiceSPICE (Simulation Program with Integrated Circuit Emphasis) is a powerful program that facilitates the
simulation of electronic circuits. Many popular circuit simulators use the SPICE engine, and combine it
with other features. LTspice is a free SPICE-based application developed by Linear Technology. LTspice
is used in this course because it is updated frequently, easy to use, and is completely free for you todownload at home. Linear Technology offers LTspice for free because the software includes accurate
circuit models of many of their components, making it easy for designers to chose Linear Technology
products in their designs. However the software also contains generic circuit models, making it highly
popular among students and hobbyists.
From the LTspice documentation:
LTspice IV runs on any 32 or 64 bit version of Windows. LTspice also runs under Linux via
WINE and current Macintosh hardware via Crossover, Parallels, or DARWINE.
LTspice IV can be downloaded from http://www.linear.com. A direct link to the distributed
ile is http://ltspice.linear.com/software/LTspiceIV.exe. The ile LTspiceIV.exe is a self-extracting
gziped ile that installs LTspice IV as it extracts.
Schematic Editing
LTspice schematic iles have the extension .asc, to create a new ile type Ctrl N or selectFile > New
Schematic. To add components to the schematic, you can use the Edit menu shown in Figure 1, or use
the keyboard shortcuts shown alongside each option. Learning the keyboard shortcuts is advisable, as
it makes working in LTspice signiicantly easier.
Figure 1: The Edit menu, used for adding components, labels and circuit connections.
Shortcuts exist for common circuit components such as resistors (type 'R') and capacitors (type 'C'),
and 'F2' is the shortcut for placing a new component. Figure 2 shows the component selection win-
1
7/30/2019 Ltspice Guide for Beginners
2/13
Table 1: Engineering unit preixes recognised by LTspice.
preix symbol recognised by LTspice value
pico p 1012
nano n 109
micro u 106
milli m 103
kilo k 103
mega Meg or meg 106
arbitary exor Ex 10x
dow, take the time to look at the different components LTspice offers. All of the generic, ideal circuit
components are located in the top level directory of the component selector. Inside the subfolders
([Comparators], [PowerProducts] , etc) are the circuit models of Linear Technology's circuit models.
Select a component from this window and hit OK. Click anywhere on the schematic to place the compo-
nent down, then right click to exit the component placement.To connect together your schematic, hit F3 to start placing wires. All schematics require at least one
ground point, hit 'G' or select Edit > Place GND to place a ground symbol on the schematic. To
edit the component values, right click on any component. Table 1 lists the different ways to enter unit
preixes into the component value window. For example, 1.3333e-4F is the same as 0.13333mF.
Figure 2: The component selection window.
DC
To add a DC voltage source, place down a voltage component and right click on the element. The dialog
box in Figure 3 allows you to specify the DC voltage and any non-ideal series resistance in the supply.
Click Advanced to convert this source into an AC supply, the options and parameters for which are ex-
plained on page 6.
2
7/30/2019 Ltspice Guide for Beginners
3/13
Figure 3: The dialog box for the voltage component, which can be become an AC source, by clicking
Advanced.
LabellingNodes
Every node in your schematic is automatically given a name like 'n001' and 'n002'. Once your circuit
is constructed, and you print out the results of simulation, LTspice will refer to your circuit using these
names. To make life easier for yourself, and anyone else who will look at your schematic, you should
place meaningful labels on all the important nodes in your circuit, as the circuit in Figure 4 has done.
Figure 4: A simple op-amp circuit with the power rails, input voltage and output voltage labelled.
To label a node, hit'F4' or selectEdit > Label Net, give the label a name, and draw a wire from the
node you are marking to the node label. The circuit in Figure 4 has four node labels, one for the input
voltage, output voltage, and two for the positive and negative power rails. Notice how that the op-amp
power connections do not have wires explicitly leading to the voltage sources. By placing a label marker
with the same name on another node, you can create an implicit connection, which is a handy way of
keeping more complex schematics neat and organised.
3
7/30/2019 Ltspice Guide for Beginners
4/13
List of Keyboard Shortcuts
Table 2: The default keyboard shortcuts in LTspice, ranked by their importance.
Action Shortcut
Place Component F2
Draw Wire Mode F3
Place Node Label F4
Delete Mode F5 or Del
Place Ground G
Place Resistor R
Place Capacitor C
Place Inductor L
Rotate Component Ctrl-R
Mirror Component Ctrl-E
Zoom Outwards Ctrl-B
Zoom to Fit Space
Simulation Types
LTspice can perform a number of different simulations on your circuit, simulating over time, different
frequencies, and can even determine how your circuit responds for a range of component values. To
change the simulation settings, right-click anywhere on the schematic and select Edit Simulation
Cmd.. Once you conigure the simulation type you are interested in, hit OK and place the simulation
directive somewhere on the schematic. SPICE directives are covered later in this guide. Right click on
the schematic again and clickRun to simulate the circuit.
DCOperating Point
For DC circuits, the DC operating point simulation is convenient because it will printout every node
voltage and branch current in the entire circuit for you. Figure 5 shows the location of the DC operating
point simulation in the Edit Simulation Command window.
4
7/30/2019 Ltspice Guide for Beginners
5/13
Figure 5: The location of the DC operating point simulation.
Transient Analysis
Transient analysis performs a simulation over a speciied period of time. In the Edit Simulation
Command window, the only necessary option is the time to stop simulating. Choose a suitable simula-
tion time given the frequency of any voltage sources you are using.
ACAnalysis
AC analysis simulates your circuit over a range of input frequencies, by varying the frequency of a nom-
inated sinusoidal voltage source over a speciied range (sweep). AC analysis allows you to see how the
magnitude and phase of voltages and currents change over frequency.
The different kinds of AC sweeps refer to how the datapoints are spaced, a linear sweep takes measure-ments at evenly spaced frequencies between the start and stop frequencies, whilst the decade sweep
uses logarithmically spaced frequencies.
Steady-stateACAnalysis
If you want to investigate the magnitude and phase of circuit voltages and currents at a particular fre-
quency, select AC analysis and use the list sweep. Specify just one frequency in the list, and run the
simulation. You will be shown a text readout with all the magnitudes and phase offsets for the entire
circuit, this kind of simulation is very useful for investigating AC power.
5
7/30/2019 Ltspice Guide for Beginners
6/13
Voltage Source Types
LTspice makes it easy to include a voltage source with any kind of waveform you might require. The two
most useful voltage sources in LTspice are the voltage and bv (arbitrary behavioural) sources. The bv
voltage source accepts an equation input, such as V=5*cos(2*pi*time) + 2 + (2 * time) , allowing you
to directly specify the shape the waveform. The syntax, and available functions for this equation input
are listed in the LTspice documentation, under F1 > LTspice IV > LTspice > Circuit Elements >B, Arbitrary Behavioural...
The voltage component allows you to select between standard functions such as sinusoids and expo-
nentials, and provide parameters individually.
PULSE
The PULSE voltage source is used to model square, triangle and ramp input voltages. The parameters
are shown graphically in Figure 6, and are explained below:
Vinitial[V]
The low or "off" voltage for the signal, it can be negative, zero, or whatever value you need.
Von[V]
The high or "on" voltage for the signal.
Tdelay[s]
The amount of time to wait before the source starts changing. The voltage during this time is
kept atVinitial. Zero by default.
Trise[s]
The time it takes for the signal to rise from Vinitial to Von. If you want to model a square
wave, you should enter a small number in here, like one microsecond.
Tfall[s]
The time it takes for the signal to fall from Von to Vinitial, again you should explicitly set
this to a small number for a square wave.
Ton[s]
The time the signal is kept high, should be less than the period.
Tperiod[s]
The period of the signal, equivalent to the reciprocal of the frequency of the signal.
Ncycles
The number of periods to cycle through before stopping, zero by default.
6
7/30/2019 Ltspice Guide for Beginners
7/13
t
V initial
V on
T delay
T period
T on
T rise T fall
Figure 6: The PULSE voltage source and parameters.
SINE
The SINE voltage source produces a sinusoidal waveform. When performing a frequency sweep, or any
other kind of AC analysis, you need to use the small-signal AC settings indicated in Figure 7. Figure 8
shows the transient simulation waveform with parameters marked.
Figure 7: The location of the small-signal AC settings, used for .AC analysis.
DC Offset[V]
DC voltage / constant term to add onto the signal. Can be negative, and is zero by default.
Amplitude[V]
The peak value of the sinusoidal component of the signal.
7
7/30/2019 Ltspice Guide for Beginners
8/13
Freq[Hz]
The frequency of the signal. If you instead want to specify the angular frequency (say 1
krad/s), you can type an expression between curly braces like so: 1000/(2*pi).
Tdelay[s]
The amount of time to wait before the source switches on. The voltageduring this time is kept
at the DC Offset plus the initial value of the sine wave, which is zero unless Phi is non-zero.Tdelay is zero by default.
Theta[1/s]
If a value for this parameter is speciied, the sinusoid will be multiplied by eThetat, allowing
you to model decaying / increasing sinusoidal functions. Zero by default, which gives you a
regular sinusoid.
Phi[deg]
The phase shift of the signal in degrees.
Ncycles
The number of periods to cycle through before stopping, zero by default.
t
DC offset
T delay
1 / Freq
Amplitude
Figure 8: The SINE voltage source and parameters. Diagram assumes Phi and Theta are both zero.
EXP
The EXP voltage source provides a pulse with edges that exponentially rise and decay.
Vinitial[V]
The low or "off" voltage for the signal, it can be negative, zero, or whatever value you need.
Vpulsed[V]
The high or "on" voltage for the signal.
Rise Delay[s]
The amount of time to wait before the exponential rise begins.
Rise Tau[s]
The time constant associated with the irst edge. If Vpulsed is less than Vinitial, this pa-
rameter still applies to the irst edge, even though the edge is now falling.
8
7/30/2019 Ltspice Guide for Beginners
9/13
Fall Delay[s]
Time to wait before decaying back to Vinitial.
Fall Tau[s]
The time constant associated with the second edge.
t
V initial
V pulsed
Rise Delay
Fall Delay
Rise Tau
Fall Tau
Figure 9: The EXP voltage source and parameters.
PWL
The PWL (Piece-Wise Linear) voltage source can be conigured to output a signal comprised of straight
lines, like that in Figure 10. The parameters for this source are a list of voltages, and the times at whichthey occur. If you require more points, you can click the Additional PWL Point button.
t
value1
value2
value3
value4
time1 time4
value5
Figure 10: The PWL voltage source and the parameters.
9
7/30/2019 Ltspice Guide for Beginners
10/13
WaveformViewer
Once your circuit has been simulated, you can add voltage and current waveforms (called traces) to the
waveform viewer by clicking on nodes and components in the schematic.
Figure 11: An example set of traces in the waveform viewer.
To add a node voltage, click the node in the circuit and the trace will be added to the waveform viewer.
If you need to view any node voltages with respect to a node other than ground, right click on the new
reference node and clickMark Reference. You can now plot voltages using this node as a reference, this
is useful for measuring the voltage across individual components. Mark the ground node as the reference
node again once you are done. Clicking on a component will add the current through that component to
the waveform viewer.
The waveform viewer in LTspice is capable of plotting arbitrary functions of the existing traces. Select
Plot Settings > Add a trace, or press Ctrl-A to add a new trace to the waveform viewer. The
ield at the bottom of this window allows you to enter an expression to plot, such as the product of two
traces: V(input)*I(R1), or a trace scaled: -V(Output)/sqrt(2) . A full list of functions and constants,and allowed expressions you can use in the waveform viewer is available in the LTspice documentation,
under F1 > LTspice IV > Waveform Viewer > Waveform Arithmetic.
TakingMeasurements
Whilst viewing traces in the waveform viewer is useful, we often need speciic values from our simula-
tion. In the case of DC values, hover the mouse over the node and look in the bottom left corner of the
screen, LTspice will print the DC voltage at the node in the bottom status bar.
To measure the average and RMS values of a waveform, control-click the name of the trace of interest, to
bring up the dialog box shown in Figure 12.
10
7/30/2019 Ltspice Guide for Beginners
11/13
Figure 12: The dialog box showing the average value and RMS value of the trace.
To inspect voltage and current values at speciic times in the waveform viewer, click once on the name of
the trace you are interested in, and a cursor will be added to the trace. Cursor may be dragged around,
and the horizontal and vertical positions of the cursors are printed in a dialog box that appears once the
cursor is added.
DotCommands
Dot commands allow you to further conigure and setup your LTspice simulation with component value
sweeps, initial conditions, deine variables and change simulation settings. Only the most common are
covered here, the full list can be found in the LTspice documentation atLTspice IV > LTspice > Dot
Commands. To add a dot command to your circuit, hit'S' or selectEdit > SPICE Directive, type in
your directive, and place it on the schematic.
.IC - Set Initial Conditions
The .ic directive allows initial conditions for transient analysis to be speciied. Initial node voltages and
the initial current through inductors may be speciied.
Syntax: .ic [V()=] [I()=]
Example: .ic V(in)=2 V(out)=5 V(vc)=1.8 I(L1)=300m
The initial voltage of a capacitor can also be speciied by appending I C = X to the capacitance value,
where X is the initial voltage.
Voltage-ControlledSwitches
The voltage-controlled switch SW has four terminals, two switch terminals, and two terminals that, when
a voltage is applied, control whether the switch is open or closed. The switch (pictured in Figure 13)
acts like a short and open circuit by taking on very low and very high resistance values respectively.
The switch is on when a voltage greater than the threshold voltage Vt is applied to the terminals on the
side of switch, and is off otherwise. Table 3 summarises the most important parameters for the voltage
controlled switch.
11
7/30/2019 Ltspice Guide for Beginners
12/13
Table 3: Voltage-controlled switch model parameters.
Name Description Units Default
Vt Threshold voltage [V] 0.
Ron On resistance [W] 1.
Roff Off resistance [W] 1/Gmin
To add a voltage-controlled switch to your circuit, place the component listed as sw, and then use a
.model directive to set the on and off resistances of the switch:
.model SW1 SW(Ron=.1 Roff=1Meg)
Alternatively, you can leave all of the parameters at their default values:
.model SW1 SW()
Figure 13: A voltage-controlled switch with .model directive.
Parameter Sweeps
Performing a parameter sweep will allow you to see how your circuit behaves differently if a component
value, like a resistor or capacitor is adjusted. Plotting a circuit voltage or current while performing a
parameter sweep will display the trace repeated for each case, allowing you to compare the change on
the same plot. To perform a parameter sweep, insert a variable name enclosed in curly braces in the
component value ield you wish to sweep over. For example, if you wanted to simulate your circuit with
a variety of resistance values for a particular resistor, edit the resistor can give it the resistance value
{xx} where xx is a variable name of your choice. Add a .step parameter to the schematic, and follow
the syntax below:.step param
To list a speciic set of values, use instead:
.step param list , , ... For example, to simulate your
circuit for three different resistance values, the .step command would look like the following:
.step param Rf list 500 1000 2000
To select which cases to view in the waveform viewer, right-click the waveform editor window and select
Select Steps.
12
7/30/2019 Ltspice Guide for Beginners
13/13
Mutual Inductance
To couple two or more inductors together, a K directive specifying the inductors and the coupling coef-
icient between them is placed on the schematic.
Syntax: Kxxx L1 L2 [L3 ...]
The xxx, indexes the statement, and is used to tell multiple K directives apart. L1 and L2 are the names
of inductors in the circuit. The mutual coupling coeficient must be in the range of -1 to 1. When play-
ing down inductors, you can indicate the dot on the schematic by right clicking on the component and
checking the Show Phase Dot checkbox.
13