LTSpice Tutorial

While LTSpice is a Windows program, it runs on Linux under Wine as well.
  1. Opening LTSpice

  2. Drawing the circuit

    1. Making Sure You Have a GND
    2. Getting the Parts
    3. Placing the Parts
    4. Connecting the Circuit
    5. Changing the Name of the Part
    6. Changing the Value of the Part
    7. Using Net Labels
    8. Saving
    9. Printing
  3. Simulation

    1. Before you do the simulation
    2. Choosing a simulation
    3. Graphing
    4. Adding/Deleting Traces
    5. Doing Math
    6. Labelling
    7. Finding Points
    8. Saving
    9. Printing
  4. Simulation Commands

    1. Transient
    2. AC Analysis
    3. DC Sweep
    4. Noise
    5. DC Transfer
    6. DC operating point
    7. Other types of analysis
  5. Types of Sources

    1. Voltage Sources
      1. DC
      2. PULSE
      3. SINE
      4. EXP
      5. SFFM
      6. PWL
      7. PWL File
    2. Current Sources
  6. Digital Simulation

  7. References and Links


  1. Opening LTSpice:
    • Find LTSpice on the C-Drive. Open SWCad III. The opening screen will look like this:
      schematic icon .
    • Begin a new circuit from the file menu, or click on the "New Scematic" icon. new schematic icon
      Now you will see this:
      new drawing screen .

  2. Drawing the circuit:
    1. Adding a GND:
      • This is very important. You cannot do any simulation on the circuit if you don't have a ground. To place a ground, you can press the 'g' key, or use the ground icon, ground icon,
        or get it from the 'Edit' menu. If you aren't sure where to put it, place it near the bottom of the drawing.
    2. 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;
          get component icon
          (This is good for common components such as resistors, capacitors, etc.)
        • clicking on the 'component' button; get component icon, or
        • pressing "F2"; or
        • going to "Edit" and selecting "Component..."
      • Once this box is open, select a part that you want in your circuit. This can be done by typing in the name or scrolling down the list until you find it.
        part browser window
      • Some common parts are:
        • res - resistor
        • cap - capacitor
        • ind - inductor
        • diode - diode
        • voltage - 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 you circuit nicely, press "Ctrl+R" before 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 the grey 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 be automatically numbered. when you want to stop placing a particular type of part, right-click or press 'Esc'.
    3. 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 a rectangle works well for simple circuits). To move parts, click on the 'move' icon, 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".
    4. 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   draw wire icon , or
        • "F3" or
        • go to "Edit" and select "Draw Wire".
      • With the pencil looking pointer, click on one end of a part, when you move your mouse around, you should see crossed lines appear. Attach the other end of your wire 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), click somewhere on the wire and then click to the part (or the other wire). Or you can go from the part to the wire. You should see a square block when 3 or more wires connect at a point.
      • To get rid of the pencil, right click.
    5. Changing the Name of the Part:
      • You probably don't want to keep the names C1, C2 etc., especially if you didn't put the parts in the most logical order. To change the name, right click on the present name (C1, or R1 or whatever your part is), then a box will pop up (Enter New Reference Designator), where you can type in the name you want the part to have.

        enter new reference window
      • Please note that if you double click on the part or its value, no box will appear.
    6. Changing the Value of the Part:
      • If you only want to change the value of the part (if you don't want all your resistors to be 1K ohms), you can right click on the part, (not the name), and a box title by the part name (such as "Resistor") will appear. The number of fields in the box will depend on the type of part it is. Type in the new value and press OK. Use u for micro as in uF = microFarad.

        set part value window
    7. Using Net Labels:
      • These are important if you want to user your own identifiers for points in the network rather than having to work with the node numbers that LTSpice assigns.
      • To add net labels, press "F4", or click on the "Label Net" icon net label icon, or select "Edit/Label Net" from the menu.
        When you do this, a window will pop up where you assign the label you want to use for the net.
        net label window
    8. Saving:
      • To save the circuit, click on the save button save button 
icon on the tool bar (or any other way you normally save files).
    9. Printing:
      • To print, you may use the menu or the print icon print icon as usual.

  3. Simulation:
    1. Before you do the simulation:
      • You have to have your circuit properly drawn and saved.
      • 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 on your circuit.
    2. Choosing a simulation:
      • Click on the Simulate button on the tool bar simulate 
icon or use the "Simulate/Edit Simulation Menu" command.
        simulate menu
      • Enable whatever type(s) of anlysis you want using the Edit Simulation Command window. The last one you choose is the one which will be done when you simulate.
      • Click on the Simulate button on the tool bar simulate 
icon 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.
      • Then a new window will pop up. Here is where you can do your graphs.
    3. Graphing:
      • If you don't have any errors, you should get a window with a black background to pop up (even with errors, it will be LTSpice A/D Demo).
      • If you did have errors, in the bottom, left hand side, it will say what your errors were (these may be difficult to understand, so go To "View - Output File").
    4. Adding/Deleting Traces:
      • LTSpice will automatically put some traces in. You will probably want to change them.
      • Go to Trace - Add Trace or add trace icon on the toolbar. Then select all the traces you want.
      • To delete traces, select them on the bottom of the graph and push Delete.
    5. Doing Math:
      • In Add Traces, there are functions that can be performed, these will add/subtract (or whatever you chose) the lines together. add traces window
      • Select the first output then either on your keyboard or on the right side, click the function that you wish to perform.
      • There are many functions here that may or may not be useful. If you want to know how to use them, you can use LTSpice's Help Menu.
      • It is interesting to note that you can plot the phase of a value by using IP(xx), where xx is the name of the source you wish to see the phase for.
    6. Labelling:
      • Click on Text Label text label icon on top tool bar.
      • Type in what you want to write.
      • Click OK
      • You can move this around by single clicking and dragging.
    7. Finding Points:
      • There are Cursor buttons that allow you to find the maximum or minimum or just a point on the line. These are located on the toolbar (to the right).
      • Select which curve you want to look at and then select "Toggle Cursor" toggle cursor icon.
      • Then you can find the max, min, the slope, or the relative max or min ( cursor function icon is find relative max).
    8. Saving:
      • To save your probe you need to go into the tools menu and click display, this will open up a menu which will allow you to name the probe file and choose where to save it. You can also open previously saved plots from here as well.
    9. Printing:
      • Select Print in Edit or on the toolbar print 
icon.
      • Print as usual.

  4. Simulation Commands
    1. Transient
      simulation command 
menu
      • The transient analysis is probably the most important analysis you can run in LTSpice, and it computes various values of your circuit over time. Two very important parameters in the transient analysis are:
        • Stop Time.
        • Time to Start Saving Data
        • Maximum Timestep
        • (various checkboxes....later)
      • The ratio of Stop Time: Maximum Timestep determines how many calculations LTSpice must make to plot a wave form. LTSpice always defaults the start 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 use before running the simulation, if you make the timestep too small the probe screen will be cluttered with unnecessary points making it hard to read, and taking extreme amounts of time for LTSpice to calculate. However, at the opposite side of that coin is the problem that if you set the timestep too high you might miss important phenomenon that are occurring over very short periods of time in the circuit. Therefore play with step time to see what works best for your circuit.

      • You can set a step ceiling which will limit the size of each interval, thus increasing calculation speed. Another handy feature is the Fourier analysis, which allows you to specify your fundamental frequency and the number of harmonics you wish to see on the plot. LTSpice defaults to the 9th harmonic unless you specify otherwise, but this still will allow you to decompose a square wave to see it's components with sufficient detail.
    2. AC Analysis
      ac analysis command
      The AC analysis allows you to plot magnitude and/or phase versus frequency for different inputs in your circuit.
      • Type of Sweep
        In the AC anlysis menu you have the choice of three types of analysis:
        • Linear,
        • Octave and
        • Decade.
        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 circuit reacts over a very large range of frequencies choose the decade option.

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

        • Number of points
        • Start Frequency
        • Stop Frequency
    3. DC Sweep
      • The DC sweep allows you to do various different sweeps of your circuit to see how it responds to various conditions.
      • For all the possible sweeps,
        • voltage,
        • current,
        • temperature, and
        • parameter and global
        you need to specify a start value, an end value, and the number of points you wish 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 the voltage sweep and the current sweep. For these two, you need to indicate to LTSpice 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 a nested sweep.
      • A nested sweep allows you to run two simultaneous sweeps to see how changes in two different DC sources will affect your circuit.
      • Once you've filled in the main sweep menu, click on the nested sweep button and choose the second type of source to sweep and name it, also specifying the start and end values. (Note: In some versions of LTSpice you need to click on enable nested sweep). Again you can choose Linear, Octave or Decade, but also you can indicate your own list of values, example: 1V 10V 20V. DO NOT separate the values with commas.
    4. 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 be plotted in probe.
      • The two types of noise are:
        • Output for noise on the outputs and
        • Input 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 your circuit to be, for example, if your voltage source is labelled 'V1'.
    5. DC Transfer
      DC transfer command menu

    6. DC Operating Point
      DC operating point command 
menu
      • This is a simple, but incredibly useful analysis. It will not give you anything to plot, but it will indicate the voltages at all nodes and currents through all devices in the circuit.
    7. Other types of analysis There are other SPICE analyses possible. Eventually I might get them in here, including
      • parametric
      • fourier
      • sensitivity

  5. Types of Sources
    1. Voltage Sources
      A voltage source can be configured in many possible ways. Right clicking on one will bring up the "Independent Voltag Source" window. The options which show up in the window will change as the function selected changes.
      1. (none)
        dc voltage configuration window
        • This is your basic direct current voltage source that simulates a simple battery and allows you to specify the voltage value.
      2. PULSE
        exponential voltage configuration window
        • PULSE is often used for a transient simulation of a circuit where we want to make it act like a square wave source. It should never be used in a frequency response study because LTSpice assumes it is in the time domain, 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 as required. 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 transient analysis 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 on with the square wave on the wave generator to see how various components and circuits respond to it.
      3. SINE
        sine voltage configuration window
        • A few things to note about the alternating current source. First, there are two possible analyses which can be done and so there are two sets of parameters.
          For an ac analysis, the parameters are:
          • AC Amplitude which is the RMS 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 you need a pure sinusoid.
          • Amplitude is the undamped amplitude of the sinusoid; i.e., the peak value 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 this to zero for the normal sinusoid.
            This is used to apply an exponential decay to the sinusoid; theta is the decay constant in 1/seconds.
          • PHI is the phase advance in degrees. Set this to 90 if you need a cosine 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 to simulate 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°
      4. EXP
        exponential voltage configuration window
        • The EXP type of source is actually a
        • Note that the normal usage of this source type is ...
      5. SFFM
        sffm voltage configuration window
        • The SFFM type of source is actually a
        • Note that the normal usage of this source type is ....
      6. PWL (Piece-Wise Linear)
        pwl voltage configuration 
window
        • The PWL source is a Piece Wise Linear function that you can use to create a wave form consisting of straight line segments drawn by linear interpolation between points that you define. Since you can use as many points as you want, you can create a very complex wave form This source type can be a voltage source or a current source.
        • The syntax for this source type is flexible and has several optional parameters. The required parameters are two-dimensional points consisting of a time value and a voltage (or current) value. There can be many of these data pairs, but the time values must be in ascending order, and the intervals between time values need not be regular.
      7. PWL File
        pwl file voltage 
configuration window
        • The PWL source is a Piece Wise Linear function that ....
    2. Current Sources
      • For any of the previous discussed voltage sources, there exist the exact source except that they produce current. There is one thing that should be mentioned; current sources in LTSpice get a little confusing. For those current sources whose circuit symbol has an arrow, you have to point the arrow in the direction of conventionally flowing current. This applies to all current sources, including AC and DC. Therefore placing the current source in the circuit backwards with seemingly incorrect polarities will give the correct results.
      • An interesting little feature under the markers menu is the ability to add markers to your circuit so you can see where the current and voltage have imaginary values in the circuit, and the phase of your source at any point in the circuit.

  6. Digital Simulation
    • LTSpice can simulate digital circuits and Probe can output a timing diagram showing the relationship between all the signals propagating in the circuit. The following will be a brief introduction to digital analysis using LTSpice, you should consult the online LTSpice manual if you are unsure about any of the following properties.
    • The evaluation version of LTSpice provides many of the common digital parts that we use in the lab exercises these include, but are not limited to,
      • counters,
      • multiplexers,
      • decoders,
      • flip-flops,
      • latches,
      • all common gates,
      • buffers,
      • adders and a lot more.
    • To begin, create a digital circuit the same way you would create an analog one by getting and placing the parts (see above for details on creating a circuit).
    • Now instead of an analog voltage source you want to place digital stimuli, these are located in the parts menu as HI and LO.
    • Draw wires connecting the parts like usual, but whenever you have an output of a gate that would be an output to your circuit you need to terminate it with a block.
    • You can add these blocks to your circuit. On the tool bar there is a button labelled Add Block; connect this block to any output signal of your circuit.
    • Then run a bias point analysis and click on the button to see the enable voltage bias display, to see the logic level on each of your lines.
    • You can run a transient analysis at this point and plot the signals, but they will just be straight lines, showing the logic level of each signal. However a digital circuit that remains in a constant state all the time is of little interesting. Eventually, you are going to encounter a circuit that needs to be stimulated with a clock pulse.
    • To add a time varying 'clock pulse' to your circuit, enter the parts menu and get a part labelled STIM1 and place that as the input to a device. Double click on the STIM1 to open up a dialogue box that looks like this:

    digital stimulus window
    and fill it in with the Time Step that you want your 'clock' to have. This Time Step value is the your 'clock' pulse. There are various ways you can fill out the command prompts, one way is to do it as shown in the picture, however here are some simple commands that will allow you to do a range of simulations:

    • REPEAT FOREVER, to simulate a real clock
    • REPEAT <n> TIMES
    • END REPEAT
    • <<time>> INCR <<value>>
    • <<time>> DECR <<value>>
    • for <<value>> you can use, 0,1,R(rising), F(falling), X(unknown), or Z(high impedance)
    • There are other useful commands that are documented well in the online manual. If you are interesting in seeing the voltage levels attached to these gates to see if you need to buffer any signals or to see if you are exceeding the fan out and/or fan in of any gate, you need to add dropping resistors to the inputs of gates, and a load resistor the outputs of the gates and simulate again. When you are running the transient analysis, don't forget to change your print step and the final time so you will actually be able to see the results.

    • If your digital circuit contains a counter, or decoder or some other device with many outputs that are all going to a single destination, instead of drawing many individual signal lines from each source to the proper destination you can use a bus. In the draw menu at the top of the screen is an option for drawing a bus which is a thick wire able to carry many separate signals to a single place. The order in which the signals go on the bus is the order in which they come off at the destination.

  7. References and Links
    1. For the more obscure questions you might have go right to the source at Linear Technology©
      http://www.linear.com/designtools/software/switchercad.jsp
    2. **All pictures and screen shots came from Linear Technology© LTSpice version 2.24i
    3. Not related to LTSpice specifically, but there is a tutorial on using LaTeX to typeset technical documents at
      http://denethor.wlu.ca/latex

 

get Acrobat Reader
If you need to download Adobe Acrobat Reader go here If you need to update a browser, you might try Firefox which is Get Firefox!
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.

Valid XHTML 1.0 Strict

Valid CSS!

Copyright © 2008 Terry Sturtevant, Wilfrid Laurier University Disclaimer
Return to Top of Page

Wilfrid Laurier University