How to use the LTspice circuit simulator

Learn how to use the LTspice circuit simulator, including schematic entry, selecting and
running different simulation types, and how to produce simulation output for reports. Example circuits
will be simulated to demonstrate the capabilities of LTspice.
Introduction:
LTspice is a fully-functional, freely-available circuit simulator. Linear Technology, Inc. originally
designed it so engineers could simulate their switching power supply controller integrated circuits. It is
an excellent SPICE simulator, rivaling costly commercial products like Electronic Workbench and
PSpice. Some important advantages to LTspice are that it is free, circuit sizes are unlimited, it is very
easy to add new models, and the user can easily modify the simulator’s behavior. However, PSpice and
Electronic Workbench have other advantages and are better at mixed analog/digital circuits than
LTspice.
In this lab exercise you will:
• Examine the documentation
• Adjust the schematic window’s user interface with control panel options
• Enter a simple schematic
• Explore the LTspice component library
• Run simulations for
o dc operating point
o ac small-signal frequency response
o time-domain
• Format and create schematic and plot outputs for reports
Equipment:
Computer with LTspice installed.
Procedure:
Starting LTspice

  1. Start LTspice by left clicking on the icon . When it starts up, LTspice may ask if you would like to
    download an update. Do not do that now.
    The screen should look like Fig. 1 if you have a MS Windows PC.
    Note: Mac OS users do not have the toolbar under the menu bar.
    Note: For both Windows and MAC OS users by right-clicking on the main window and using that
    context-based menu.
    These instructions will use the context-based menu rather than the toolbar.
    2 Rev. 5
    Examine the Documentation
    A quick overview of the help documentation follows. It serves as the manual but there are some other
    online resources and a user’s group that can help with more advanced topics.
  2. On the menu bar, left click Help > Help Topics and expand the LTspice XVII heading.
    Mac Users: Help > LTspice Help can be found on the File/Edit/Window/Help menu at the top of
    the screen.
    a. Expand the Schematic Capture topic.
    • Left click the first four subtopics so you can see what is covered.
    b. Expand the Waveform Viewer topic. This is the waveform plotting utility. Examine Data Trace
    Selection, Waveform Arithmetic, Axis Control, and Attached Cursors.
    c. Expand the LTspice topic (Mac Users: LTspice Simulator topic). This is where you find the
    detailed settings for simulations and the definitions of the circuit elements.
    • Expand Dot Commands (Mac Users: Simulator Directives). These are used to set simulation
    parameters and select the simulation types.
    o In most cases you choose basic simulation settings graphically using the menu or toolbar.
    o However, special commands are implemented by placing command text on the schematic
    itself. An example of using a dot command is adding a special model you want to use for
    one of your circuit elements.
    • Expand Circuit Elements. These are the basic circuit element building blocks used in circuits
    and subcircuits. The element options are explained in these subtopics.
    Fig. 1. MS Windows version startup window with expanded menu and toolbar insert.
    3 Rev. 5
    d. Expand the Control Panel topic. These functions control simulator program operation, aspects of
    the user interface, color schemes for schematics and plots, and plotting parameters.
    e. Close the Help window.
    Adjust the Schematic Window User Interface
    After opening a new schematic, you will make some useful adjustments to the default schematic
    graphical user interface settings. There are many other adjustments that you can make to suit your
    preference.
  3. Left click on the menu bar File > New Schematic. Fig. 2 shows the default schematic window for
    MS Windows users. The menu and toolbar change to the one shown in the insert. There are more
    menu items.
    Mac Users: The Mac version does not have a toolbar. All actions are available by right-clicking on
    the window and selecting the desired action. These same actions are also available to Windows
    users.
    a. Left click Tools > Control Panel
    b. Left click the Drafting Options tab.
    • Left click the Reset to Default Values button so you can see what these settings are in case
    they have been changed.
    • The following changes will make schematics look better, particularly in reports
    o Under Pen thickness[] drop down menu, select 4. Mac Users: Drafting > Line Thickness should be 2. Waveforms > Line Thickness should be 4 Fig. 2. Default schematic window with expanded menu and toolbar insert. 4 Rev. 5 o The grey schematic background does not look good in reports if you copy the schematic to the clipboard, so change it to white as follows. ▪ Left click Color Schemes[] (Mac Users: Configure Colors).
    ▪ In the Selected Item box, use the drop-down arrow to select Background.
    ▪ Move the three RGB sliders all the way to the right so they are at 255.
    ▪ Left click OK.
    • Other settings you can change in the Drafting Options are:
    o You may want to change the font properties (type, size, or bold).
    Mac Users: There is no way to change font properties such as type, bold, italics, etc.
    Size can be changed by right-clicking an individual component name or value.
    o You may also want to select Show Schematic Grid Points while you are drawing a
    schematic, but these will show up in the schematic if you copy it to the clipboard.
    Mac Users: Schematic Grid Points are toggled on or off using the View menu after
    right-clicking the schematic to reveal the menu
    c. Close the Control Panel.
    Enter a Schematic
    You will construct the circuit in Fig. 3 or one chosen by your instructor. The circuit is a simple model of
    an op amp inverting amplifier using standard SPICE elements.
  4. Add components to the schematic as follows.
    Note: For MS Windows users resistors, capacitors, inductors, diodes, and ground elements have
    their own toolbar buttons. All other elements and models are accessed through the component
    library button (looks like an AND gate).
    a. Place the resistors.
    • Right click on the schematic and select Draft > Component. The Select Component Symbol
    window will appear as shown in Fig. 4. This directory level has all the standard LTspice
    elements. Select res followed by OK. A resistor will attach to the cursor.
    • Drag the resistor on the schematic and left click to place it. It doesn’t matter where it is
    placed or how it is oriented since it will be moved later.
    • Move the mouse and left click to place the second resistor.
    • Place a third resistor. You will delete it shortly.
    • Right click to end the resistor placement (or press the ESC key).
    Note: The F2 key will activate the select component function without having to enter a menu.
    b. Deleting a component.
    • Right click on the schematic (not the resistor itself) and select Edit > Delete.
    • The cursor will change to a scissor icon.
    5 Rev. 5
    • Move it over the third resistor, left click to delete it, then right click to end the delete mode.
    Note: The F5 key will activate the delete function without having to enter a menu. Also, the MS
    Windows version has a scissors icon on the toolbar.
    c. Place the voltage-controlled voltage source (VCVS).
    • Right click on the schematic and select Draft > Component.
    Fig. 3. Op amp inverting amplifier schematic
    Fig. 4. Select Component Symbol window, top level directory.
    6 Rev. 5
    • VCVS elements are identified by the letter “e” in all versions of SPICE. LTspice has two
    symbols, “e” and “e2”.
    o First click on the e and the symbol will appear in the top left box of the Select
    Component Symbol window.
    o Then click on the e2 and that symbol will appear. Note the difference is just the
    orientation of the + and – signs on the VCVS input leads.
    o The circuit in Fig. 3 uses e2, so left click on that one and then click OK.
    o Place it on the schematic as you did with the resistor. It will be moved later.
    o Right click to end the VCVS placement (or press the ESC key).
    d. Place the independent voltage source.
    • Right click on the schematic and select Draft > Component.
    • Navigate to the “voltage” element in the top-level directory and left click on it.
    o Its symbol is a standard independent voltage source and not one that looks like a battery
    as in the schematic. However, it can be used for a dc source too.
    o You will use a battery symbol and not this one, but the standard voltage source symbol is
    more popular.
    • Locate and double left click on the [Misc] directory link.
    o Select the “battery” symbol and then left click OK.
    o Place it on the schematic and then right click when you are done.
    e. Place the ground (0-volt node) reference symbol.
    • Right click on the schematic and select Draft > Label Net.
    • Select GND (global node 0), then OK. Place the GND symbol on the schematic.
    • You can place more than one ground symbol on a schematic, which can make the wiring
    neater.
    • Right click when you are done placing grounds.
    Note: The MS Windows version has a ground icon on the toolbar.
  5. Arrange components and connect them with wires as follows.
    a. To move and rotate components, use the Move tool (looks like a hand with open fingers).
    • Right click on the schematic and select Edit > Move. Or you can use F7.
    • Click on one of the two resistors.
    • While the resistor is “active”, press Ctrl-R to rotate it to horizontal and move it to its final
    position. Then left click to place it.
    • Repeat the process to place the second resistor.
    • Move the voltage sources to their final positions.
    7 Rev. 5
    b. Wire the schematic using the wire tool (looks like a pencil).
    • Right click on the schematic and select Draft > Draw Wire. Or you can use F3.
    • Move the mouse position to one of the element leads using the crosshairs to find it.
    • Left click to start the wire. You do not have to hold the mouse button down.
    • Drag the wire to the next element. You can make bends by left clicking and changing the
    wire direction.
    • When you reach the next element, left click on its lead and the wire will terminate.
    Note: If you want to finish a wire open-ended and not on an element, left click, then right click
    where you want to end it.
    c. More on moving components.
    • The Move tool will move components and individual wire segments when you left click on
    them.
    • You can move a group of components by first drawing a select box with the Move tool hand.
    o Position the Move hand where you want to start the select box. Click and hold the left
    button and drag it to select the components you want. Then release the left button.
    o Then drag the selected components where you want them to go.
    d. Dragging components.
    • The Drag tool is the hand symbol that looks like a fist .
    • Dragging leaves wires connected and can be more convenient at times.
  6. Elements are automatically given reference designator labels as they are placed on the schematic.
    LTspice uses them as unique identifiers. Elements usually do not have default values, but if they do,
    they usually need to be changed. Fig. 5 shows circuit element labels and values.
    a. Changing resistor values and designator labels is done as follows.
    • You can change the designator label by right clicking on it and entering text. You do not
    need to change it for this exercise, but resistor designator labels must start with the letter R.
    Fig. 5. Element designator labels and values.
    8 Rev. 5
    • The initial value for all resistors is the placeholder letter R. It does not represent a numerical
    value.
    o Right click on the R and change the value to what you want.
    o Numbers like 1e5 or 1E5 are equivalent to 100k, 100000, and 0.1Meg.
    Note: Exponential notation follows the syntax above. Characters like “10” and “^” are
    meaningless and can cause errors. See Table 1.
    b. Changing the independent voltage source value and designator label is done as follows.
    • The designator is changed the same way as with resistors. You do not need to change it for
    this exercise, but independent voltage source designator labels must start with the letter V.
    • To change the value, right click on the placeholder letter V. Enter the dc voltage you want.
    • You can also change the value by right-clicking on the voltage source element, which opens
    the Voltage Source dialog box.
    o Enter the dc value you want in the box.
    o Note that if you left click the Advanced button, you can give the source values for other
    simulation types.
    ▪ “Functions” waveform types are for Transient (time-domain) simulations.
    ▪ “DC Value” is for operating point and transient simulations.
    ▪ “Small signal AC” is for ac analysis (frequency sweep) simulations.
    c. Changing the VCVS scale factor and designator label is done as follows.
    • The designator is changed the same way as with resistors. You do not need to change it for
    this exercise, but VCVS designator labels must start with the letter E.
    • To change the scale factor, right click on the placeholder letter E. Enter the scale factor you
    want.
    o The scale factor does not have to be a constant value
    Table 1: SPICE number notation.
    Suffix Multiplier
    T 1e12
    G 1e9
    Meg 1e6
    K 1e3
    mil 25.4e-6
    m 1e-3
    u(or μ) 1e-6
    n 1e-9
    p 1e-12
    f 1e-15
    9 Rev. 5
    o It can be an equation involving other circuit parameters. See the Help section on Voltage
    Dependent Voltage Source.
    • You can also change the scale factor by right-clicking on the element which opens the
    Component Attributes Editor box.
    o Change the scale factor in the Value row, Value column.
    d. Labeling circuit nodes makes it easier to find them in the simulation results.
    • Label the input node between V1 and R1 as follows.
    o Right click on the wire, then left click Label Net.
    o The Net Name dialog box will appear. Type “in” (without quotes) in the box, then left
    click OK.
    o A box will attach to the cursor that has a small square anchor point. Position the anchor
    point on the wire and left click to anchor it to the wire. Then right click to stop the mode.
    o You can remove net names with the Delete tool.
    • Label the output node “out”.
    e. Save your circuit schematic by first left clicking File > Save As. Navigate to a desired folder or
    create a new one and enter a filename. Then click Save.
    Note: You should save files frequently and use different filenames when appropriate.
    Running Simulations and Documenting Results
    You will run three simulations, a dc operating point analysis, a time-domain analysis, and a small-signal
    frequency response analysis. You will also learn how to plot waveforms, use cursors, and format plots
    for reports.
  7. DC operating point simulation. The schematic you just entered uses an independent dc voltage
    source, so you will perform a dc analysis first.
    a. Set up the dc operating point analysis and save results as follows.
    • On the menu at the top of the window, left click Simulate > Edit Simulation Command.
    Mac Users: Right-click, Draft > Spice Directive
    • Left click the DC op pnt tab (Mac Users: Type .op into the empty text box). There are no
    parameters to specify, so left click OK.
    o A box will attach itself to the cursor.
    o Move the cursor to an empty part of the schematic and left click.
    o The dot command .op will appear. You can use the Move function to move the .op
    command text somewhere else.
    b. Run the .op simulation by clicking Simulate > Run (looks like a running person) on the main
    menu.
    • For MS Windows users, a window with the results will appear.
    10 Rev. 5
    Mac Users: Operating point simulation results are found in the SPICE Error Log. Rightclick to reveal the menu, then View > SPICE Error Log.
    • Reduce the size of the window to include just the output data.
    o Put the cursor over the lower right corner, until a double arrow appears.
    o Left click, hold and drag the window to an appropriate size.
    c. Open a new document in MS Word or a similar word processor, then copy and paste the results
    in it as follows.
    • Click on the window with the .op simulation results to make it active.
    • MS Windows can copy the .op results window to the clipboard by pressing keys Alt-PrtScr at
    the same time when that window is active.
    Mac Users: Select the relevant text, right-click and copy
    • In the document, paste the clipboard bitmap of the .op results window.
    • Resize it in the document so the results are readable.
    d. Copy the schematic to the document as follows.
    • Return to LTspice and copy the schematic to the document as follows.
    • Close the .op results window.
    • Right click on the schematic window and select View > Zoom to Fit . This will expand the
    schematic to maximum size.
    • On the menu, left click Tools > Copy bitmap to Clipboard.
    Mac Users: Use Screenshot, save the photo, then add the photo to the document.
    • Then paste the clipboard bitmap into the document.
    • Crop and resize it as needed to make it an appropriate size. This is how the schematic figure
    images were generated for these instructions.
  8. Time-domain simulation. The next simulation is a time-domain analysis with the independent
    voltage source changed to a sine wave. You could use the battery source for this since it is a fullyfunctional independent voltage source. However, you will change it to the general voltage source
    you saw earlier.
    a. Change the voltage source.
    • Delete the battery source.
    • Open the Select Component Symbol window as done earlier.
    Mac Users: Draft > Component > type vo into the search box. The independent voltage
    source will be selected.
    • Find and select the Voltage independent source and place it on the schematic where the
    battery used to be.
    b. Adjust the source to be a 1 Vp-p, 1 kHz sine wave as follows.
    11 Rev. 5
    • Right click on the source and the Voltage Source dialog box will appear.
    • Left click Advanced and the Independent Voltage Source box will appear.
    • Select SINE and then fill in the information as follows.
    o DC offset: 0
    o Amplitude: 1
    o Freq (Hz): 1000
    o Leave all others blank. You should have values appearing as in Fig. 6.
    • Left click OK. The schematic should now appear as in Fig. 7.
    c. You will now set up the transient simulation to run for four sine wave cycles. A 100 s
    maximum timestep is specified to ensure a smooth curve. You do not always have to specify a
    maximum timestep, but it is useful at times.
    • Left click Simulate > Edit Simulation Command.
    Mac Users: Draft > Spice Directive. Type .tran 100u 4e-3 into the text box. Note that the
    timestep precedes the stop time.
    • Left click the Transient tab and enter the simulation parameters below.
    o Stop Time: 4e-3
    o Maximum Timestep: 100u
    • Left click OK.
    Fig. 6. Sine wave voltage source parameters.
    12 Rev. 5
    • Place the .tran statement on the schematic. If the .op statement is still there, it will now have
    a semicolon in front, which comments it out and makes it inoperative.
    Mac Users: The Mac version does not add a semicolon to previous directives. Use Edit >
    Delete to remove the .op directive.
    Note: Some versions of LTspice incorrectly handle this automatic commenting function and
    actually merge the specifications of two simulation types. This is noticeable when reselecting
    .op when a .tran simulation is active. In this case, you may have to delete existing simulation
    commands on the schematic and re-enter.
    You can manually add and remove semicolons and periods to select the one simulation you
    want by editing each simulation command independently.
    d. Run the simulation and examine the waveforms.
    • Left click the menu Simulate > Run and a blank plot window will appear.
    • Right click in the middle of the plot window and select Add Trace.
    • Left click on the output node voltage and the input node voltage, then left click OK. A plot
    with both waveforms will appear.
    • Add a grid to the plot as follows
    o Right click on an empty part of the plot window then select View and check the box next
    to Grid.
    o You can also select Plot Settings on the menu and check the Grid box.
    • From the schematic, determine the ideal amplifier gain magnitude and whether it is noninverting (0 phase shift) or inverting (180 phase shift).
    Gain: Inverting or non-inverting:
    • Before copying the plot to the clipboard for insertion in the document, it is essential to
    remove the black background. Never use plots with black backgrounds in documents.
    Fig. 7. Schematic with sine wave source.
    13 Rev. 5
    o On the menu bar, left click Tools > Color Preferences.
    ▪ Left click the Waveform tab.
    ▪ In the Select Item box, choose Background.
    ▪ Move the three sliders all the way right so the numbers in the boxes are 255.
    ▪ Left click OK and you will return to the plot.
    o The axes are grey and a better choice for a white background is black.
    ▪ Return to the Color Preferences box.
    ▪ Select Axis and move the sliders all the way to the left so the numbers in the boxes
    are 0.
    ▪ Click Apply.
    ▪ Now select Grid and make it black.
    o The trace colors that look good with a black background may not with a white
    background, particularly light green. You will change this trace to the same color as
    V[11] but you need to see what its color numbers are first.
    ▪ Select Trace V[11] and note the color numbers.
    ▪ Select Trace V[1] and change the color numbers to the ones you just found.
    ▪ Left click OK.
    • The trace font size should be made larger than the default value.
    o On the menu bar, left click Tools > Control Panel.
    o Click on Reset to Default Values to see what those settings are.
    o Under Pen thickness[*] drop down menu, select 4.
    o Change the Font to Arial with 20-point size and select Bold font.
    Mac Users: This step cannot be done on the Mac version.
    o Left click OK.
    o The plot should look like the one in Fig. 8.
    e. Adjust the plot axis scaling and copy it to the document.
    • Adjust the time axis as follows.
    o Move the mouse over the horizontal axis until it displays a small ruler.
    o Right click and the Horizontal Axis dialog box appears.
    o Replace 4 ms with 2 ms.
    o Click OK.
    • Copy the plot to the clipboard.
    o On the menu, left click Tools > Copy bitmap to Clipboard.
    14 Rev. 5
    Mac Users: Use the Screenshot function.
    o Paste the plot in the document.
    o Resize the plot so it is 5.5-inch wide.
    f. Copy the schematic to the clipboard and then to the document as before.
  9. AC analysis simulation. The last simulation is an ac analysis frequency sweep with the independent
    voltage source changed to an ac version with 1 V amplitude. The circuit is changed to be a singlepole lowpass filter with a 10 kHz cutoff frequency. You will make a Bode plot to display the
    amplifier gain vs. signal frequency, and using cursors, find the 3 dB frequency where the gain
    magnitude is 3 dB lower than the maximum at 0 Hz.
    a. Convert the amplifier to a single-pole lowpass filter as follows.
    • Left click on the Capacitor button on the toolbar and place a capacitor just above the 1 M
    feedback resistor. Rotate it to be horizontal.
    Mac Users: Right-click Draft > Component and type c in the search box to select the
    capacitor. Click OK and hit Ctrl-R to rotate before placing on the schematic.
    • Connect the capacitor in parallel with the feedback resistor.
    • Calculate the value needed to set the cutoff frequency to fc = 10 kHz where the response will
    be down 3 dB. Eq. 1 shows the relationship between the cutoff frequency, R2, and C values.
    2
    1
    2 c
    C

 R f

(1)
Fig. 8. Input and output waveforms from transient simulation.
15 Rev. 5
• Change the capacitor value to the one you calculated.
b. Adjust the voltage source to be a 1 V ac source as follows.
• Right click on the source and the Voltage Source dialog box will appear.
• Left click Advanced and the Independent Voltage Source box will appear.
Mac Users: Right-click on the source and the Edit Voltage Source box will appear.
• In the Small signal AC analysis area, set the amplitude to 1.
• Leave the sine wave time domain configuration as is. It will not affect the ac analysis
simulation.
• The schematic should appear as in Fig. 9 with the placeholder letter C replaced with the
value you calculated.
c. Now set up the ac analysis simulation to sweep from 100 Hz to 1 MHz:
• On the menu, left click Simulate > Edit Simulation Command.
Mac Users: Right-click Draft > Spice Directive and type .ac dec 101 100 1e6 into the text
box.
• Left click the AC Analysis tab and enter the simulation parameters below. A decade
frequency sweep uses logarithmic point spacing over each 10:1 frequency decade. By
choosing 101 points per decade, the plot should be smooth ad there is a point on each decade
boundary and 100 frequencies in between.
o Type of Sweep: Decade
o Number of points per decade: 101
o Start Frequency: 100
o Stop Frequency 1e6
• Left click OK and place the .ac command on the schematic (Mac Users: Use Edit > Delete to
delete the previous .tran directive)
Fig. 9. Schematic with ac source and feedback capacitor.
16 Rev. 5
d. Run the simulation and examine the waveforms.
• Left click the Simulate button and a blank plot window will appear.
• Traces for the input and output may already be present. If so, delete the input trace using the
Delete tool.
• If no traces are present,
o Right click in the middle of the plot window and select Add Trace.
o Left click on the output node voltage then left click OK. Plots of the output magnitude
and phase will appear as shown in Fig. 10.
o Because your input signal had 1 V amplitude, a plot of the output signal is the same as
the gain, which is why 1 V was used.
• Place two cursors on the plot and measure the 3 dB cutoff frequency as follows.
o Right click on the trace name at the top of the plot and the Expression Editor will appear.
Mac Users: Left click on the trace name to enable cursor 1. Left click again to enable
cursor 2. No numbers appear on either cursor; use the menu window that appears to
distinguish between cursors. No need to attach cursors – they will appear and be easy
to see.
o In the Attached Cursors box, select 1st & 2nd
.
o Left click OK.
o The cursors will be dashed crosshairs that are sometimes difficult to find.
Fig. 10. Lowpass filter frequency response.
17 Rev. 5
o Move the mouse around the plot until a yellow “1” appears.
o Left click and hold and drag the cursor all the way down to 100 Hz.
o Note the cursor 1 magnitude.
▪ This is the gain magnitude at 100 Hz and is very close to the maximum gain that
occurs at 0 Hz.
Gain at 100 Hz in dB:
▪ Convert the gain in dB to a non-dB gain magnitude.
Gain at 100 Hz (non-dB):
▪ Is this expected value?
o Move the mouse around the plot until a yellow “2” appears.
o Left click and hold and drag the cursor until the Ratio (Cursor2/Cursor1) magnitude is
−3.00  0.02 dB.
o Read the cursor 2 frequency. Determine the percent error between 10 kHz and the cursor
2 frequency.
Cutoff frequency:
o Place a marker at the 3 dB point as follows.
▪ On the plot menu, select Plot Settings > Notes and Annotations > Label Curs. Pos.
Mac Users: Use Draw > Text to create a text label (this can’t be edited so type carefully.
Use Draw > Arrow to make an arrow from the label to the point on the trace.
▪ You can right click on the label text and change or delete it.
▪ You can also delete the label and arrow using the Delete tool.
e. Copy the plot and paste it in the document.
• Left click Tools > Copy bitmap to Clipboard (Mac Users: Use Screenshot)
• Paste the plot in the document.
• Resize the plot so it is 5.5-inch wide.
Results Documentation Summary

  1. You should have the following documentation from the procedure steps.
    a. You should have three schematics, one from each simulation.
    b. You should have an image of the dc simulation results and one plot from the transient simulation
    and one from the ac simulation.
    c. Be sure that you recorded data and calculated results in steps you were asked to.
    d. Check with your instructor for additional documentation requirements.

This question has been answered.

Get Answer