100% found this document useful (1 vote)
847 views13 pages

Ltspice Guide For Beginners

LTspice is a free SPICE-based circuit simulator developed by Linear Technology. It can be used to simulate circuits over time or frequency and determine how a circuit responds to changes in component values. Common simulations in LTspice include DC operating point, transient, and AC analyses. LTspice includes a variety of voltage sources that can generate waveforms like sine, pulse, and arbitrary user-defined equations.

Uploaded by

Harish Tella
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
847 views13 pages

Ltspice Guide For Beginners

LTspice is a free SPICE-based circuit simulator developed by Linear Technology. It can be used to simulate circuits over time or frequency and determine how a circuit responds to changes in component values. Common simulations in LTspice include DC operating point, transient, and AC analyses. LTspice includes a variety of voltage sources that can generate waveforms like sine, pulse, and arbitrary user-defined equations.

Uploaded by

Harish Tella
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Using LTspice

SPICE (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 to download 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 select File > 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 signi icantly 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 win1

Table 1: Engineering unit pre ixes recognised by LTspice. pre ix pico nano micro milli kilo mega arbitary symbol recognised by LTspice p n u m k Meg or meg ex or Ex value 1012 109 106 103 103 106 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 component 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 pre ixes 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 explained on page 6.

Figure 3: The dialog box for the voltage component, which can be become an AC source, by clicking Advanced. Labelling Nodes 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 select Edit > 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.

List of Keyboard Shortcuts Table 2: The default keyboard shortcuts in LTspice, ranked by their importance. Action Place Component Draw Wire Mode Place Node Label Delete Mode Place Ground Place Resistor Place Capacitor Place Inductor Rotate Component Mirror Component Zoom Outwards Zoom to Fit Shortcut F2 F3 F4 F5 or Del G R C L Ctrl-R Ctrl-E Ctrl-B 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 con igure 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 click Run to simulate the circuit. DC Operating 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.

Figure 5: The location of the DC operating point simulation. Transient Analysis Transient analysis performs a simulation over a speci ied period of time. In the Edit Simulation Command window, the only necessary option is the time to stop simulating. Choose a suitable simulation time given the frequency of any voltage sources you are using. AC Analysis AC analysis simulates your circuit over a range of input frequencies, by varying the frequency of a nominated sinusoidal voltage source over a speci ied 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 measurements at evenly spaced frequencies between the start and stop frequencies, whilst the decade sweep uses logarithmically spaced frequencies. Steady-state AC Analysis If you want to investigate the magnitude and phase of circuit voltages and currents at a particular frequency, 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.

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 exponentials, 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 at Vinitial. 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.

T on V on

T period T delay V initial t

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

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 voltage during 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 speci ied, 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.

1 / Freq T delay Amplitude

DC offset t
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 parameter still applies to the irst edge, even though the edge is now falling. 8

Fall Delay[s] Time to wait before decaying back to Vinitial. Fall Tau[s] The time constant associated with the second edge.

Rise Delay Fall Delay V pulsed


Rise Tau

Fall Tau

V initial t
Figure 9: The EXP voltage source and parameters. PWL The PWL (Piece-Wise Linear) voltage source can be con igured 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 which they occur. If you require more points, you can click the Additional PWL Point button.

value3 value5

value2 value4 value1 t time1 time4

Figure 10: The PWL voltage source and the parameters. 9

Waveform Viewer 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 click Mark 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. Taking Measurements Whilst viewing traces in the waveform viewer is useful, we often need speci ic values from our simulation. 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

Figure 12: The dialog box showing the average value and RMS value of the trace. To inspect voltage and current values at speci ic 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. Dot Commands Dot commands allow you to further con igure and setup your LTspice simulation with component value sweeps, initial conditions, de ine variables and change simulation settings. Only the most common are covered here, the full list can be found in the LTspice documentation at LTspice IV > LTspice > Dot Commands. To add a dot command to your circuit, hit 'S' or select Edit > 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 speci ied. Initial node voltages and the initial current through inductors may be speci ied. Syntax: .ic [V(<n1>)=<voltage>] [I(<inductor>)=<current>] Example: .ic V(in)=2 V(out)=5 V(vc)=1.8 I(L1)=300m The initial voltage of a capacitor can also be speci ied by appending IC = X to the capacitance value, where X is the initial voltage. Voltage-Controlled Switches 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

Table 3: Voltage-controlled switch model parameters. Name Vt Ron Roff Description Threshold voltage On resistance Off resistance Units [V] [W] [W] Default 0. 1. 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 <parameter name> <start value> <end value> <increment> To list a speci ic set of values, use instead: .step param <parameter name> list <value1>, <value 2>, ... 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

Mutual Inductance To couple two or more inductors together, a K directive specifying the inductors and the coupling coeficient between them is placed on the schematic. Syntax: Kxxx L1 L2 [L3 ...] <coefficient> 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 coef icient must be in the range of -1 to 1. When playing down inductors, you can indicate the dot on the schematic by right clicking on the component and checking the Show Phase Dot checkbox.

13

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy