# Learning LT Spice.

Lesson 1: Creating a net list and a Simple Simulation.
Lesson 3: Introduction to and applications of transient analysis.
Lesson 4: Locating, modifying, and installing vacuum tube models.
Lesson 5: Operating point of vacuum tube circuits. Introduction to stepping and plate curves.
Lesson 6: Using stepping to do frequency response of a tone control.
Lesson 7: Transient analysis of unregulated power supplies.
Lesson 8: Transient analysis of power supply regulators.
Lesson 9: Transient and frequency analysis of amplifiers with feedback.
Lesson 10: Lossless transformers.

# Lesson 2 Introduction to and applications of frequency analysis.

## What you will learn in Lesson two.

1. How to find and retrieve a previously saved file.
2. How to Set up a generator for AC (frequency) analysis.
3. How to set up an AC (frequency) analysis.
4. How to obtain the data of frequency response.
5. Obtain skill in translating verbal descriptions into netlists through the exercises below.
6. Frequency response of a two stage RC filter.
7. Frequency response of a three stage RC filter.
8. Frequency response of a simple RLC filter.
9. Frequency response of a more complex LC filter.

## Things That are very Hard to Remember.

That step by step procedure given in lesson one has been placed in a text file which can be downloaded by holding the control key while pressing enter on the link.
On my computer the file opens as if it were a webpage. Control enter on the link will open the file in a separate window. That way you can refer to it without closing the lesson page. Control tab will switch between the two windows.

Here is more information you can look up because it is so hard to remember. Control enter on this link for the same reason as above.

## Retrieving a Previously Saved File.

1. Start LTspice.
2. Press ctrl-O. You will hear, Open an existing file dialog. File name edit combo.
3. Press tab once. You will hear, Files of type, combo box. Schematics (*.asc). To change the selection use the arrow keys.
4. Press down arrow twice. You will hear, Netlists (*.cir, *.net, *.sp).
5. Press enter.
6. The folder LTspiceXVII will already be selected in the tree view. Move to the Shell folder view, explorer pain. Items view,
7. Press Down arrow. The first two items you will hear named are folders with the names examples and lib. After this you will hear the listing of file names. It is likely there is only one.
8. When you find the one you are looking for, press enter. In this case the name will be lesson 1.cir.
The netlist is now open in the LTspice editor. Review it. Even though this circuit has only losses the term gain is universally applied to the ratio of output to input. An amplifier may have gain in part of the frequency spectrum and loss in another part. Rather than get all tangled up with gain here and loss there the whole thing is called gain.

If you were playing with the netlist outside of these lessons, strongly encouraged, you may have changed several things. So here is the original list.

* Single section, (first order) RC filter
*
V1 0 n1 AC1 ; 1 volt AC generator.
R1 n1 n2 1k ; horizontal resistor.
C1 n2 0 .15uf ; Vertical capacitor.
.ac dec 3 1 1Meg ; plot from 1 hz to 1 Mhz.
.end

Don't forget to save it.

Note that the value of V1 is set to AC 1 with a space between AC and 1. This sets the generator output to 1 volt AC.

# IMPORTANT NOTICE.

The value of 1 volt is not RMS but peak. If you ever need an RMS value you will have to make the calculation. For 1 volt RMS set the value to 1.414213562. Everybody who does spice seems to go wild with significant digits. In reality 1.414 would be quite accurate enough.

In the spice directive dec tells spice to do a logarithmic plot in decades. The number after dec is the number of points per decade. The sighted set this number to 100. However the text output of the data generates a line of values for each point. You don't have time enough to read all 600 points. 3 is a much more realistic number. You can always increase it a little if you feel you need the accuracy but 3 points per decade is enough to give you the sense of what the frequency response is doing.

The next two numbers are the low frequency limit and the high frequency limit respectively. You could plot it from 1 micro hertz to one terra hertz if you wanted to but I think it would be nothing more than a waste of time.

## A new Circuit.

After you become comfortable with netlists you can add components to an existing netlist and get it right on the first try. I will leave it up to you whether you add to the existing list or start from scratch. I'm going to give you a verbal description and your homework assignment is to turn it into a netlist.

## Verbal Description.

On the left is a generator. The bottom end is connected to ground. The value is 1 volt peak AC. The top end connects to one end of a 1 k ohm resistor. The other end of the resistor connects to one end of a 0.15 u f capacitor. The other side of the capacitor is grounded. The junction of the resistor and capacitor connects to one end of a second resistor which has a value of 10 k ohms. The other end of the second resistor connects to a second capacitor. The other capacitor connection is grounded. The value of the capacitor is 0.015 u f. The junction of the second resistor and second capacitor connect to one end of a third resistor 100 k ohm. The other end of the third resistor connects to a third capacitor. The other end of the capacitor is grounded. The value is 0.0015 u f. The junction of the third resistor and third capacitor is the output of the circuit. End verbal description.

Solution to last week's homework assignment.

* Three section, (third order) RC filter
*
V1 0 n1 AC1 ; 1 volt AC generator.
R1 n1 n2 1k ; horizontal resistor.
C1 n2 0 .15uf ; Vertical capacitor.
R2 n2 n3 10k ; second horizontal resistor.
C2 n3 0 0.015uf ; Second Vertical capacitor.
R3 n3 n4 100k ; third horizontal resistor.
C3 n4 0 0.0015uf ; Third vertical capacitor.
.ac dec 3 1 1Meg ; plot from 1 hz to 1 Mhz.
.end

I am assuming that you know how to insert a netlist into LTspice, run the simulation, and get the readout in a text file. But you have to think about each step and likely refer to the written procedure. The purpose of all this repetition is to get the procedure down so you don't have to think about it as much and can expend your energy on writing a correct netlist and interpreting the results.

I'm sure you noticed that I skipped the two section filter and went right to the 3 section. There is nothing to keep you from doing the 2 section if you want to. Just leave off the last section of the 3 section filter.

## Simple RLC Band Pass Filter.

Verbal Description.

On the left is an AC generator labeled V1. Its output is 1 volt peak. The negative end of the generator is grounded. The positive end connects to one end of R1, a 50 ohm resistor. The other end of R1 connects to one end of C1, a 79.5 pf capacitor. The other end of C1 connects to one end of L1, a 1.99 m h inductor. The other end of L1 connects to one end of R2, another 50 ohm resistor. The other end of R2 is grounded. The junction of L1 and R2 is labeled out and is the output of the circuit. End verbal description.

How can an AC generator have positive and negative ends?

This is a question that will come up repeatedly with LTspice so it must be delt with. In general, although not true in every last case, the positive terminal of a generator is where the positive half of the sine wave comes out first. To put it more precisely, if the negative terminal is grounded and the signal at the positive terminal is observed the sine wave will be zero at time = zero and will rise in the positive direction first before going negative on the second half of the cycle. If the positive terminal of the generator is grounded and the signal at the negative terminal is observed the sine wave will be zero at time = zero and go negative on the first half cycle before going positive on the second half. In other words reversing the connections to the generator reverses the phase of the signal as you might expect.

I now urge you to try to write the netlist before reading the one that is given below. The one thing you will need a little help with is the ".ac" directive. The octave scan is best for band pass filters. The filter is resonant to 400 kHz so the frequency scan goes from 200 kHz to 800 kHz. That's two octaves. For the number of data points per octave I recommend 64. I know that seems like a lot but it's the only way to get a meaningful look at the area around resonance where the attenuation changes rapidly. After you get the data you should look at the points around 400 kHz and also the end points around 200 and 800 kHz. So your spice directive will look like this.
.ac oct 64 200kHz 800kHz
Remember, no spaces between the numbers and kHz. Also remember you can experiment with different numbers of points.

Netlist from Verbal description.

* C:\Users\Max\AA Updated Regularly\LTspiceXVII\RLC BP Filter.asc V1 0 N1 AC 1 ; 1 volt peak. R1 N1 N2 50 ; Generator resistance. C1 N2 N3 79.5pf ; Capacitor resonates with L1 N3 N4 1.99mh ; inductor at 400 kHz. R2 N4 0 50 ; Load resistance. .ac oct 64 200kHz 800kHz ; Octave scan from 200 kHz to 800 kHz with 64 points per octave. .end

## A More Complex Band Pass Filter.

Verbal Description.

On the left is a generator, V1 which has an output voltage of 1 volt peak. The negative side of V1 is grounded. The positive end connects to one end of R1, 364.5 ohms. The other end of R1 connects to a point we will call node 2. A capacitor C1, 43.63 nf connects from node 2 to ground. An inductor L1, 3.548 u h connects from node 2 to ground. A capacitor C2, 1.035 nf connects from node 2 to node 3. A capacitor C3, 42.59 nf connects from node 3 to ground. An inductor l2, 3.548 u h connects from node 3 to ground. A capacitor c4, 1.035 nf connects from node 3 to out. A capacitor C5, 43.63 nf connects from out to ground. An inductor L3, 3.548 u h connects from out to ground. A resistor R2, 364.5 ohms connects from out to ground. End verbal description.

You will note that my verbal descriptions have been influenced by netlists. Well, if it makes a description easier to understand, why not. You will also note that the node I could have numbered node 4 was instead given a name, out. LTspice doesn't care if a node has a number or a name as long as it is unique. In this case out reminds us that this is the output point of the filter.

The ".ac" directive will be exactly the same as for the previous filter.

This filter would not work in reality. The inductors are too small and the capacitors too large to have very high Q at 400 kHz. Low Q means more losses and a wider bandwidth than the simulation predicts. So don't bother building this filter to see how the simulation compares with reality. This filter was designed using a program called AADE Filter Design and Analysis. But don't waste your time looking for it. The site where I got it is long gone. I may still have the installer which I will send to individuals who ask for it. That is, if I do indeed still have it.

Netlist from Verbal description.

* C:\Users\Max\AA Updated Regularly\LTspiceXVII\Three resonator LC BP Filter.asc V1 0 N1 AC 1 ; 1 volt peak. R1 n1 n2 364.5 ; Generator resistance. C1 n2 0 43.63nf ; Capacitor resonates with L1 n2 0 3.548uh ; inductor at 400 kHz. C2 n2 n3 1.035nf ; Coupling capacitor. C3 n3 0 42.59nf ; C3 tunes L2 L2 n3 0 3.548uh ' to 400 kHz. C4 n3 out 1.035nf ; coupling. C5 out 0 43.63nf : C5 tunes L3 L3 out 0 3.548uh ; to 400 kHz. R2 out 0 364.5 ; Load. .ac oct 64 200kHz 800kHz ; Octave scan from 200 kHz to 800 kHz with 64 points per octave. .end

You will note there are 3 frequencies where the response is -6 dB rather than just 1 as with the other filter. This one has a flat topped response which is very good for AM reception as well as narrow band FM. Radio engineers talk about the -6 dB down points to specify the bandwidth of a filter like this. Since the center is already down by 6 dB the bandwidth would be found at the -12 dB points. The number of data points would have to be increased further to accurately determine these points on either filter. Note the asymmetry of the filter skirts. This is caused by the two series capacitors which when combined with the three parallel inductors give a total of 5 roll offs on the low side of resonance as opposed to the three parallel capacitors which only give 3 roll offs on the high side.

If you can honestly checkoff each item on the list under the heading "What you will learn in lesson 2", you can go on to lesson 3, assuming I have written it by then.