LTSpice Tutorial - part 1

The purpose of this tutorial is to assist you in getting up the learning curve with LTSpice. It is not a course in circuit analysis, although I will provide some tips along the way.

You have to be able to read a schematic.
It's very helpful to already have some experience with drawing schematics using a CAD tool such as Eagle, DIPtrace or TinyCAD.
You should have some very basic circuit theory under your belt, like Ohms's Law and some understanding of what the various components do.

You must have already installed LTSpice on your computer. It can be obtained for free from Analog Devices.

Before we get started, a few words about circuit simulations. Simulations are a powerful tool when used properly. The old adage "garbage in - garbage out" is definitely applicable here. A circuit simulation is only as accurate as the models and the user's abilities. Not everything that comes out of a simulation is "good." You have to evaluate and interpret the simulation results to see if they make sense. I do not rely on either testing or simulation alone, I use them in tandem. Simulation and test will each show you things that the other can't. Testing is the best way to confirm that your circuit sim is telling the truth. That being said, I am constantly impressed with how accurately a good circuit sim matches the test data. Used together, sim and test can get you to a good design or through a troubleshooting session with the least amount of consternation.

Part 1 - Getting Started

Originally, SPICE circuit files were purely text. The circuit file contained a list of the parts, their values and how they were connected. The was also a list of SPICE directives (commands) that told SPICE what to do. Enter the modern age with GUI and schematic input. Although current versions of SPICE have a graphics-based front-end, the first thing SPICE does when you hit the Run button is convert the schematic file to a text file because SPICE uses that text file as the input to the analysis engine.

We'll start with something simple, the Zvex SHO. For this example, I invite you to draw something similar to the picture below.

LTSpice SHO.png

When you start LTSpice, there is no schematic or even a sheet on which to draw it. Click File -> New Schematic to create a blank sheet. Before you start drawing, get familiar with the Tool Bar. Hover the cursor over each icon to see what it does. You can use the mouse's scroll wheel to zoom in and out of the drawing.

Add parts one at a time, in any order, and use the Wire tool connect them. Don't worry about setting their values yet, just get all of the parts on the schematic and connect them. LTSpice will automatically set the ref designators sequentially. You can change them manually if you like. Every part must have a unique ref des or else LTSpice will give you a nice error message when you hit the RUN button. To find a MOSFET, click on the COMPONENT tool (looks like a logic gate). Scroll thru the list and pick NMOS. The power supply (Vbatt) is also found in the COMPONENT list, it's called VOLTAGE. Same goes for Vin. You can enter component values or part numbers by right-clicking on the text field you want to edit. The only restrictions on component values is none of them can be zero and you have to adhere to the syntax when you use multipliers like "k," "u," "Meg," etc. LTSPice is not case-sensitive. Note that the Gain resistor, Rgain, has its value written as a math formula and that formula is enclosed in curly braces. This is how we do parametric variation in SPICE. With parametric variation, we easily can simulate pots and switches, or simply play "what if." The formula can be written a number of ways. For pots, I prefer to write the formula as the pot value multiplied by a scale factor that varies from zero to one. I add 1 ohm at the end of the formula so that SPICE doesn't throw a fit if I set G to zero. Real pots don't go all the way to zero ohms anyway.

We need to assign a specific model to the MOSFET, based on the part number. Right-click on the middle of the MOSFET symbol, then click the Pick New MOSFET button. Choose BS170 from the menu and click OK (or just double-click on BS170). That menu shows you all of the N-channel MOSFETs in the LTSpice library. Advanced users can find part models on the Internet and add them to the library, or make their own models. If you forget to specify a specific MOSFET part number, SPICE will substitute a default MOSFET model. The sim will run, but the results will be crap. Don't ask me how I know this.

To set the parameters for the two Voltage Sources (Vbatt & Vin), right-click on the symbol. Vbatt is easy because it's a simple DC source. You can just enter 9 for the DC value, the + and the V are optional. You can make negative voltages by using a minus sign, or turn the symbol upside down. The Vin symbol is a little more complicated because it takes on two different aspects depending on whether we're running an AC sweep or a transient analysis. Right-click on Vin. The advanced parameter dialog box appears. Over on the right side of the dialog box, enter 1 for AC Amplitude. Over on the left side, click on the SINE button and then enter 500mV for Amplitude, 500Hz for Freq, and 25 for Theta. I find these to be convenient starting values. This will make a damped sinewave that starts at 500mV peak and decays exponentially at a rate set by Theta. If Theta is zero, the sinewave never decays, it is a constant amplitude forever. Leave everything else in the advanced dialog box blank and hit OK.

I labeled one net "out." This is purely optional, but makes examining the output easier, especially with complicated circuits. You can label as many nets as you like.

Now for the SPICE directives, those lines of text that start with a dot. Notice that I put an asterisk in front of the .tran and .ac statements to comment them out for now. This is a convenient to set up all of the analysis type you want and then enable them one at a time by removing the asterisk. There are a couple of ways to enter SPICE Directives. Click on the .op tool button and type in the dialog box. Create each SPICE Directive separately. Although it is possible to enter them all at once, editing is easier if you enter them all separately. The .op Directive tells SPICE to calculate the DC bias point for every node and branch in the circuit. It actually does that at the beginning of any analysis run, but since for the first run we're not doing an AC sweep or transient analysis, we have to specify some analysis and the .op statement satisfies that requirement.

A little explanation about the .param and .step statements. We use these so we can vary one or more component parameters. What SPICE does when it sees a .step statement is it makes a number of successive runs, stepping the specified parameter to the next value for each run. The .param statement says we have a parameter named G and in the absence of a .step param statement, it will take the value in the .param statement, 0.01 in this case. The particular .step param statement we're using tells SPICE to start with G = 0.01 and step it exponentially by decades from 0.01 to 1 (two decades) with 5 points per decade. This is more-or-less equivalent to simulating a log (or ant-log) pot and stepping from 0 to 10 (7 o'clock to 5 o'clock), one number at a time. We can take as many steps as we like, but keep in mind that for every step, SPICE reruns the analysis. 1000 steps would not be a big deal with this simple circuit, but would really bog down if we ran a circuit with several opamps in it. Also, there will be a trace for each step and we want to be able to tell them apart in the plot window.

Take your time getting comfortable with the schematic drawing tools. It's similar to other schematic drawing tools, but they all have their little quirks and idiosyncrasies.

When you're done drawing, save the file and hit the RUN button. If you drew everything correctly, you won't get any error messages. The schematic will shrink to the bottom half of the window and the top half will be a black field where we can plot the analysis results. Hover the cursor over various parts of the circuit (don't click yet) and look at the lower left corner of the schematic window. SPICE is telling you the initial DC operating point and what will get plotted if you click there. Point to the wire above the MOSFET and when you see a red probe, click it. Now you will see a curve showing the drain voltage for each step of G. When G is near zero, the drain voltage is about 4V. When G is near 0.5, the drain voltage is around 6.3V. When G is 1, the drain voltage is about 7.2V. Now hover the cursor close to the MOSFET drain until you see a little loop over the drain lead. Click that. Now we have a 2nd curve that show how the drain current varies for each step in G. Right-click on where it says Id(M1) at the top of the plot window. Here's where you can change the color, delete the trace or attach a cursor. Hit Cancel. Now left-click on Id(M1) and cross-hairs appear on the Id(M1) trace. A window also appears that shows the exact location of the cross-hairs. You can drag the cross-hairs left and right by left clicking on the vertical dotted line. You can also drag a rectangle on the plot window to zoom in. To zoom out, hit the Zoom full extents button on the toolbar.

OK, so much for DC analysis, let's see how the gain varies with freq and the Gain setting. Right-click on the *.ac line and edit it to remove the asterisk. The way we wrote the .ac statement, it tells SPICE to step the frequency from 20Hz to 20KHz exponentially, calculating 1000 points per decade. In the plot window, right-click on Id(M1) and delete it. Do the same for the other curve. Now we have a blank plot window. Hit the Run button and then click on the "out" net on the schematic. We get two sets of curves: gain & phase. Let's unclutter the display by getting rid of the phase curves. Hover the cursor over the degree scale on the right-hand side of the plot window. Right-click and hit "don't plot phase." Now we see only the gain curves. The lines are all straight and horizontal, which tells us that the SHO has a flat frequency response. The lines are spaced about 3dB apart with the line at 0dB corresponding the GAIN set a 7 o'clock and the top curve near 33dB, corresponding the GAIN at 5 o'clock. These curves are for a perfect log-taper pot, but real-world log (or anti-log) pots are just an approximation of an ideal log taper. LTSpice does not have a built-in anti-log function, so we just use a decade step and reverse the pot rotation in our minds. In this case, gain is maximum (the top trace) when G = 0 and minimum (the bottom trace) when G = 1. Not a big deal really. If people in Australia can live with summer in February, we can deal with backwards rotation of pots. Remember what I said before about hovering the cursor over parts of the schematic? Hover over the MOSFET's drain terminal and you will see that the drain voltage was 3.9V and the drain current was 998uA for the first run when G was 0.01. Looking at the bias points is a good sanity check and is also useful for troubleshooting a simulation if you get unexpected results.

One more analysis and we're done for this session. AC analysis is a "small-signal" analysis. When SPICE performs an AC analysis, all components are linearized; there's no distortion. SPICE calculates the gain and phase for every node and branch in the circuit at various frequencies and we plot that data. The AC analysis we just ran tells us the gain of a SHO as long as the signal is small enough that there is no saturation. This is interesting and useful, but only up to a point. We also want to know what happens when we overdrive the MOSFET. That's where transient analysis comes in. On the schematic, edit the .ac statement to put the asterisk back at the front so it's commented out. Now edit the .tran statement to remove the asterisk. We also want fewer Gain steps so the display doesn't get too cluttered. Right-click on the .step statement. A dialog window pops up. At the top is the parameter we're stepping, G. Change the Nature of sweep to List. make the 1st value 0 (max gain), the 2nd value 0.15 (noon) and the 3rd value 1 (min gain). Hit ok. Hit the Run button. We still have V(out) in the plot window, but now, instead of frequency on the horizontal axis, we have time. The .tran statement told SPICE to run the analysis for the equivalent of 0.25 sec. This plot is what you would see on an oscilloscope. The input starts at 500mV peak (1Vp-p) and decays down toward zero. The red and blue traces look just like the input signal because the MOSFET is running in a linear region when Gain is set at noon or below. Gain is maxed out for the green trace and we can see the trace clipping at the top and bottom where the MOSFET goes into cutoff and saturation, respectively. Using the cursor, draw a rectangular zoom window that runs from about 50ms to 70ms. The red and blue traces are sinusoidal, but the green trace is clipping asymmetrically. Zoom back out using the Zoom full extents button and then try zooming in on other parts of the traces.

Not too hard, right? Practice this with some other simple circuits and you'll be ready for part 2. In part 2, we'll simulate all three terminals on a pot, we'll simulate a Big Muff and plot harmonic distortion. Part 3 will introduce opamps.

Any questions?


Well-known member
Wow this is cool to have on a real life stompbox circuit, thanks for taking the time to write this up! I'll have to follow it step by step and redraw the SHO and stuff. And read it 25 times plus while I'm doing it. Cheers!


Village Idiot
Incredible, thanks a million Chuck! I've been making headway with Spice. I've added the expanded model library, and example circuits. There are a TON! I've also been working through their edu. material with the included circuit files. I'll dive into this hopefully later today.
Incredible, thanks a million Chuck! I've been making headway with Spice. I've added the expanded model library, and example circuits. There are a TON! I've also been working through their edu. material with the included circuit files. I'll dive into this hopefully later today.
Is it possible to get the library and rather easily look at the eq curve of the individual pedals? I have a rather limited knowledge regarding schematics so I won't be drawing anything. It' would be cool though to have a visual presentation of pedals and what frequencies they emphasize. Chuck send me a couple in my post regarding the Q of the Catalinbread Vario boost and it was super helpful.
  • Like
Reactions: fig


Village Idiot
Is it possible to get the library and rather easily look at the eq curve of the individual pedals? I have a rather limited knowledge regarding schematics so I won't be drawing anything. It' would be cool though to have a visual presentation of pedals and what frequencies they emphasize. Chuck send me a couple in my post regarding the Q of the Catalinbread Vario boost and it was super helpful.
The link below is for the page with a huge zip and has lots of audio circuits drawn that you can add your own directives for waveform viewing.


Village Idiot
There are some pedal circuits, but you have to sift through the library.
Here a an example of a fuzz, located (on MacOs in ~/Library/Application Support/LtSpice/examples/LtSpicePlus/Audio/).

Screen Shot 2021-06-03 at 7.57.47 AM.png

Chuck D. Bones

Circuit Wizard
"Not for commercial use indeed." Some crazy shit going on there. To start with, the input level pot is wired up wrong.
  • Haha
Reactions: fig


Well-known member
Catch.. ;)
.model BS170 VDMOS VTO=1.824 RG=270 RS=1.572 RD=1.436 RB=.768 KP=.1233 Cgdmax=20p Cgdmin=3p CGS=28p Cjo=35p Rds=1.2E8 IS=5p Bv=60 Ibv=10u Tt=161.6n

Use .op spice directive button to add this into your asc (simulation) file.
You can also add BS170 to your ltspice library. Navigate to Documents\LtspiceXVII\lib\cmp
open standard.mos with a Notepad and add above model somewhere there :)
Or something like this...