Home.


Learning LT Spice.
Lesson 6

Table of Contents.

Lesson 1: Creating a net list and a Simple Simulation.
Lesson 2: Introduction to and applications of frequency analysis.
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. This page.
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 6
Using stepping to do frequency response of a tone control.

What you will learn in Lesson Six. How to:

  1. Make a Sub Circuit Netlist and Call it from a Circuit Netlist.
  2. Setup a Library of Often Used Sub Circuit Blocks.
  3. Setup Stepping of a Simulated Potentiometer.
  4. Apply the "Pot" to a tone control circuit.
  5. Build a complete tone control using the supplied modules.
  6. Setup Bass Only Cut and Boost.
  7. Setup Treble Only Cut and Boost.
  8. Setup Reverse Cut and Boost between Bass and Treble.
  9. Adjust Corner Frequencies.
  10. Adjust the Amount of Boost and Cut.
  11. Measure the Input Impedance of the RCC (Response Control Circuit).
  12. Measure the Output Impedance of the Amplifiers.

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.

Making a Sub Circuit Netlist and Calling it from a Circuit Netlist.

The above heading gives it in reverse order. We will create the netlist first followed by the sub circuit netlist. First the verbal description of the mother circuit.

On the left is a generator. It is labeled "SINE(0 170 60)". The negative end is grounded and the positive end connects to the anode of a diode.
The cathode of the diode connects to a point labeled "In".
A 1 k ohm resistor has one end connected to a point labeled "Out". The other end is grounded.
A point labeled G is grounded. End of verbal description.

Constructing the netlist.

We take it one component at a time and remember the syntax.

Review of the Syntax.

I think it would be helpful to scan the line below with the left and right arrow keys. In spice syntax spaces are important.

A B1 B2 B3 etc. C ; D.

A. This is the Component Code consisting of one letter followed by a number. No embedded spaces.
A very short list of the commonly used letters are listed below.
C--capacitor.
D--Diode.
R--Resistor.
V--Voltage source.
X--Sub Circuit. X may be followed by another letter such as U for a vacuum tube.
I have cut the list down to those used in this lesson.

B1, B2, etc. The list of nodes is as long as it needs to be for the particular component. For simple parts such as resistors, capacitors, and inductors the list is 2 nodes long and the order doesn't matter except for polarized capacitors where the order is positive, negative. For diodes the order does matter and it is anode cathode. For voltage and current sources the order is positive, negative.

C. Value. For capacitors, resistors and inductors, the value is what you would expect, the number of farads, ohms, or henrys. For semiconductor devices the value is the type number such as 1N4148 or 2N3904.

D. A comment must begin with a semicolon. They are optional but you should always include them.

And now, back to our story.

It's always best to begin at the beginning. Here's the first line.

* C:\Users\Your_Name\Documents\LTspiceXVII\Rect_and_Load.cir

What comes next is fairly straight forward. If I had asked you to, you probably could have come up with it on your own.

V1 n1 0 SINE(0 170 60) ; 120.2 volts RMS 60 Hz.
D1 n1 In D ; Generic diode model.
R1 Out 0 1k ; Load resistor.

But there needs to be more and it is harder because it is not intuitive. For example telling spice where to find the diode model and how to use it.

.model D D To me this is magic. I have no idea of the how or why. Just put it in. It works for me, it should work for you.

.lib C:\Users\Your_Name\Documents\LTspiceXVII\lib\cmp\standard.dio

The path in this line leads to a file that contains diode models. If you allowed LTspice to set up the files and folders as it wanted to, they all should be in the right place. Check what comes between \User\ and Documents\ to be sure what is in this line is the same as what's in your computer. If it isn't the program won't work.

Next comes the spice directive.

.tran 0 500ms 0 1ms

That tells spice to run a transient analysis from 0 to 1/2 second and start taking data at 0 with a point every millisecond. The last line is always .end. So now let's put it all together.

* C:\Users\Your_Name\Documents\LTspiceXVII\Rect_and_Load.cir
V1 n1 0 SINE(0 170 60) ; 120.2 volts RMS 60 Hz.
D1 n1 In D ; Generic diode model.
R1 Out 0 1k ; Load resistor.
.model D D ; Magic.
.lib C:\Users\Your_Name\Documents\LTspiceXVII\lib\cmp\standard.dio ; Path to diode model file.
.tran 0 500ms 0 1ms ; Run transient analysis from 0 to 1/2 second and start taking data at 0 with a point every millisecond.
.end.

Save it under the file name "Rect_and_Load.cir".

Forgotten how to save a netlist? I don't blame you. Sometimes I still have to look it up myself. Shift H back up the page until you find the heading "Things that are very hard to remember." The first link under that heading is the one you want. It gives the procedure for starting and saving a netlist. Be sure to hold the control key while pressing enter on the link. That will cause it to open in a new window and you can use control tab to switch between it and this page. There is a shorter way.

Quicker, shorter, and easier, if you have the right software.

If you have a word processor or text processor that will write plain text files without messing them up you can bypass the 17 step procedure and just type or paste in the text and save it. This is possible because netlist files are always plain text.

Of the ones on my computer the easiest one is Notepad. Word pad is no good. It inserts line breaks where it feels like it and totally screws up a netlist. Use it only if you have the patients to do a complete edit job on the pasted text. If you type it in and remember to press the enter key at the end of each line it will probably be alright. But remember, its default file is rtf. Be sure to save the file as a txt file. Not everyone has MS word. It will wright text files but setting it up can be as much of a handful as the procedure involving LTspice. I know there are lots of other processors around but I don't have any of them. If you use one you are on your own.

Procedure.
1. Open notepad or the processor of your choice.
2. Type the netlist pressing enter at the end of each line
Or, paste the netlist.
3. From the menu call up the save as command.
4. The filename box will contain "*.txt". Delete this.
5. Save the netlist under the proscribed name giving it a cir or sub extension. The extension you type will override the default.

Running files you created outside of LTspice.

First of all, you don't run .sub files. They must be called from a .cir file. There are two ways to run a .cir file.
1. Open Windows Explorer, locate the file in the LTspiceXVII directory, select it and press enter.
2. Open LTspice and press ctrl-o.
Change the file type to cir.
Find your file and press enter on it.

After either one of the two procedures above, go to the second part of the procedure from lesson one which is titled "Running the simulation and viewing the results." There is no way around this 10 step procedure.

The Sub Circuit.

You wouldn't really use a sub circuit this simple. The purpose of this lesson is to illustrate how to make and use a sub circuit. For example suppose that you wanted to use one of the op amps that we all have been playing with for the last 40 years or so. Such as the 741, a workhorse among op amps. The LTspice library doesn't have any of the familiar op amp numbers because none of them are made by Linear Technologies. If you want to use any of these you will have to make or download your own set of sub circuits and keep them in your personal library.

For the greatest simplicity the sub circuit we are using hear contains one resistor and one capacitor. Its name is "Filter".

Verbal Description of "Filter".

The sub circuit has three pin connections. Think of this sub circuit as a plug in module. It has pins which must be referred to in the proper order so when it is "plugged" into the "socket" it will work as you intend. The three pins are called out in the directive ".subckt" Input, Ground, and Output. There is a resistor, R1, 250 ohms, connected between input and output. There is a capacitor, C1, 100 u f connected between output and ground. And that is all there is to it.

There are a couple of important rules about sub circuits. Grounds are not allowed within a sub circuit. If there are elements which need to be grounded one of the pins must connect to ground when the sub circuit is "plugged in". Sources are also not allowed. Again if an element requires DC bias or an AC excitation signal it must be supplied by the motherboard. Don't be concerned about use of the word "ground". A loan character 0 is the only thing spice will recognize as ground. The word "ground" is just another node name to it. Actually you will note in the ".subckt" directive the node names have been shortened a bit to in, g, and out. * C:\Users\Your_Name\Documents\LTspiceXVII\Filter.sub .subckt Filter In G Out R1 Out In 250 ; Filter resistor. C1 Out G 100f ; Filter capacitor. .ends

This sub circuit netlist should be saved under the file name "Filter.sub".

One more thing.

We need to go back to the main circuit and insert two lines that inform spice that there is a sub circuit. One tells spice the connections and name of the sub circuit and the other tells spice to include the sub circuit in the netlist. They look like this.

X1 in 0 out Filter ; Connect the filter sub circuit into the circuit just like any other part.
.inc Filter.sub ; Make the sub circuit available so spice can use it the same as any other electronic component.

Don't worry that the include line comes after the "connect it in" line. Although I haven't mentioned it up until now, the order of lines in a netlist makes no difference. Tradition is why you see all of the spice directives at the end. Spice scans the file twice before beginning execution. With the added lines our netlist now looks like this.

* C:\Users\Your_Name\Documents\LTspiceXVII\Rect_and_Load.cir
V1 n1 0 SINE(0 170 60) ; 120.2 volts RMS 60 Hz.
D1 n1 In D ; Generic diode model.
R1 Out 0 1k ; Load resistor.
X1 In 0 Out Filter ; The filter acts just like any other part.
.model D D ; Magic.
.lib C:\Users\Your_Name\Documents\LTspiceXVII\lib\cmp\standard.dio ; Path to diode model file.
.inc Filter.sub ; Include Filter.sub as part of the netlist.
.tran 0 500ms 0 1ms ; Run transient analysis from 0 to 1/2 second and start taking data at 0 with a point every millisecond.
.end.

This one should be saved under the file name "Rect_and_Load.cir".
In order for sub circuit files to be found they MUST be in the same directory as the circuit file that is calling them.

Saving and running the files.

Refer to the procedure given in lesson one to save and run a circuit file.

If this is your second or later time to run through this procedure you will get a warning that the file already exists. Click yes. This action will result in the creation of a file named "rect_and_load.txt". Open it with your favorite word processor. Don't try to read the whole thing. It's 965 lines long. Skim through it to get the idea of the trend.

This is a situation you will encounter frequently when using LTspice. As you get more practice at skimming a file it will go faster. If you want more practice you can insert the filter subcircuit again. Change the line that begins with X1 to read "X1 in 0 mid filter" and add the following line. "X2 mid 0 out filter". Be sure to type X2 for the second instance of the filter. You don't need to type another include line. One is enough.

You have it easy when it comes to inserting subcircuits. The sighted have to type control C then use the mouse to draw a box around the circuit and then switch pages and position the subcircuit so the nodes connect, then click.

Starting your personal library of useful sub circuits.

If you become a regular user of LTspice you will build up a library of circuits that you use again and again. For example, if you are an audio person, you will use triode amplifiers, pentode amplifiers, tone controls, phase inverters, etc, etc. If you are a radio person you will use variable frequency tuned amplifiers, variable frequency oscillators, mixers, fixed frequency tuned amplifiers, etc, etc. Below you will find a link to a file that contains several useful audio circuits. They will be listed below the link. Each entry in the file consists of a verbal description of the circuit followed by a sub circuit spice netlist which can be called from any circuit netlist. A circuit file can consist of calls to many different sub circuits and/or the same sub circuit called over and over.

Hold the control key while pressing enter on this link.

It will open in a new window to make it easy to refer to it or copy from it and paste to another type of file. Use ctrl-TAB to switch between the sub circuits page and the page you are now reading.

List of sub circuits.
File Name. Description.
MM-2-B-100k.sub The passive part of a 2 band active tone control with 100 k ohm pots.
MM-2-B-250k.sub The passive part of a 2 band active tone control with 250 k ohm pots.
MM-3-B-100k.sub The passive part of a 3 band active tone control with 100 k ohm pots.
MM-3-B-500k.sub The passive part of a 3 band active tone control with 500 k ohm pots.
MM-C-F.sub Cathode Follower for driving any of the above circuits.
MM-T-T-OP-AMP.sub Tube op amp with triode amplifier and triode cathode follower.
MM-T-OP-AMP.sub Tube op amp with single triode amplifier.
MM-P-T-OP-AMP.sub Tube op amp with pentode amplifier and triode cathode follower.
MM-G-B.sub Low distortion gain block giving 30 dB of gain.

I have enhanced the verbal descriptions a bit for this occasion. They have been cut into bite sized lines to make them easier to digest. All you have to do is down arrow through the text. Your screen reader will read one line at a time.

Getting the netlists from this page.

Go to the netlist you want and memorize its name. For example the pentode op amp is called. MM-P-T-OP-AMP.sub.
Select only the netlist and press ctrl-c.
Open LTspice, type ctrl-N, and go to the files menu and select save as.
In the file name bbox type the file name you memorized in the above step.
Save the file.
After opening the independent netlist press ctrl-v to paste the netlist into the spice netlist editor.
Now follow the rest of the procedure that you performed above for saving the netlist.

If you want to use note pad or some other text processor to save a netlist here is where to start.
Go to the netlist you want and memorize its name. For example the pentode op amp is called. MM-P-T-OP-AMP.sub.
Select only the netlist and press ctrl-c.
Open note pad and press ctrl-V to paste the netlist.
Go to save as and save the netlist under its intended name.

Grouping the Files Together.

I began each of the file names with the same letter thinking they would all be grouped together. But it appears the windows alphabetizer looks beyond the underline or dash character and orders them by the next letter it finds. So I have switched to a double M to force them to gather in a crowd. I don't know of any English words that begin with a double M. As you can see I have created a sub directory of LTspiceXVII, named Audio. As I grow I will create others to make it easier to find diagrams dealing with a specific subject. How you manage your computer is up to you.

Simulating a Potentiometer.

LTspice didn't come with a potentiometer, pot to you and me. * While preparing this particular lesson I have learned enough to make a pot model and I may do that if I can ever find the time. For now I'll show you how I model a pot with two resistors that have parametric values. That's baffle gab for one resistor with a value that depends on the value of a variable and a second resistor with a value that depends on the value of the first by an equation.

* If you open the list of components you will see a potentiometer in the list. Only problem is that when you try to use it you get the error message model not found, or words to that effect. So I have improvised.

Let's call the top (clockwise) end of the pot R1 and the bottom (counter clockwise) end of the pot R2. The two resistors must always add up to equal the value of the pot. The variable that we want to set the position of the pot is Pot position Pp for short. This variable can take on any value from zero to 1 where 0 represents fully counter clockwise and 1 represents fully clockwise. Now there's a problem with that right off the bat because spice will not allow a resistor to have a value of zero. 1 ohm, 1 milli ohm, even 1 pico ohm but never zero.

The way I started out doing this was to set the pot value at 2 ohms greater than the schematic value and stepping the value of pot position from 1 ohm to the pot value plus 1. The resistor representing the counter clockwise side of the pot is labeled pot position and the resistor representing the clockwise side of the pot is labeled pot value minus pot position. So the clockwise end can go from 1 ohm to pot value plus 1 and the clockwise end can go from pot value plus 1 to 1 ohm. This was awkward because I had to type the pot value as either 500002 or 500.002 k for a 500 k ohm pot. By working a bit of algebra an using the Y intercept form of the straight line equation Y = mX + B, I was able to call a 500 k ohm pot a 500 k ohm pot and step the pot position from 0 to 1. You only need to change a couple of parameter directives to step a control forward or backward or not at all.

An Example.

Let us start with a 100 volt generator and a linear 100 k ohm pot connected across it to deliver an adjustable voltage to the output. The proper way to do this would be with a transient analysis but the output of this type is harder to control and makes for many more lines of text numbers to be read. Instead I will treat it as if it were a frequency response analysis. The generator will be 100 volts AC and the frequency will cover a single octave with one point per octave.

Verbal Description.

A 100 volt AC generator has its negative end connected to ground. The positive end of the generator is connected to the top of a 100 k ohm pot which is represented by two resistors, R1 and R2. One end of R1 goes to the positive of the generator. The other end goes to the point which corresponds to the wiper of the pot. One end of R2 connects to this same point. The other end of R2 is grounded.
R1=Pp*(2-Pv)+Pv-1
R2=Pp*(Pv-2)+1
Where Pp is the pot position from 0 to 1, and Pv is the pot value, in this case 100 k ohms.
End verbal description.

Netlist.

* Circuit shows how a two resistor pot simulation works.
V1 1 0 AC 100 ; 100 volt AC source.
R1 1 out {Pp*(2-Pv)+Pv-1} ; Equations calculate values of R1 and R2
R2 out 0 {Pp*(Pv-2)+1} ; based on Pv and Pp.
.param Pv=100k ; Set the pot value.
.step param Pp 0 1 0.1 ; Set linear steps 0 to 1 in 0.1 steps.
.ac oct 1 1k 2k ; Put output values on the graph.
.end

Copy, paste, save, and run, as you have done before. But stop after you select "Export data as text" from the files menu.
After you select V(out) tab around the dialog box until you hear "Format: (Db, deg)". Press down arrow and you will hear "Cartesian re, im". Tab to OK and press enter.

The values given in the text file are now the actual voltages for the real part. The imaginary part is zero for all frequency values. Remember that the simulated pot stops 1 ohm short of each end. That's why the number at the top of the table is 1.0 times ten to the minus 3. . The last set of numbers in the table which should be 100.0 volts are not, for the same reason.

Applying the "Pot" to a tone control circuit.

Two band response control circuit with 100 k ohm pots.

Bass branch.
The left side of the RCC, response control circuit goes to a 22 k ohm resistor.
The other end of the 22 k goes to the clockwise end of a 100 k ohm pot, bass control.
There is a 0.01 u f cap connected from one end of the pot to the other.
The wiper of the pot goes to one end of a 300 k ohm res. The other end goes to the center of the circuit..
The counter clockwise end of the bass pot goes to one end of another 22 k ohm resistor.
The other end of the resistor goes to the right side of the circuit.

Treble branch.
The left side of the response control circuit also goes to a 680 pf cap.
The other end of the cap goes to the clockwise end of a 100 k ohm pot, treble control.
The wiper of the pot goes to one end of a 150 k ohm resistor. The other end of the resistor goes to the center of the circuit.
The counter clockwise end of the treble pot goes to another 680 p f capacitor.
The other end of the cap goes to the right side of the RCC, (Response control circuit).
End verbal description.

Two band response control circuit with pots replaced by variable resistors..

Bass branch.
The left side of the RCC, response control circuit goes to a 22 k ohm resistor.
The other end of the 22 k goes to R2, a resistor that varies according to the formula
R2 = BPp * (2 - Pv) + Pv - 1
The other end of R2 goes to R3. It varies according to the formula,
R3 = BPp * (Pv - 2) + 1
Where BPp is the bass pot position which varies from 0 to 1.
Pv is the pot value which is a constant.
The junction of R2 and R3 goes to one end of a 300 k ohm res. The other end goes to the center of the circuit..
There is a 0.01 u f cap connected from the outer end of R2 to the outer end of R3.
The outer ends of R2 and R3 are the ends away from the junction of the two resistors.
The outer end of R3 goes to one end of another 22 k ohm resistor.
The other end of the resistor goes to the right side of the circuit.

Treble branch.
The left side of the response control circuit also goes to a 680 pf cap.
The other end of the cap goes to one end of R6, a resistor that varies according to the formula
R6 = TPp * (2 - Pv) + Pv - 1
The other end of R6 goes to R7, another resistor that varies by the formula,
R7 = TPp * (Pv - 2) + 1.
Where TPp is the treble pot position which varies from 0 to 1.
Pv is the pot value which is a constant.
The junction of R6 and R7 goes to one end of a 150 k ohm resistor. The other end of the resistor goes to the center of the circuit.
The other end of R7 goes to another 680 p f capacitor.
The other end of the cap goes to the right side of the RCC, (Response control circuit).
End verbal description.

Compare the two verbal descriptions. You will see that in the second one The pots have been replaced by two resistors each. Spice directives such as .step and .param permit us to set variable values and make them do what we want. Immediately below you will find the netlist of the sub circuit for the 2 band 100 k ohm pots response control circuit and below that a runnable netlist that will call the RCC along with the amplifiers to make it work as a tone control.

* C:\Users\Your Name\Documents\LTspiceXVII\Audio\MM-2-B-100K.sub
* Two band RCC (Response Control Circuit) with 100 k ohm pots.
.subckt MM-2-B-100K L C R ; Left, Center, and Right, instead of input, grid, and output.
* Bass branch.
R1 N001 L 22k ; Bass shelving resistor.
R2 N002 N001 {BPp*(2-Pv)+Pv-1} ; CW side of bass pot. Pv = pot value, BPp = bass pot position.
R3 N003 N002 {BPp*(Pv-2)+1} ; CCW side of bass pot.
C1 N003 N001 .01u ; Bass corner frequency.
R4 C N002 300k ; Pot loading limiting resistor.
R5 R N003 22k ; Other bass shelving resistor.
* Treble branch.
C2 N004 L 680p ; Treble corner frequency.
R6 N002 N001 {TPp*(2-Pv)+Pv-1} ; CW side of treble pot. Pv = pot value, TPp = treble pot position.
R7 N003 N002 {TPp*(Pv-2)+1} ; CCW side of treble pot.
R8 N005 C 150k ; Pot loading limiting resistor.
C3 R N006 680p ; Treble corner frequency.
.ends

Building a Complete Runnable Tone Control Circuit.

You should save the below netlist as a .cir file in the folder where you are keeping all of the files that begin with '"MM".
There are two ways to do this which you should know by now.

* C:\Users\Your Name\Documents\LTspiceXVII\Audio\MM_T-U-G_2-B-100K_P-T-OA.cir
V1 buf_in 0 AC 1 ; 1 volt AC generator.
V2 B-plus 0 250v ; 250 VDC B+ supply.
X1 buf_in B-plus 0 buf-rcc MM-T-U-G ; Call True Unity Gain buffer.
X2 buf-rcc grid out MM-2-B-100k ; Call Response Control Circuit.
X3 grid B-plus 0 out MM-P-T-OP-AMP ; Call Amplifier for Active Tone Control.
.ac dec 1 10hz 100khz ; Sets 3 points per decade, frequency range from 10 Hz to 100 kHz.
.param Pv=100k ; Set pot values.
.step param Pp 0 1 0.25 ; Step pot position from 0 to 1 with 0.25 increment. 5 steps total.
.param BPp=Pp ; Bass pot position = pot position.
.param TPp=Pp ; Treble pot position = pot position. Bass and treble are stepped in unison.
.inc MM-T-U-G.sub ; Include sub circuit for input unity gain buffer.
.inc MM-2-B-100k.sub ; Include 2 band RCC using 100 k ohm pots.
.inc MM-P-T-OP-AMP.sub ; Include sub circuit of tube "op amp" using
* a pentode amplifier and triode cathode follower.
.end

After you type in, or copy and paste, the above netlist be sure to save it under the name "MM_T-U-G_2-B-100K_P-T-OA.cir".

Note that two lines of code are required to invoke a sub circuit. One for the X# line that tells spice how to connect the nodes, and the .inc directive that tells spice to include the file containing the sub circuit which is often called a model.

While preparing this lesson I learned how to make a model and I thought about creating a model for the pot. But I ran into the problem of how to set different parameters for each time the model is called. There must be a way. It would be quite awkward to have different models for almost identical functions. For example in this context Three different models, one for bass, another for midrange, and a third for treble. In order to be able to control each pot individually the Pp (pot position) parameter Must be individually settable for each time the same pot model is called. I'll dig it out in time but time is what it will take. That requires patients on your part. If you don't understand individual controls, you will after the next section.

Setting up Bass Only Cut and Boost.

Open LTspice and then open the file "MM-T-U-G_2-B-100K_P-T-OA.ci".
Press ctrl-R.
Follow the rest of the lesson 1 procedure for running and getting data.

Setting up a bass only cut and boost.

Do not save the file again after you make the changes below.

You want to keep the file in its original form.

Change the line ".param TPp=Pp".
To read ".param TPp=0.5"
Run and read.
Change the line that now reads ".param TPp=0.5"
Back to ".param TPp=Pp".
Change the line ".param BPp=Pp".
To ".param BPp=0.5"
Run and read.

Setting up reverse cut and boost.

At this point you might want to close the current simulation without saving it as follows.
Press control F4.
When asked if you want to save changes select No and press enter.
Then press ctrl-o and select the same file to reopen it.
You should now have the file in its original form.

You can decide which one, bass or treble, you want to go in reverse. If you are someone who has trouble making decisions, Modify the treble line.
The treble line now reads ".param TPp=Pp".
Change it to ".param TPp=1-Pp".
Run and read.

Adjusting corner frequencies.

In the following you need to make changes to the sub circuit. If you don't have it loaded you need to do so now.
Load the file "MM-2-B-100K.sub".
There will be three windows open after you load the sub file. Two of them will be announced as the mother file.
When you press ctrl-tab the focus will be moved to the next window and its name will be announced. The focus must be on the mother file when you press ctrl-R or you will get an error message.
The file name is long but you can recognize it because the extension is Cir.
If focus is on the sub file and you press control tab focus will move to the cir file.
Pressing control tab again will put focus on the graph window. Focus needs to be on that one to export data to a text file.
The third time you press control tab focus will be back on the sub file. Its name will be announced.
This is how to keep track of where focus is.

Run the circuit to be sure you are starting with a healthy simulation. I had left mine set to bass only.

Change C1 to 0.03uf.
Run and read. Note what happens.

Now change C2 and C3 to 220 pf. Run and read. Increasing the capacitance will lower the frequency while decreasing capacitance will increase the frequency. This applies to both bass and treble.

Change C1 back to 0.01uf and C2 and C3 to 680 pf.

Adjusting the amount of cut and boost.

Change R4 to 1200k. (1.2Meg). Type it either way, spice doesn't care. Run and read.

Hmmm. That didn't do what we thought it would, did it. Changing that resistor by a factor of 4 should have changed the amount of cut and boost to about 2 dB.

Let's put R4 back to 300 k and change R1 and R5 to 88 k ohms. Run it. Again, not what we expected.
Find a value for C1 that will make the curves look right.

Alright, go back to 22 k ohms for R1 and R5 and 0.01uf for C1.
Change R1 and R5 to 11 k ohms. Run it.

We cut resistance by a factor of 2 so let's increase the capacitance of C1 by the same factor. Run it. Not quite the same, is it. I got a better set of curves with 10 k ohm resistors and a 0.018 uf cap. Tone controls don't seem to behave logically do they. Well, that's because we are oversimplifying them. To do it right we would have to do a complex or s parameter analysis. Just the thought of that gives me a headache. The only way to avoid an aching head is to use the time tested method of cut and try. It is especially easy now that we have a tool that reduces the number of times that we need to use the diagonal cutters and soldering iron.

Measuring the Input Impedance of a Tone Circuit.

Now you can decide whether to go back to the original values or stick with what you have. You will likely want to run the input impedance with the values you have now as well as the original ones. Don't forget you still have the original file which hasn't changed. You can look up the original values in a minute.

Close the MM-2-B-100k..sub window by pressing control F4.

Now you have two windows open and your screen reader announces each of them by the same name. The test is to press alt F.
Press down arrow until you hear print monochrome. Then press down arrow one more time.
If you hear export data as text, focus is on the graph window which is where you want it.
Press escape twice then press control F4.
If in the above focus was not on the graph window, Press escape twice then control tab.
Test it again by pressing alt F. After you hear export data as text, press escape twice then control F4.
You are now down to one window open. Save it under a different name. I suggest input impedance.cir.

Near the top of the file locate the line that begins X1. The entire line will read,
X1 buf_in B-plus 0 buf-rcc MM-T-U-G ; Call True Unity Gain buffer.
Delete it.
In the blank line left behind by the above deletion, type the following line.
"R1 buf_in Buf-rcc 1 ; Current sensing resistor."
Now look at but do not delete the line beginning with V1.
The first node that the generator connects to is buf_in. That is also the name of the first node that the 1 ohm resistor connects to.
Now look at but do not delete the line beginning with X2.
The first node that X2 connects to is buf-rcc. The second node in the R1 line connects to that same node.
So, R1 connects between the generator V1 and the input node to the passive part of the tone control.
Save the file again to preserve the latest changes.
Now run it but wait for special instructions for exporting as text.
Switch the focus back to the graph window and press the star key on the number pad. This is the equivalent of right clicking the mouse.
In the context menu select Add Traces.
When the dialog box opens the typing cursor will be in the Expressions box. Type the following.
V(buf-rcc)/I(R1)
Select the OK button.
Now press alt F and select export data as text.
In the pop up dialog box you need to change the format from polar to Cartesian. Now open notepad and open the file. It will have the file name you saved the netlist under. You will see that there are only 5 frequencies listed for each setting of the Pp pot position.
This results from placing the number 1 after the dec entry in the ac directive.
If you want more data you can always change the number of data points per decade. Nothing is cast in stone.

Playtime.

Now that you know how to do it you can patch together any combination of amplifiers and response control circuits to see how well or poorly they work. You also know how to measure the input impedance of the circuit so you can examine the load each circuit places on the driving stage. Have fun.

Measuring the output impedance of an amplifier.

You can choose from five different amplifiers to measure their output impedance. I'm going to suggest the worst and the best.

If you are continuing work from the previous section press ctl-F4 to close the project. If you have not saved you will be prompted. THINK. You may not want to save it with the changes you have made. It's your decision not mine or the computer's

If you are returning to work, open LTspice and press ctl-N to start a new schematic.
Select Save As from the menu and name it "output impedance-1.asc".
Go through the procedure until you get to the point where the independent netlist editor is open.
Copy and paste the netlist below.
< h2>The worst Output impedance netlist. * C:\Users\Your Name\Documents\LTspiceXVII\Output Impedance-1.asc V1 P 0 250 ; 250 volt power supply. R1 In 0 1 ; Short input to ground with a 1 ohm resistor. X1 In P 0 Out MM-T-OP-AMP ; Single triode op amp. Input, B+, Ground, Output. R2 Out N1 1 ; Current sense resistor. V2 N1 0 AC 1 ; You really can't do this in real circuits. .ac dec 1 10 100k ; Plot 1 Hz to 1 MHz. .inc MM-T-OP-AMP.sub .end

Run the simulation but stop there.
There are only two windows open this time and the only way to tell them apart is to open the files menu with alt F.
After print monochrome the next item should be export data to text file but don't do it now.
Press the star key on the number pad to right click.
Select add traces.
In the dialog box type V(out)/I(R2). Tab to OK and press enter.
Now you can press alt F and select export data as text file.
That expression you just typed will be highlighted but you need to change the data format.
Tab until you hear format. Press down arrow and you will hear Cartesian re,im.
Tab to OK and press enter.
Read the text file.
Keep the netlist file open for the next exercise.

The Best Output Impedance.

Let's change the file name before we forget to do it.
Press alt F and down arrow to save as. If you get save plot settings press escape twice.
If you had focus in the wrong window press ctrl-tab.
Now try alt F again. This time you should find save as. Press enter.
Use left and right arrows to step through the file name. Change the number 1 to 2.
Tab to OK and press enter.

Edit the netlist as follows.
Change the line that begins with X1 to:
X1 In P 0 Out MM-T-U-G ; True Unity Gain Amp. Input, B+, Ground, Output.
And the line that begins with .inc to: .inc MM-T-U-G.sub
Press ctrl-S to save the changes.
Press ctrl-R to run the simulation.
You shouldn't have to change the V/I expression or select what is plotted. Just export data as text.

Play Time.

Get out your toy tractor with the front loader attachment and dig that sand. You now have all the tools you need to have fun with tone controls from early morning to late at night. Enjoy.

If you come up with something really good, DON'T FORGET TO SAVE THE NETLIST.

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


This page last updated Thursday, May 07, 2020.

Home.