LTSpice Tutorial – running a model and viewing output

Let’s get LTSpice up and running with a working model, run a simulation and view the output.

First, download the LTSpice application

Second, from the LT3748 product page, download the LT3748 Demo Circuit – Automotive Isolated Flyback Controller.

Third, Run LTSpice and open the LT3748_TA02.asc file. You should now have a window that looks like this:

Loading an LTSpice model for the first time pulls up the graphical view of the circuit design.

Loading an LTSpice model for the first time pulls up the graphical view of the circuit.

Now, this model from Linear is all set and ready to go, so you can just go hit the Run button and get a good simulation run, but you might ask, exactly what are you simulating with that run? That’s where the Edit Simulation command comes in (and the related LTSpice text commands embedded in the model).

To get to the Edit Simulation Dialog, select Simulate, then Edit Simulation Cmd. That should present you with this dialog:

Here you can edit the type of simulation you want to run and the parameters for that simulation.

Here you can edit the type of simulation you want to run and the parameters for that simulation.

Note the .tran 5m startup text. This is an LTSpice Directive. Any text string in the model that starts with a period is considered to be an LTSpice directive. In this case, the .tran Dot Command contains the current transient simulation parameters. This is the same text string you see in the graphical view of the circuit. (check in the lower right hand portion of the circuit window) You can either edit the simulation commands via the Edit Simulation Dialog, or you can manually edit the LTSpice Directive text, they are one in the same.

There are multiple types of simulations you can run. For the work here, we want Transient Analysis. The others are: linearized small signal AC, DC sweep, noise, DC operating point, and small signal DC transfer function. Open up the LTSpice Help Topics and search for “Simulator Directives” if you want more detail.

By default, the transient simulation is set to stop after 5ms and to start all voltages at 0 (ie simulate a cold start). This is equivalent to turning on the power and recording the first 5ms of circuit operation. That’s generally sufficient to see how the output ramps up and stabilizes. Ultimately in my LT3748 design I had to run the simulations out to 10ms to get a better view of the ‘steady state’.

Now, Select Simulation / Run

As the simulation runs, you should see the current status update down at the bottom of the model window. Note that the content of the status window depends on the location of the mouse and the active window. Make sure the circuit view is the active window and that the mouse is over empty gray space to best see the simulation status.

current status of the simulation is shown at the bottom of the model window

current status of the simulation is shown at the bottom of the model window

As the simulation runs, any selected test points are dynamically graphed. On your first run, no test points are selected, so you’ll likely either just the circuit window or see a window like this:

Simulation completed, but without any test points selected.

Simulation completed, but without any test points selected.

To graph values from the nodes in the LTSpice simulation (even while the simulation is running), make sure the circuit windows is active and hover the mouse over a node to get the voltage probe cursor or over hover over a device to get the ammeter cursor.

voltage probe cursor comes up when mousing over an LTSpice circuit node.

voltage probe cursor comes up when mousing over an LTSpice circuit node.

Use the voltage probe to select the wire connected to the Drain of the switching FET-Q1. That should produce a time graph of the selected voltage. You can select other signals as well. For example, add in the voltage (using the voltage probe cursor) and current (using the ammeter cursor) through the output load resistor and you should see a graph similar to this:

Q1 Drain voltage, and load voltage/current

Q1 Drain voltage, and load voltage/current

One thing you’ll see right away is the signals tend to be identified by the default LTSpice net name, for example V(n004). But… notice the load voltage. It actually says the more meaningful V(out)! How’s that happen? It’s because a Label was added to the node. See the “Out” label on the wire above the load resistor?

LTSpice - naming a net

LTSpice – naming a net

Add a label by making the Circuit window active, then click Edit / Label Net. Now fill in the label name and place it on the appropriate wire/net. Adding/removing a label will not affect the existing simulation data, you’ve got to re-run the simulation before the new net names will show up. Stranger, if you run a simulation, then add a label without re-running the simulation and try to graph the net, you’ll get weird, inaccurate results. Make sure to re-run the simulation if you change the net labels!

One neat feature of the graphing is the ability to edit the expression that is graphed. You can add, subtract, multiply, divide and apply multiple functions to signals. Look in the LTSpice help under “Waveform Arithmetic” for more information on the types of equations you can use. One good example of this is to display the voltage across D1 as there’s no direct way to view that. You can graph the input and/or the output voltage, but you have to use the WaveForm Arithmetic to graph V(in)-V(out).

To do this, you need to know both LTSpice node names involved. Easiest way is to simply ensure the circuit window is active and hover the mouse (so you see the voltage probe cursor) over each wire. Then check the status at the bottom of the window. You should see “Click to plot V(N001)”. The other side of D1 should say “Click to plot V(OUT)” (remember that node has a label!).

So we want to graph V(N001)-V(OUT). Do this by right-clicking on the existing V(OUT) label at the top of the graph window. That should pull up the expression editor, like this:

Right click the graph label to pull up the expression editor

Right click the graph label to pull up the expression editor

Simply type in the new equation V(Out)-V(N001) and click OK:

Modify the waveform expression as needed and click OK

Modify the waveform expression as needed and click OK

At this point a couple of other commands come in handy. Right mouse in the waveform graph window and note the Delete Trace, Zoom to Fit, and Zoom to Area commands. Suggest at this point deleting the other two traces, do a quick Zoom to Fit, then a Zoom to Area to focus in on what the voltage across the D1 diode really looks like.

Voltage across the D1 diode over time.  Zoomed in to better see the waveform.

Voltage across the D1 diode over time. Zoomed in to better see the waveform.

Another waveform quickie is to Control-Left Click the signal name to integrate the signal across the displayed time, which returns both the average and RMS value.

Control Left click the signal name to integrate over the displayed interval

Control Left click the signal name to integrate over the displayed interval

One other waveform display trick that comes in handy is the ability to display a FFT of one or more selected signals. Here are the steps to display a signals FFT:

First, select menu items View / FFT

View / FFT to launch the LTSpice FFT dialog

View / FFT to launch the LTSpice FFT dialog


the FTT dialog comes up…
Initial FFT dialog

Initial FFT dialog

Then, select the signals you wish to process. By default, everything in the waveform window is selected. You can select or deselect signals here as you desire.

Next, select the time-range. I find it easiest to just zoom in the appropriate range in the waveform view and select “Use Current Zoom Extents

And then, make sure to pick a windowing function (say Gaussian). The windowing function defaults to none and then the FFT display does nothing, so make sure to select a windowing function!

Select the FFT windowing function

Select the FFT windowing function

Now, click OK. If you started with multiple signals selected above, you can again get a choice to reduce the number of displayed signals. If you get this 2nd window, do make sure you have at least one signal selected or you’ll get an empty FFT display!

Make sure you have at least one signal selected!

Make sure you have at least one signal selected!

And finally, the FFT display of the selected signal, v(OUT) in this case.

Default model, V(OUT) FFT display.

Default model, V(OUT) FFT display.

It’s very interesting to note here the strong 67Khz hum coming from the switching of the FET. Not a very clean output voltage level at this point. In fact, if you zoom in on the output waveform (below), you can see the ripple running about +/- 0.08V (or about +/- 1.6%) and… the voltage is a tad low. Around 4.91V rather than the 5V (or actually 5.25) we probably want for building a USB charger.

Initial V(out) waveform

Initial V(out) waveform

One other tool I found handy is the Efficiency Report. As this is a virtual circuit, it’s sometimes hard to tell when some component is being overwhelmed. Unlike a physical test circuit, there’s no heat and no smoke to tell you something is horribly wrong. That’s where the efficiency report comes in; it can tell you how much power is being dissipated in each component, so those 1/8 watt resistors trying to burn off 10 watts become really obvious.

So here’s how to run the efficiency report:

You can launch the efficiency report by right-mouse menu down in the circuit window like this:

Efficiency Report missing the required steady state simulation

Efficiency Report missing the required steady state simulation

But wait, notice the Efficiency report options are grayed out. The problem is you have to run a “Steady State” Simulation to get an efficiency report. To do that you must add “Steady” the to simulation command, like this:

Transient simulation with Steady specified

Transient simulation with Steady specified

Now re-run the simulation. When it completes, you see that the Efficiency Report options to “Show on Schematic” or “Paste to Clipboard” are no longer grayed out. I like to use Paste to Clipboard and then paste the results into a notepad window.

You should see something like this:

Sample Efficiency Report

Sample Efficiency Report

You’ll see, this one actually looks pretty good. D1 is burning just a tad over 1 watt, which is probably ok for that PDS760 diode. No smoke this time…

Now that we have a working model and know how to view simulation results, let’s walk through making some changes.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>