In this article we are going to explore the ways on how to sweep voltage in LTSpice. Personally I like LTSpice, aside from being a freeware, it is easy to use. It really does what paid simulation software can do (although not that fast when dealing with analog simulation such as switching power supply). For beginners guide, click this. There are several methods on how to sweep voltage in LTSpice. We will discuss these one by one in this article. Parameter sweeping is very common in simulation wherein you want to know at what particular voltage level the output started to rise, fall and the likes.
LTSpice can also do current, resistance and temperature sweeping.
How to Sweep Voltage in LTSpice using a DC Sweep Command
The first way on how to sweep voltage in LTSpice is through a DC sweep command. On below circuit we will determine the level of V1 when the VBE clamp to a diode level or the output Vout turns low. Voltage sweep is the easiest way to do this.
1. Open LTSpice and start a new schematic then draw the above circuit. If this is the first time you do simulation in LTSpice, click THIS guide.
2. After you drawn the circuit, go to “Simulate” tab then click “Edit Simulation Command”.
3. On below window click DC sweep and apply the settings as shown. In below settings we want to sweep the parameter V1 from 0V to 10V with an interval of 0.1V. Use linear sweep only. After applying the settings, click OK then drop the command line in the schematic and you can run the simulation.
Below schematic is showing already the command line in the bottom. As you notice, the command line starts with a dot then the type of sweep we specified which is a DC sweep. Next to the sweep type is the parameter to be swept. Next is the starting value which is zero then the final value which is 10V then finally the increment of 0.1V.
It is not necessary that you will go to Edit Simulation Command window every time you will do DC sweep. You can make it by using the command line pattern.
To use this method, you must use the spice directive. To open the spice directive, just press letter T in the keyboard. Enter the command line pattern above in the white area of the window.
Take note, in DC sweep, the voltage to be swept must not be empty or zero. There must be a value enter. The simulation will result to error when there is no value entered.
Take note that parameter name is not a net name. It is the name you provided when you right click the component text.
4. Run the Simulation
To do this, go to Simulate tab then click Run. Another way is to click the run button directly in the icon bar.
Below is the simulation result. The x-axis is the level of V1. The blue line is the Vout while the red one is the Vb. Based from the graph, the level of V1 wherein the VBE is clamping is around 4V and also at this level the transistor is entering saturation.
How to Sweep Voltage in LTSpice using a Step Command
The second method on how to sweep voltage in LTSpice is through a step command.This method is can be done in the spice directive.
In the above simulation the level of V1 is sweep so that it is easy to determine at what particular level the transistor enters saturation. As you can notice the x-axis is the corresponding voltage level of V1. Another way on how to sweep voltage in LTSpice is by using a step command. The step command should be done using the Spice directive.
1. Set the value of V1 to any variable that is enclosed in curly braces such as below. A pair of Curly braces is the indicator that you want LTSpice to sweep a declared parameter; this parameter is that enclosed by the curly braces.
2. Set the “DC sweep”. Hit letter “T” in the keyboard. Be sure before doing this you are in the schematic window (not in the waveform window). On below window, ticks Spice directive then enter this command:
.step param V1 0 10 1
Right after, drop the command line in the schematic.
3. Setup the Transient Command. Go to Simulate then Edit Simulation Cmd.
On below window, click on the Transient tab. Provide data for the Stop Time. You can leave the “Time to Start Saving Data” empty. If this is empty, the waveform will be displayed entirely until the specified stop time. However if there is a specified value, the waveform will be displayed only right after the set start value. Just leave the Maximum Timestep empty. If you want to see the ramping action of the waveforms, tick the Start external DC supply voltages at 0V. If you leave this untick, the waveform will only show the steady state.
After setting up the transient and the DC sweep, your schematic should look like below. Specifically I want to run the transient up to 30usec with voltages starts at 0V. On the other hand I want to sweep V1 from 0V to 10V with 1V step.
4. Run the simulation by pressing the Run button in the icon bar.
How to Sweep Voltage in LTSpice using a List Command
Another way on how to sweep voltage in LTSpice is through the list command. List command is more specific than sweeping with a fixed interval. It is also can be done in the spice directive. For instance you want only to observe the Vb level of below circuit with a voltage of 1, 4, 7 and 10V; a list is more practical than sweeping with a fixed interval covering these voltages. Follow the command below in the spice directive to consider voltages of 1, 4, 7 and 10V. Take note that the voltages must be separated by a space.
All the three methods on how to sweep voltage in LTSpice has its advantages. They are very useful in circuit simulation so it is worth familiarizing it. LTSpice can also do current, resistance and temperature sweeps.