So today we are going to be covering circuit simulation with "LTSpice" and just so you
know "SPICE" stands for Simulation Program With Integrated Circuit Emphasis.
And that's a just a general term for electronic simulation software. There are lots of SPICE
simulators out there and LTSpice is my favorite.
Okay so the first thing we are going to do is Google for LTSpice.
The first link will take us to Linear Technology's web page.
And download LTSpice IV.
Just download the software.
Now you can install it and let's begin the learning process.
Okay once you've got LTSpice installed the first thing to do is go to the toolbar over
here and click new schematic. [Let's build a passive RC low pass filter in LTSpice.]
Now on the toolbar over here we've got our basic components like resistors capacitors
and inductors
and we can start laying some down right now. You can use the mouse's scroll wheel
to zoom in and out.
Okay that is a good size.
CTRL + R to rotate.
and click.
Let's grab a capacitor,
put it down.
And to add a voltage source we have to press F2
which will take us to the advanced component menu. We have got all kinds of things in here:
transistors, LEDs,
current sources, operational amplifiers,
but for now we just want a voltage.
And every single simulation you ever do will always need
a Ground labeled somewhere. So let's put that there.
Next let's wire things up so press F3 to enter the wiring mode.
After you are done with each little wire press ESC otherwise you end up creating
weird wiring that doesn't work.
F3, click, ESC.
F3
click
ESC.
So we have got our generic low pass filter now
so let's add some actual component values.
Right click the capacitor.
Let's make this one microfarad. And you can put in "u" for "µ".
Right click the resistor.
Let's make it a one kilohm resistor.
Now things are going to get interesting when we want to set up our voltage source
because we have a lot of different options in SPICE software.
We could just leave it as a DC value
but since we're doing filters here we want to be looking at AC signals.
So let's go to the advanced menu.
Lots of different options.
For now we are going to do a small signal AC analysis.
And that will allow us to sweep through AC signals of a wide frequency range
and see what happens when you pass them through the filter.
Let's use an amplitude of one volt.
And just leave everything else blank.
Okay now we're almost ready to do our simulation but first we have to go to simulate menu
and edit simulation command.
We have got a lot of options here. Lots of different simulations you can do in SPICE software.
We're going to do AC analysis because that is what we selected earlier
where we had that one volt AC small signal
that we want to sweep through all the different frequencies with.
Now we have to choose how are we going to sweep those frequencies.
We can sweep by octave, decade, linear.
Let's use decade. This is what determines what you see on the horizontal
axis of your bode plot (graph).
Number of points per decade refers to the resolution
in each decade.
And I found that twenty points is perfectly fine and gives a nice smooth curve.
Let's make the start frequency one Hz and for the stop frequency let's make that one megahertz.
Then you get this little box over here and you can just put that down anywhere.
Okay now we're ready to do our simulation.
Simulate...
Run.
Now at first it looks like it didn't work.
But let's go over here
and you can see
you can click on different nodes in the circuit and see
the AC sweep on that node. You can also look at the current going through
any given component.
And if the screen gets too crowded just double click any point and it'll get rid of
all the other ones.
Excellent.
Now you might be wondering why are there two lines. Well, the solid line is the amplitude
of the signal or the magnitude of the signal.
And the dotted line is the phase shift of the signal represented in degrees. Whether
it's lagging the signal or leading the original input signal.
And that becomes more useful in more advanced electrical engineering topics like designing
oscillators, radio frequency design,
high frequency digital design etc.
For now let's just focus on the magnitude of the bode plot because that's what is going
to tell us what the output voltage is at different frequencies and our input voltage of one volt.
So right now in the vertical axis everything is shown in decibels.
But I would prefer to see everything in terms of the absolute voltage. So let's right click,
manual limits, and instead of decibels let's choose a logarithmic scale.
Make the top value two volts and on the bottom we have a tiny tiny value already so we will
just leave it like that.
Great. So you can see that at very low frequencies we have one volt.
And take a look in the lower left corner over here when I am looking at the graph
you can see it's showing you the X and Y values.
As we get into the higher frequencies there is some attenuation.
Now at the Y value of 0.7 volts... let's see if i can get it...
this should be roughly our cutoff frequency.
140 Hz.
Now my calculator says that it's actually 159 Hz
so I was pretty close.
Now we can look at other parts of the curve and see how much filtering there is
at different frequencies.
Let's take a look at ten kHz.
Look at the bottom left corner.
There we go.
So at ten kHz we've got sixteen millivolts out from one volt in. That's a large
amount of attenuation.
So this filter is very good at filtering out ten kHz.
Now if you want to do even more filtering we just need to change the component values over here.
Let's change that capacitor and make it 100 microfarads.
Let's close this and let's run the simulation again.
Click the output node.
Wow! Almost everything gets filtered.
Let's change the vertical axis to volts again. Right click manual limits.
From decibels to logarithmic.
At the top
make it two volts. Leave the bottom one as a tiny number.
You can see that
at ten Hz
we are already down to 185 millivolts.
So this is a very
good low-pass filter.
Okay let's move on to a more interesting example.
Let's close everything here and start a new schematic.
[Click for part 2 of the series! Band pass filters and loading effects are covered.]