Top Banner
Friday, 21-Sep-2012 06:05:05 EDT Pages created and updated by Terry Sturtevant Date Posted: February 7, 2012 LTspice Tutorial While LTspice is a Windows program, it runs on Linux under Wine as well. (LTspice is also called SwitcherCAD by its manufacturer, since they use it primarily for the design of switch mode power supplies (SMPS).) Note: Some of this was written using SwitcherCad III, and some was written using LTspice IV. The instructions should be the same. Opening LTspice I. Drawing the circuit Making Sure You Have a GND A. Getting the Parts B. Placing the Parts C. Connecting the Circuit D. Changing the Name of the Part E. Changing the Value of the Part F. Using Net Labels G. Adding your own SPICE Models or Subcircuits H. Saving I. Printing J. II. Simulation Before you do the simulation A. Choosing a simulation B. Graphing C. Adding/Deleting Traces D. Doing Math E. Labeling F. Finding Points (aka Using Cursors) G. Saving H. Printing I. III. Simulation Commands DC operating point A. Transient B. AC Analysis C. DC Sweep D. Noise E. Parametric F. Temperature G. Other types of analysis H. IV. Types of Sources Voltage Sources DC 1. A. V. LTspice Tutorial http://denethor.wlu.ca/ltspice/ 1 of 46 9/21/2012 3:39 PM
46

LTspice Tutorial

Oct 28, 2014

Download

Documents

vlsijp

LTspice Tutorial
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: LTspice Tutorial

Friday, 21-Sep-2012 06:05:05 EDT

Pages created and updated by Terry Sturtevant Date Posted: February 7, 2012

LTspice Tutorial

While LTspice is a Windows program, it runs on Linux under Wine as well. (LTspice is also called

SwitcherCAD by its manufacturer, since they use it primarily for the design of switch mode power supplies

(SMPS).)

Note: Some of this was written using SwitcherCad III, and some was written using LTspice IV.

The instructions should be the same.

Opening LTspiceI.

Drawing the circuitMaking Sure You Have a GNDA.Getting the PartsB.Placing the PartsC.Connecting the CircuitD.Changing the Name of the PartE.Changing the Value of the PartF.Using Net LabelsG.Adding your own SPICE Models or SubcircuitsH.SavingI.PrintingJ.

II.

SimulationBefore you do the simulationA.Choosing a simulationB.GraphingC.Adding/Deleting TracesD.Doing MathE.LabelingF.Finding Points (aka Using Cursors)G.SavingH.PrintingI.

III.

Simulation CommandsDC operating pointA.TransientB.AC AnalysisC.DC SweepD.NoiseE.ParametricF.TemperatureG.Other types of analysisH.

IV.

Types of SourcesVoltage Sources

DC1.A.

V.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

1 of 46 9/21/2012 3:39 PM

Page 2: LTspice Tutorial

PULSE2.SINE3.EXP4.SFFM5.PWL6.PWL File7.

Current SourcesB.

References and LinksVI.

Opening LTspice:Find LTspice on the C-Drive. Open LTspice IV (or SWCad III). The opening screen willlook like this:

I.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

2 of 46 9/21/2012 3:39 PM

Page 3: LTspice Tutorial

.Begin a new circuit

from the file menu, or

LTspice Tutorial http://denethor.wlu.ca/ltspice/

3 of 46 9/21/2012 3:39 PM

Page 4: LTspice Tutorial

click on the "New Schematic" icon. Now you will see this:

.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

4 of 46 9/21/2012 3:39 PM

Page 5: LTspice Tutorial

Drawing the circuit:Adding a GND: This is very important. You cannot do any simulation on thecircuit if you don't have a ground. To place a ground, you can

press the 'g' key, or

use the ground icon, , orget it from the 'Edit' menu.

If you aren't sure where to put it, place it near the bottom of the drawing.

A.

Getting the other Parts:The next thing that you have to do is get some or all of the parts you need.This can be done by

clicking on the icon for a specific component;

(This is good for common components such as resistors, capacitors, etc.)

clicking on the 'component' button; , orpressing "F2"; orgoing to "Edit" and selecting "Component..."

Once this box is open, select a part that you want in your circuit. This can bedone by typing in the name or scrolling down the list until you find it.

Some common parts are:res - resistorcap - capacitorind - inductordiode - diodevoltage - any kind of power supply or battery

Anything in [ ] is a library, which contains many parts.To rotate parts so that they will fit in your circuit nicely, press "Ctrl+R" before

B.

II.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

5 of 46 9/21/2012 3:39 PM

Page 6: LTspice Tutorial

placing the part. If you want to reflect (or 'Mirror') the part, press "Ctrl+E".Upon selecting your parts, click where you want them placed (somewhere on thegrey page with the dots). Don't worry about putting it in exactly the right place,it can always be moved later.Each type of part can be placed multiple times in succession, and they will beautomatically numbered. when you want to stop placing a particular type ofpart, right-click or press 'Esc'.

Placing the Parts:You should have most of the parts that you need at this point.Now, all you do is put them in the places that make the most sense (usually arectangle works well for simple circuits). To move parts, click on the 'move' icon,

and then you may select parts and drag them where you want them.(When you have a part selected for a move, you can rotate or reflect it as well.)If you have any parts left over, just select them and press "Delete".

C.

Connecting the Circuit:Now that your parts are arranged well, you'll have to attach them with wires.Go up to the tool bar and

select the "Draw Wire" button , or"F3" orgo to "Edit" and select "Draw Wire".

With the pencil looking pointer, click on one end of a part, when you move yourmouse around, you should see crossed lines appear. Attach the other end of yourwire to the next part in the circuit.Repeat this until your circuit is completely wired.If you want to make a node (to make a wire go more then one place), clicksomewhere on the wire and then click to the part (or the other wire). Or you cango from the part to the wire. You should see a square block when 3 or morewires connect at a point.Holding down CTRL while drawing lines allows you to make diagonal connectionsin the editor.To get rid of the pencil, right click.Mousing over a component allows you to edit its properties. Note the statusbar in the lower left.

D.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

6 of 46 9/21/2012 3:39 PM

Page 7: LTspice Tutorial

The value of a component is one thing which can be edited.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

7 of 46 9/21/2012 3:39 PM

Page 8: LTspice Tutorial

Changing the Name of the Part:You probably don't want to keep the names C1, C2 etc., especially if you didn'tput the parts in the most logical order. To change the name, right click on thepresent name (C1, or R1 or whatever your part is), then a box will pop up (EnterNew Reference Designator), where you can type in the name you want the partto have.

Please note that if you double click on the part or its value, no box will appear.

E.

Changing the Value of the Part:If you only want to change the value of the part (if you don't want all yourresistors to be 1K ohms), you can right click on the part, (not the name), and abox title by the part name (such as "Resistor") will appear. The number of fieldsin the box will depend on the type of part it is. Type in the new value and pressOK. Use u for micro as in uF = microFarad.

F.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

8 of 46 9/21/2012 3:39 PM

Page 9: LTspice Tutorial

Using Net Labels:These are important if you want to user your own identifiers for points in thenetwork where you want to determine voltages rather than having to work withthe node numbers that LTspice assigns.To add net labels,

press "F4", or

click on the "Label Net" icon , orselect "Edit/Label Net" from the menu.

When you do this, a window will pop up where you assign the label you want touse for the net.

G.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

9 of 46 9/21/2012 3:39 PM

Page 10: LTspice Tutorial

Adding your own SPICE Models or Subcircuits

How to add a model to LTspice (SwitcherCad)

This assumes you want to add a new model for a new device similar to one in theexisting library. Here are three different methods.

Method 1: Modifiy Libraries

This method makes sense if you are working on your own computer, where you canupdate your own libraries and use them again.

Look under C:\Program Files\LTC\LTspiceIV(or C:\Program Files\LTC\SwCADIII )

1.

Go to the directory lib\cmp2.Look at the list of standard devices to figure out which kind you want, such as:

standard.bjtstandard.diostandard.jft...etc...

Each line in each of these files has a model for one device.

3.

Add a line with the .model line for your device to the end of the appropriate fileusing a text editor.Note you may have to adapt the model line to match the pattern in thefile. It should be pretty easy to figure out.

4.

Now when you open LTSpice, you should be able to pick the device you've added asthough it was one of the existing models.

Method 2: Using an external library file

This will work well if you are using a computer where you can't edit the built-in libraryfiles, or where edits will not be saved, but where you may have several models in onefile which you would like to be able to use in the future.

Save the file which contains the model you want to use in a directory where youhave write access. (For example, I use c:\windows\temp.)

1.

Insert a SPICE directive from the edit menu,2.

H.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

10 of 46 9/21/2012 3:39 PM

Page 11: LTspice Tutorial

by using the icon, or by typing 'S'.In the text box, type.lib path to your library fileso, for example.lib c:\windows\temp\myfile.sp3Change the name of the component in your schematic to match the exact nameof the model in the library file.

3.

Now when you simulate, your new device model should be used.Note: you can use the .include directive instead of the .lib directive if you wish.

Method 3: Inserting the model directly into the drawing

This will work well if you are using a computer where you can't edit the built-in libraryfiles, or where edits will not be saved, and that there is only a single model you wantto use.

Open file which contains the model you want to use, and copy the model intothe clipboard.

1.

Insert a SPICE directive from the edit menu, by using the icon, or by typing 'S'.In the text box, paste the model from the clipboard.

2.

Change the name of the component in your schematic to match the exact nameof the model in the model line.

3.

Now when you simulate, your new device model should be used.Note: Because you now have the model saved as part of your schematic, this iscompletely portable between computers.

How to add a subcircuit model to LTspice

LTspice Tutorial http://denethor.wlu.ca/ltspice/

11 of 46 9/21/2012 3:39 PM

Page 12: LTspice Tutorial

(SwitcherCad)Sometimes you need to add something which is more complicated than simply amodel.In this case you can add add a subcircuit model for a device. You'll save a bit of timeif the new device at least looks similar to one in the existing library. Otherwise youmay have to draw a new symbol. (Suppose the file that contains the model you wantto use is called 1N5338B.LIB and the model you want to use is a subcircuit called1N5338B.)

Method 1: Modifiy Libraries

This method makes sense if you are working on your own computer, where you canupdate your own libraries and use them again.

Look under C:\Program Files\LTC\LTspiceIV(or C:\Program Files\LTC\SwCADIII )

1.

Put the file 1N5338B.LIB in the subdirectory lib\sub .2.Go to the directory lib\sym3.Find a component similar to what you want. That way you won't have to drawthe symbol from scratch. For instance, if I were adding a new zener diode, I seethere's a component zener.asy.

4.

Copy zener.asy to 1N5338B.asy. (1N5338B will be the name of the newzener diode model I want to use.)

5.

Open 1N5338B.asy in a text editor, and make the following changes:change SYMATTR Prefix D to SYMATTR Prefix X(This says that the model we're using is a .subckt.)change SYMATTR Value D to SYMATTR Value 1N5338B(This says that the name that will show up on the schematic is 1N5338B.)add a line SYMATTR ModelFile 1N5338B.LIB(This says that the name of the file containing the subcircuit we're using is1N5338B.LIB.)add a line SYMATTR SpiceModel 1N5338B(This says that the name of the subcircuit we're using is 1N5338B. Youcan see this by looking at the first line of the file:.SUBCKT 1n5338b 2 1This tells the name of the subcircuit and that it has two pins.)

6.

Now when you open LTSpice, you should be able to find the component you haveadded, and use it like any of the ones that are built-in .

Method 2 and Method 3: Setup

This same procedure applies to both methods. These methods will be useful whereyou can't edit the library files. This might happen if you are working on computers inpublic labs, for instance.

Hold down CTRL-M while right-clicking on the component to bring up thedialog.

1.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

12 of 46 9/21/2012 3:39 PM

Page 13: LTspice Tutorial

Change the prefix of the device to "X" to indicate you are using a subcircuit,and edit the value of the device to match the subcircuit name exactly.

2.

After these steps, go on to either Method 2 or Method 3.

Method 2: Using an external library file

This will work well if you are using a computer where you can't edit the built-in libraryfiles, or where edits will not be saved, but where you may have several models in onefile which you would like to be able to use in the future.

Save the file which contains the subcircuit you want to use in a directory whereyou have write access. (For example, I use c:\windows\temp.)

1.

Insert a SPICE directive from the edit menu,2.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

13 of 46 9/21/2012 3:39 PM

Page 14: LTspice Tutorial

by using the icon, or by typing 'S'.In the text box, type.lib path to your library fileso, for example.lib c:\windows\temp\myfile.sp3

Method 3: Inserting the model directly into the drawing

This will work well if you are using a computer where you can't edit the built-in libraryfiles, or where edits will not be saved, and that there is only a single model you wantto use.

Open file which contains the subcircuit you want to use, and copy the subcircuitinto the clipboard.

1.

Insert a SPICE directive from the edit menu, by using the icon, or by typing 'S'.In the text box, paste the subcircuit from the clipboard.

2.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

14 of 46 9/21/2012 3:39 PM

Page 15: LTspice Tutorial

The subbcircuit itself may include model definitions, so you may have to includeseveral lines when you copy. If the library file is only for that one device, thenyou'll want to copy and paste the entire file contents.

Saving:

To save the circuit, use the save button on the tool bar or any other methodyou would normally use to save files.

I.

Printing:

To print, you may use the menu or the print icon as usual.

J.

Simulation:Before you do the simulation:

You have to have your circuit properly drawn and saved.A.

III.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

15 of 46 9/21/2012 3:39 PM

Page 16: LTspice Tutorial

There must not be any floating parts on your page (i.e. unattached devices).You should make sure that all parts have the values that you want.There are no extra wires.It is essential that you have a ground in your circuit.

Choosing a simulation:

Click on the Simulate button on the tool bar or use the "Simulate/EditSimulation Cmd" command.

Enable whatever type(s) of analysis you want using the Edit SimulationCommand window. The last one you choose is the one which will be done whenyou simulate.

Click on the Simulate button on the tool bar or use the "Simulate/Run"command.It will check to make sure you don't have any errors. If you do have errors,correct them.

B.

Graphing:Go to the "View" menu:

C.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

16 of 46 9/21/2012 3:39 PM

Page 17: LTspice Tutorial

Adding/Deleting Traces:

Use "Visible Traces" or on the toolbar to select all the traces you want.The add traces window allows you to choose various signals from the circuit, orto create mathematical expressions involving them.

To delete a trace, select its title on the graph and press "Delete".

D.

Doing Math:In Visible Traces, there are functions that can be performed, these willadd/subtract (or whatever you chose) the lines together.

E.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

17 of 46 9/21/2012 3:39 PM

Page 18: LTspice Tutorial

Select the signal(s) that you wish to have displayed.There are many functions here that may or may not be useful. If you want toknow how to use them, you can use LTspice's Help Menu.

Labeling:

Click on Text Label on top tool bar.Type in what you want to write.Click OKYou can move this around by single clicking and dragging.

F.

Finding Points: (aka Using Cursors)Click on the name of the trace you want to look at and then a cursor window willappear, showing information about the point currently selected.

.Note that if you right click on the trace name, you can choose to show twocursors. This then allows automatic math to be done, such as to give thedifference between them in both dimensions.You can use the cursor keys to move back and forth through the data points.

G.

Saving:To save your probe you need to go into the tools menu and click display, this willopen up a menu which will allow you to name the probe file and choose where to

H.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

18 of 46 9/21/2012 3:39 PM

Page 19: LTspice Tutorial

save it. You can also open previously saved plots from here as well.Printing:

Select Print in Edit or on the toolbar .Print as usual.

I.

Simulation CommandsDC Operating Point

This is a simple, but incredibly useful analysis. It will not give you anything toplot, but it will indicate the DC voltages at all nodes and DC currents through alldevices in the circuit.

A.IV.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

19 of 46 9/21/2012 3:39 PM

Page 20: LTspice Tutorial

The output of the simulation is a very simple text file.

After a simulation has been performed, mousing over any wire in the circuit willshow what node it belongs to in the status bar. (See the lower left corner of thescreen.)

LTspice Tutorial http://denethor.wlu.ca/ltspice/

20 of 46 9/21/2012 3:39 PM

Page 21: LTspice Tutorial

After a simulation has been performed, mousing over a component showsparameters like current and power in the status bar.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

21 of 46 9/21/2012 3:39 PM

Page 22: LTspice Tutorial

Note the sign of the current and power from the source.

You can view the netlist from the menu.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

22 of 46 9/21/2012 3:39 PM

Page 23: LTspice Tutorial

The netlist allows you to see the node numbers for each device, among otherthings.

Transient

When doing a transient analysis of a source, the sections highlighted below in thesource configuration window are relevant.

B.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

23 of 46 9/21/2012 3:39 PM

Page 24: LTspice Tutorial

Here's the simulation command window:

The transient analysis is probably the most important analysis you can run inLTspice, and it computes various values of your circuit over time. Two veryimportant parameters in the transient analysis are:

Stop Time.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

24 of 46 9/21/2012 3:39 PM

Page 25: LTspice Tutorial

Time to Start Saving DataMaximum Timestep(various checkboxes....later)

The ratio of Stop Time: Maximum Timestep determines how manycalculations LTspice must make to plot a wave form. LTspice always defaults thestart time to zero seconds and going until it reaches the user defined final time.It is incredibly important that you think about what timestep you should usebefore running the simulation, if you make the timestep too small the probescreen will be cluttered with unnecessary points making it hard to read, andtaking extreme amounts of time for LTspice to calculate. However, at theopposite side of that coin is the problem that if you set the timestep too highyou might miss important phenomenon that are occurring over very shortperiods of time in the circuit. Therefore play with step time to see what worksbest for your circuit.

You can set a step ceiling which will limit the size of each interval, thusincreasing calculation speed. Another handy feature is the Fourier analysis,which allows you to specify your fundamental frequency and the number ofharmonics you wish to see on the plot. LTspice defaults to the 9th harmonicunless you specify otherwise, but this still will allow you to decompose a squarewave to see it's components with sufficient detail.

You can look at the signal at any node.

Note the status bar shows more information.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

25 of 46 9/21/2012 3:39 PM

Page 26: LTspice Tutorial

The output shows up like this..

You can delete or modify any signal.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

26 of 46 9/21/2012 3:39 PM

Page 27: LTspice Tutorial

The dialog allows various changes.

Note the status bar shows more information.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

27 of 46 9/21/2012 3:39 PM

Page 28: LTspice Tutorial

You can look at the current through any device.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

28 of 46 9/21/2012 3:39 PM

Page 29: LTspice Tutorial

Note the status bar shows more information.

The output shows up like this..

You can also look at the current through any wire. Remember you get thevoltage by mousing over any point in a node, (such as along a wire).

LTspice Tutorial http://denethor.wlu.ca/ltspice/

29 of 46 9/21/2012 3:39 PM

Page 30: LTspice Tutorial

Now, if while mousing over it you hold down the ALT key, you'll see the currentpointer and the status bar indicates you can click to plot the wire current.

You can also look at the power dissipation in any device. Remember you get thecurrent by mousing over any device.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

30 of 46 9/21/2012 3:39 PM

Page 31: LTspice Tutorial

Now, if while mousing over it you hold down the ALT key, you'll see the powerpointer, (a thermometer), and the status bar will show you can plot the devicepower dissipation.

AC Analysis

When doing an AC sweep of a source, the sections highlighted below in the sourceconfiguration window are relevant.Note: In an AC sweep, all AC sources are treated as sine waves.

C.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

31 of 46 9/21/2012 3:39 PM

Page 32: LTspice Tutorial

Here's the simulation command window:

The AC analysis allows you to plot magnitude and/or phase versus frequency fordifferent inputs in your circuit.

Type of SweepIn the AC analysis menu you have the choice of three types of analysis:

LTspice Tutorial http://denethor.wlu.ca/ltspice/

32 of 46 9/21/2012 3:39 PM

Page 33: LTspice Tutorial

Linear,Octave andDecade.

These three choices describe the X-axis scaling which will be produced in probe.For example, if you choose decade then a sample of your X-axis might be 10Hz,1kHz, 100kHz, 10MHz, etc.... Therefore if you want to see how your circuitreacts over a very large range of frequencies choose the decade option.

You now have to specify at how many points you want LTspice to calculatefrequencies, and what the start and end frequency will be. That is, over whatrange of frequencies do you want to simulate your circuit.

Number of pointsStart FrequencyStop Frequency

DC Sweep

The DC sweep allows you to do various different sweeps of your circuit to seehow it responds to various conditions.For all the possible sweeps,

voltage,current

you need to specify a start value, an end value, and the number of points youwish to calculate.For example you can sweep your circuit over a voltage range from 0 to 12 volts.The main two sweeps that will be most important to us at this stage are thevoltage sweep and the current sweep. For these two, you need to indicate toLTspice what component you wish to sweep, for example V1 or V2.

Another excellent feature of the DC sweep in LTspice, is the ability to do anested sweep.A nested sweep allows you to run two simultaneous sweeps to see how changesin two different DC sources will affect your circuit.Once you've filled in the main sweep menu, click on the nested sweep button

D.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

33 of 46 9/21/2012 3:39 PM

Page 34: LTspice Tutorial

and choose the second type of source to sweep and name it, also specifying thestart and end values. (Note: In some versions of LTspice you need to click onenable nested sweep). Again you can choose Linear, Octave or Decade, butalso you can indicate your own list of values, example: 1V 10V 20V. DO NOTseparate the values with commas.

Noise

LTspice will simulate noise for you either on the output or the input of the circuit.These noise calculations are performed at each frequency step and can beplotted in probe.The two types of noise are:

Output for noise on the outputs andInput for noise on the input source.Type of Sweep (same as for AC analysis)Number of points... (same as for AC analysis)Start Frequency (same as for AC analysis)Stop Frequency (same as for AC analysis)

To use input noise you need to tell LTspice where you consider the 'input' in yourcircuit to be, for example, if your voltage source is labeled 'V1'.

E.

DC TransferF.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

34 of 46 9/21/2012 3:39 PM

Page 35: LTspice Tutorial

ParametricParametric analysis allows you to run another type of analysis (DC operatingpoint, transient, sweeps) while using a range of component values. The bestway to demonstrate this is with an example, we will use a resistor, but any otherstandard part would work just as well (capacitor, inductor).

First, right click the value resistor that is to be varied. This will open a dialog boxallowing you to set "Resistor Properties". Enter the name R (including thecurly braces) in place of the component value.

This indicates to LTspice that the value of the resistor is a global parametercalled R.Now add a spice directive to the page, by pressing the 's' key, using the icon

or the menu command

G.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

35 of 46 9/21/2012 3:39 PM

Page 36: LTspice Tutorial

Place the box anywhere on the schematic page.Edit the directive.

Directives always start with a period..STEP PARAM R 1k 10k 0.1k means to step the parameter R from 1kΩ to 10kΩin steps of 0.1kΩ for every step of the outer simulation.You'll need to have one simulation command, even if it's a DC operating pointanalysis.Choose an analysis as usual, and run the simulation.If your did a non-graphical analysis, such as a DC operating point, then you'llget a graphical output which has the stepped parameter as the horizontal axis.If you did an analysis that is already graphical, such as transient, you'll get agraph with a series of lines, one for each value of the stepped parameter. Inorder to isolate one trace,

LTspice Tutorial http://denethor.wlu.ca/ltspice/

36 of 46 9/21/2012 3:39 PM

Page 37: LTspice Tutorial

use the command to "Select Steps" from the trace menu. This brings up a dialog

which allows you to choose which one(s) you want to show.Temperature

To do a temperature sweep, do a parametric analysis but instead of varying acomponent value, vary the temperature as follows:.STEP TEMP 0 100 1 means to step the temperature from 0°C to 100°C insteps of 1°C for every step of the outer simulation.

H.

Other types of analysis There are other SPICE analyses possible. Eventually I mightget them in here, including

fourier

I.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

37 of 46 9/21/2012 3:39 PM

Page 38: LTspice Tutorial

Types of SourcesVoltage Sources A voltage source can be configured in many possible ways. Rightclicking on one will bring up the "Independent Voltage Source" window. The optionswhich show up in the window will change as the function selected changes.

(none)

This is your basic direct current voltage source that simulates a simplebattery and allows you to specify the DC voltage value.

1.

PULSE2.

A.V.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

38 of 46 9/21/2012 3:39 PM

Page 39: LTspice Tutorial

PULSE is often used for a transient simulation of a circuit where we want tomake it act like a square wave source. It should never be used in afrequency response study because LTspice assumes it is in the timedomain, and therefore your probe plot will give you inaccurate results.

Vinitial is the value when the pulse is not "on." So for a square wave,

the value when the wave is 'low'. This can be zero or negative asrequired. For a pulsed current source, the units would be "amps"instead of "volts."Von is the value when the pulse is fully turned 'on'. This can also be

zero or negative. (Obviously, V1 and V2 should not be equal.) Again,

the units would be "amps" if this were a current pulse.Tdelay is the time delay. The default units are seconds. The time

delay may be zero, but not negative.Trise is the rise time of the pulse. LTspice allows this value to be zero,

but zero rise time may cause convergence problems in some transientanalysis simulations. The default units are seconds.Tfall is the fall time in seconds of the pulse.

Ton is the pulse width. This is the time in seconds that the pulse is

fully on.Tperiod is the period and is the total time in seconds of the pulse.

Ncycles is the number of cycles of the pulse that should happen.

Leave it as zero if you want ongoing pulses.This is a very important source for us because we do a lot of work with thesquare wave on the wave generator to see how various components andcircuits respond to it.

SINE3.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

39 of 46 9/21/2012 3:39 PM

Page 40: LTspice Tutorial

A few things to note about the alternating current source. First, there aretwo possible analyses which can be done and so there are two sets ofparameters.For an ac analysis, the parameters are:

AC Amplitude which is the peak value of the voltage.AC Phase which is the phase angle of the voltage

For a transient analysis, the parameters are:DC offset is the DC offset voltage. It should be set to zero if youneed a pure sinusoid.Amplitude is the undamped amplitude of the sinusoid; i.e., the peakvalue measured from zero no DC offset value.Freq is the frequency in Hz of the sinusoid.Tdelay is the time delay in seconds. Set this to zero for the normal

sinusoid.Theta is the damping factor. (Not the phase angle!) Also set thisto zero for the normal sinusoid.This is used to apply an exponential decay to the sinusoid; theta isthe decay constant in 1/seconds.PHI is the phase advance in degrees. Set this to 90 if you need acosine wave form.Ncycles is the number of cycles of the pulse that should happen.

Leave it as zero if you want ongoing pulses.For this analysis, LTspice takes it to be a sine source, so if you want tosimulate a cosine wave you need to add (or subtract) a 90° phase shift.Note that the phase angle if left unspecified will be set by default to 0°

EXP4.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

40 of 46 9/21/2012 3:39 PM

Page 41: LTspice Tutorial

The EXP type of source is an exponential voltage, illustrated here:

Vinitial the starting voltage, V1

LTspice Tutorial http://denethor.wlu.ca/ltspice/

41 of 46 9/21/2012 3:39 PM

Page 42: LTspice Tutorial

Vpulsed the maximum voltage, V2Rise Delay the time to wait at the starting voltage before changing,Td1Rise Tau the time constant for the change, Tau1Fall Delay the time to wait at the maximum voltage beforechanging, Td2Fall Tau the time constant for the change back to the startingvoltage, Tau2

SFFM

The SFFM (Single Frequency FM) type of source has these parameters:DC offset the DC component of the sine waveAmplitude the AC value of the sine waveCarrier Freq is the carrier frequency.Modulation Index is the modulation index.Signal Freq is the signal frequency.

5.

PWL (Piece-Wise Linear)6.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

42 of 46 9/21/2012 3:39 PM

Page 43: LTspice Tutorial

The PWL source is a Piece Wise Linear function that you can use to create awave form consisting of straight line segments drawn by linearinterpolation between points that you define. Since you can use as manypoints as you want, you can create a very complex wave form This sourcetype can be a voltage source or a current source.The syntax for this source type is flexible and has several optionalparameters. The required parameters are two-dimensional points consistingof a time value and a voltage (or current) value. There can be many ofthese data pairs, but the time values must be in ascending order, and theintervals between time values need not be regular.

PWL File7.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

43 of 46 9/21/2012 3:39 PM

Page 44: LTspice Tutorial

The PWL File source reads a file for Piece Wise Linear function parameters.

Current SourcesFor each of the previous discussed voltage sources, there exists the exact samesource except that it produces current. There is one thing that should bementioned; current sources in LTspice get a little confusing. For those currentsources whose circuit symbol has an arrow, you have to point the arrow in thedirection of conventionally flowing current. This applies to all current sources,including AC and DC. Therefore placing the current source in the circuitbackwards with seemingly incorrect polarities will give the correct results.An interesting little feature under the markers menu is the ability to addmarkers to your circuit so you can see where the current and voltage haveimaginary values in the circuit, and the phase of your source at any point in thecircuit.

B.

References and LinksIntroduction to SwitcherCAD (another name for LTspice) [PDF; Petr Kropik]This has a good step-by-step guide, including information about files and SPICEdirectives.

A.

LTSpice introductory manual (adding components) [PDF; Aalborg University, October2005]This has useful information about how to add libraries and models.

B.

SPICE overview (lots of detail) [University of Pennsylvania]Since this is about SPICE itself, rather than any particular version, such as PSpice orLTspice, the information is very widely applicable.

C.

SWCADIII (Another LTspice tutorial) (very detailed) [PDF; Aalborg University]This starts off with a lot about Switch Mode Power Supplies, i.e. what LinearTechnology designed it for, but gets into lots of other stuff as well. (It's 257 pages

D.

VI.

LTspice Tutorial http://denethor.wlu.ca/ltspice/

44 of 46 9/21/2012 3:39 PM

Page 45: LTspice Tutorial

long, so there really is a lot of stuff there.Intro to LTspice (lots of screen shots) [PDF; South Dakota School of Mines andTechnology]Shorter than some of the others, but lots of screen shots

E.

Other kinds of analysis (blog) [ Chris Cross]This includes an example of varying temperature for an analysis.

F.

Other kinds of analysis (blog) [ Chris Cross]This includes an example of using WAV files for input and output of simulations.

G.

Diagonal symbols (for common components; resistor, capacitor, inductor, didode)I think that sometimes it would be nice to be able to draw things like bridge circuits inthe way they're normally shown, rather than with all components either horizontal orvertical, so I created diagonal versions of the basic components.(Holding down CTRL while drawing lines allows you to make diagonal connections inthe editor.)

H.

McGraw-Hill tutorial that includes a PowerPoint presentation and lots of circuit files.I.For the more obscure questions you might have go right to the source at LinearTechnology©http://www.linear.com/designtools/software/switchercad.jsp

J.

There's a Yahoo! group which is quite active with discussions, examples etc.http://tech.groups.yahoo.com/group/LTspice/

K.

**Most of the pictures and screen shots came from Linear Technology© LTspice version 4.08o

Not related to LTspice specifically, but there is a tutorial on using LaTeX to typeset technical documents at

http://denethor.wlu.ca/latex

If you need to download Adobe Acrobat Reader go here If you need to update a browser, you might try

Firefox which is

freeopen sourceavailable for several platforms

Since this page uses cascading style sheets for its layout, it will look best with a browser which supports

the specifications as fully as possible.

Information on this site which is produced by Terry Sturtevant is licensed under a

Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.

Disclaimer

Return to Top of Page

LTspice Tutorial http://denethor.wlu.ca/ltspice/

45 of 46 9/21/2012 3:39 PM

Page 46: LTspice Tutorial

contact WLU site index disclaimer privacy office © 2012 Wilfrid Laurier University

Laurier Brantford

Wilfrid Laurier University 75 University Avenue West, Waterloo, Ontario, Canada N2L

3C5

phone: (519) 884-1970

LTspice Tutorial http://denethor.wlu.ca/ltspice/

46 of 46 9/21/2012 3:39 PM