Part 1 in a series of LTSPICE tutorial videos.
In this introduction Dave explains what LTSPICE is and how to do the simplest of the SPICE analysis options - basic DC operating point analysis.
Also how to draw basic schematics, display voltages and current on your schematic, and a beginner few traps to avoid.
http://www.eevblog.com/forum/blog/eevblog-516-ltspice-tutorial-dc-operating-point-analysis/'>http://www.eevblog.com/forum/blog/eevblog-516-ltspice-tutorial-dc-operating-point-analysis/
EEVblog Main Web Site:
http://www.eevblog.com
EEVblog Amazon Store:
http://astore.amazon.com/eevblogstore-20
Donations:
http://www.eevblog.com/donations/
Projects:
http://www.eevblog.com/projects/
Electronics Info Wiki:
http://www.eevblog.com/wiki/
In this introduction Dave explains what LTSPICE is and how to do the simplest of the SPICE analysis options - basic DC operating point analysis.
Also how to draw basic schematics, display voltages and current on your schematic, and a beginner few traps to avoid.
http://www.eevblog.com/forum/blog/eevblog-516-ltspice-tutorial-dc-operating-point-analysis/'>http://www.eevblog.com/forum/blog/eevblog-516-ltspice-tutorial-dc-operating-point-analysis/
EEVblog Main Web Site:
http://www.eevblog.com
EEVblog Amazon Store:
http://astore.amazon.com/eevblogstore-20
Donations:
http://www.eevblog.com/donations/
Projects:
http://www.eevblog.com/projects/
Electronics Info Wiki:
http://www.eevblog.com/wiki/
Hi I thought I'd do a short tutorial series on how to use a circuit simulator. In this case, um LT Spice. It's a simulator based on the Spice circuit engine. I've done a few videos in the past on using LT Spice for doing various little niche simulation things I wanted to do at the time, but I haven't done a complete beginners thing from the very start.
there are lots of these sorts of videos, beginners videos, and tutorials on LT Spice out there. But I thought I'd throw my own hat into the ring. Now the good thing about LT Spice, which is one of my favorite uh circuit spice simulators at the moment: a because it's free, which is always fantastic. uh B As I said, tons of support out there, uh for it.
and uh, see, it does actually work fairly well as a circuit simulator now. Unfortunately, LT Spice is not the easiest to use circuit simulator out there. So if you want a real dummy version that just allows you to do some real basic stuff, LT Spice probably isn't for you. It's designed as a, You know, a very powerful, in-depth um, professional Spice tool.
So really, um, there are quite a few traps in these things because actually, which comes from its name its name is uh, Spice mean Uh is an acronym for simulation program with integrated circuit emphasis and hence the name. There is an emphasis for integrated circuit silicon level simulation now. Uh, Spice started in the mid 70s to do just that because people couldn't breadboard their integrated circuits right? You can't breadboard your, uh, your, Silicon stuff. So they developed this to try and simulate it.
and as such, actually a lot of people don't know. But spy simulators out of the box are not entirely optimized for the top level stuff, which most people use it for the boad level. Uh, stuff. stuff you you know, your up amps, your switching regulators, and all that sort of thing.
Um, it's out of the box. It it doesn't. uh, what's called a lot of the time it won't uh, converge or generate a new or be able to solve your particular circuit. You really got to tweak this and tweak that.
Now the good thing about LT Spice is that, uh, as you get it out of the package, it has actually been, uh, tweaked and uh, optimized for pretty good convergence for board level circuit and in the case of LT Spice, more specifically designed for power switching, regulator simulation and stuff like that. But as a general purpose simulator, it does work really well. So the majority of circuit simulators out there use uh, some variation of the open-source Spice engine, and LT Spice is no exception. Now, Spice was and still is traditionally a command line driven program that you put uh, you write your spice, uh, code, your Spice script, you feed it in and it gives you a solution.
Now what? LT Spice and all the other Uh circuit most of the other circuit simulators are is a big, nice graphical user interface wrapper around the Spice Engine, so you can actually see. you can draw your schematic, You can see the components you can, uh, you know, do all that sort of stuff. You can draw graphs and you can interact with the circuit and probe things and all that sort of stuff. So that's what LT Spice allows you to do. So we're going to start with a new schematic here and uh, pretty much these are all your tools up the top that you use to draw your circuit. Now what every single Uh Spice circuit must have is a ground point. It must have a know reference ground Point Like that. If it doesn't have that, it just screws up and it's not going to work for you.
So a lot of a lot of beginners, um, fall into the Trap of not putting a ground point. Now here's the other components: resistors, capacitors, inductors, diodes, and then your more. Uh, big selection of components. So we can start out by just putting a couple of resistors in here.
Like this. You can press Crlr to rotate like that and we can have our little Merry circuit in there and we can draw ourselves. You know, something like your traditional resistor, uh, puzzle or something like that. Now then you can go in there with the wiring tool and you can just wire things up like that and it is quite easy to use.
You'll notice that little box around the point on the end of the resistor there that indicates that that node is not connected. So if you see any of those boxes on your Uh schematics at all, then you will know that uh, that point is unconnected so and it automatically puts the Junctions in there and it is fairly easy to just draw up your circuit like this. No problems whatsoever. Now, a Uh Spice engine like this.
Really? You know you can't just go run and solve and put the values in there and it's not going to tell you the total resistance of this circuit like a resistor Cube or or something like that. It's not really designed to do that. Uh, Spice engines are designed to operate with various um, Uh sources, voltage sources. and we'll look at the different Uh types of sources in various videos and we'll also look at uh, the different types of simulation.
So this video will only show one type of Uh simulation today, the the very simplest one. But basically we need to go up there and put a voltage source in so we can go up to components here. And here are all of our components. We've got all different categories.
there's all different types, we've got transmission lines, we got transistors, all sorts of stuff, but what we want is a voltage over here so that can give us our voltage source. But the voltage source is actually very powerful. When we go in there, we can set the value to 1 volt by right clicking on that. but uh, if we go into the advanced tab, you can see that's not just a voltage source, but we can have not just a DC voltage source, but it can be a Sinos soidal source.
It can be a pulse Source It can be a um, uh, piecewise, uh, linear source and all sorts of stuff. but uh, we're just going to use it as a DC Source in this one and we can just wire that up and it's pretty easy to draw your circuit like that. And once again, you've got to connect that ground to some point in there. But Bingo We have a simple circuit now. at the very least. each component is going to have a reference designator in this case R1 here and V1 up here just like you used to in your traditional Uh schematic editor and it's going to have a value uh, associated with it. In terms of the voltage source, over here, we've got 1V DC and this resistor. here.
we can just write right, click on that uh value, and here is A. The one of the first traps is uh, you can type in of course. um, the resistance is going to be in ohms, and uh, the capacitance will be in farads. inductance will be in Henry so you have to put in the right units.
you can of course put in a th000 ohms like that. but you can put in 1K like that and it's going to recognize upper or lower case. It's going to recognize that, but a lot of people, a lot of beginners. The first thing they fall into is they go one Meg Like that that is not one Meg Okay, you see how it's convert I typed in uppercase M and it's converted it to lower case M There that that's actually one Millie All of the spice The spice engines recognize M as Millie not as Meg So if you want Meg you've got to actually type in one Meg Like that I Know it's crazy, but that's what you have to do.
and if you don't do that, you're going to be out by orders of magnitude and that's a trap almost every beginner falls into. So there you go. we're going to uh try K there like that and uh and of course, if you want One mic say you've got a a resistance isn't going to be that low generally but a capacitor you can put in U like that and it will. You notice how it's turned the U into uh, the Me symbol which is one micro.
So let's change that back to 1K And now we have a silly little resistor puzzle here. and how do we solve it now? The next thing, Well, what we do now is what we want to do is go to simulate and the edit simulation command here. Now we haven't had it added what's called any spice directives yet. We haven't told the Spice Engine what to actually do and here's where we can do this.
Now we've got um two, four, six different types of simulation and I'll have to do a separate video on each one of these cuz they're very important. The different types of simulations you can do now there's actually more than these six here. or you can do actually do various combinations of things and we'll go into these in future videos. But the main ones that uh, most people are going to use are transient analysis and that is uh, your traditional uh, time domain IE your oscilloscope type view.
You'll be able to view waveform, probe your circuit view waveforms as it as the circuit starts up over time just like an oscilloscope and then we've got AC analysis which is allows you to do uh AC frequency sweeps of your circuit like if you got a filter uh, for example, you can sweep it over a frequency range and you can get a bode plot. uh then we've got uh various DC sweeps where we can uh, sweep and change the DC operating point which is a more advanced version of the very simple DC operating point we're going to look at today and then you can do uh noise analysis DC transfer analysis uh they your, uh, more advanced, uh type stuff that uh, we'll get into much much later on. but uh, the one we're going to look at is DC operating point and this is the absolute simplest. Bare Bones Spice Simulation You can do. All it does is it tells you it computes the DC operating Point treating capacitances as open circuits and inductances as as short circuits because at DC that's exactly what those components are going to do. So in this case, we've got uh, no, uh, nonlinear. uh Active Components Like opamps or anything, all we got is some resistors on here. So our DC operating our DC operating Point simulation will work just fine.
So if we press okay there, you'll notice that it's got the syntax down here and that is the Syntax for What's called the Spice directive and then it lets you put that on the circuit and there it is down there. You can put it anywhere on the circuit you like, but it's got to be on there and this is just the way uh LT Spice uh happens to work in your more traditional command line approach. Then you'd be. You know, typing in these commands Op which means operating Point analysis.
But because we've got that on our circuit now that now tells um LT Spice. When we go up here to run the simulation, here, it is simulate, run. It knows that it reads those spice directives and it knows exactly what to do. Now, in the case of the DC operating Uh Point here, this will not show any waveforms at all because there's nothing to graph.
There's nothing to plot, There's no frequency responses. There's nothing. All it'll do is give us a text box of the various Uh voltages and currents. Um, in this circuit.
So let's actually run it. Here we go. We're going to run our first DC operating Point simulation. Run bang And there it is.
All it gave us is this list. but this list is actually very handy and very powerful for uh, lots of different circuits, not just simple little resistor puzzle thing things like this. and here it is. It gives us the voltage at each of the nodes.
Um, so we have to know about nodes and each of the resistors and the current through each of the resistors down there. from Uh R1 through to R9 there and you'll notice that some of them are negative. You'll notice that say R9 for example is negative. Why is that the case? It's not necessarily because the currents running in the opposite direction. It actually depends on where's R9 Here here is it depends on which way around you've put the resistor. And here's one of the first traps. now. Uh, it.
It doesn't actually tell you on. there's no indicator on there of which way the current's actually going to uh flow in this thing here. So what we need to do what we're going to do is we're just going to move this resistor and we'll rotate that around and if we run that again, you'll notice R9 Bingo is now positive and once again again for R7 there and R3. So R7 and R3 we can uh rotate them as well R7 and R3.
But uh, once again, you know you can Muck around with this and and get those values or you can just leave it as it is if. but just understand that the component like a resistor has a particular direction. It's not just you know it's not just a random PIN allocation. it treats the current flowing through in a certain direction like that.
So we can run that and we should now get all positive currents there flowing through our resistors. Too easy. Bingo We've done our first simulation. that's DC operating Point analysis.
But the interesting thing is once we've run that simulation, all that data is in memory in LT spice. and if we move our cursor over the individual components like this, look if you move it over R1 you'll notice down in the bottom here so sorry I can't move my cursor towards it. but down in the bottom left corner, you'll notice that it shows you the DC operating point. there is 1 milliamp and it shows you the power dissipation in that resistor as well.
And then likewise say for R3 up here there it is 333 microamps throwing flowing through that resistor with Uh 11 microwatt power dissipation and this one down here you'll notice there's no current at all flowing through R5 and R6 here and the next thing we can do is once again, it's got all that data in that simulation data in there. It's ran the simulation, it's finished, has all that DC operating Point data. We can just click on individual nodes here, watch this and we can get a value. Look at that 1 volts, look at that, 666 molts on that particular node there, and this one up here, 666 and so forth and whoa, so on.
Oops, We accidentally moved it off there. don't move it off. and now that we have our voltages on there, what we can do is we can, actually, uh, go in and change some values. Let's say we, uh, we want to tweak that value there.
Let's say it's 500 ohms now and then we just run our simulation again and bingo Look at that. Our values have changed. now. the next thing you might want to do, uh, on a complex circuit that you're probing and things like that, you might want to label your nets so you can just right click on a net there and you can just label that net.
you know you might call it I don't know Net 5 or something like that, but that just allows you to put meaningful labels that will then show up on your uh plots and uh, stuff like that when you probe them. Or in this case, um, if we go and run our simulation Bingo it'll show Net Five There it is. It's automatically added in there. It's just more sensible when you got a large circuit. So you you know, like node four doesn't mean anything right? Node Three: because they're not actually showing on the circuit. So it's good to go in there and actually label them so you know exactly uh, what is what value is associated with what node. But of course. um, because this is a nice gooey interface, it allows you to put things like those voltages right on those nodes there so you can sort of see.
It's a bit more interactive within the circuit. Now of course, these voltage sources over here. You can actually enter all sorts of uh, parametric information in them. In this case, in terms of a simple DC voltage source, there's the series resistance value down in here, which is basic one.
but let's say that battery we were using. you know, a CR 2032 coin cell battery or something, you know and it's got a typical uh 10 Ohm, You know it might have a 10 ohms uh, series resistance in in the cell so we can put that in and it's displayed that R series equals 10 and we can run that again and you'll notice that things are little bit different. CU It's now taking into account the internal series resistance in that voltage source. So this is where you can start doing some real practical circuit uh implementations and then inside the resistor, you can specify the tolerance in there, the power rating, and in future videos, we'll get on to uh, where those things will actually come into play in terms of various uh, types of advanced analysis and temperature sweeping and all sorts of stuff like that.
Now we can actually put more advanced information on this circuit. Let's say we wanted to get the current going through R7 here. Well, we click on this node again and we can put the information by default. It's just popped up there with that same node voltage we had before, but now we can actually right click on that.
And here's an expression editor which allows us to pretty much uh, display anything we like and in this case, we can, uh, change it R7 There we want the current through Ir7 like that Bingo We've just now displayed the current through that resistor there and let's say we wanted to display something simple like the voltage across R7 here. Well, that's not as easy as some other circuit simulation program. Some of those other simpler ones for beginners might have like a multimeter tool and you drag in the multimeter. it has a little, it looks like a multimedia has a little multimer display little probes and then you hook it up across R seven and you can actually measure the value across that.
But LT Spice isn't catering to that sort of real Ultra beginner Market It's more of just your, you know, professional, traditional uh Spice circuit simulation. Well, the way you do it is I've labeled uh, this net up here Net 5 and this net down here Net Four. So the voltage across R seven. In this case, if you wanted positive up here and negative down here, it' be Net 5 minus Net four. So once again, we can just left click or click on um, that node there and it's given us voltage by default. We go into the expression editor and you'll notice that it's only given us voltage and current for various voltage for all the nodes and the current through all the resistors and that will depend on the circuit you have. That's the available data that it has. so that's the only data you have to work from.
But we want Net Five. We want our expression wh I was doing too many clicks we want Net 5 minus Net 4. Like that very simple expression and bingo that is now the voltage across that resistor. Beautiful.
And you can see that uh, you know it's taking us some time to just, uh, sort of. You know, prepare our circuit and get nodes, net names, and nodes and information and stuff like that. But once you've done that and You set it all up, then you can go in and play with all your values and then rerun the simulator. You know if we change this value down here to, you know, 850 ohms or something like that, then that's going to change all our values again.
And bingo, there we go. They've all changed. So don't get frustrated with these tools that they, you know they don't give you absolute immediate results, you've got to work at it a bit and you've got to set them up to, uh, present the information. And we're only using the most basic DC operating Point analysis here.
We haven't even got into the probing and the graphs and all that sort of stuff. uh, set up yet. This is very, very simple. But yeah, as you can see, not as user friendly as some other spice engines out there for beginners, but it's not that hard to learn at all.
and once you know how to use it, you can get it to present the information that you want. And even for more complex circuits like this audio uh, transistor-based audio amplifier that comes with LT spice comes with lots of example circuits by the way, already set up, ready to run. They've already got the various uh, spice simulation directives down here to do look some Furious stuff and uh, you know, transfer function. all sorts of things like that, but let's uh.
but one thing it doesn't have is the DC operating point. So let's go up there and we'll edit our simulation command DC operating point and we can just use our operating Point command and we can place that there doesn't have to be there, it can be anywhere on our circuit and uh, then we can just run that and that will provide once again all those DC operating points for all of our transistor amplifier there and once again we can do the same thing and we can go in there and we can uh put the various voltages on those various nodes in there. so that's our DC operating Point stuff. Very handy. And when you get uh to more complex circuits like this that have more than just your passive uh components, they've got transistors and opamps and things like that. then you need a uh, then you need need to pick the particular type uh of uh component that you want. Now they can be generic uh ones, but uh, in this case, uh, you can pick various transistors and LT Spice for example comes with. you know, a whole bunch of you know, basic transistors.
It may not have the exact one you have and we'll do a separate video on how to add uh external spice models but you'll see that uh, it has this all the spice model information all pre-programmed into files which uh, you can get uh, access to, but they're basically just uh hidden away in there with all the detailed spice information and all this gobbley Go! Which probably means you know very little to you and some of these spice models can get very Advanced because they're as I said right at the start, designed for uh semiconductor, uh modeling. Uh, you know silicon level modeling so you can get into the whole physics of and the manufacturing processes. and uh, these spice engines let you go into as deep a model as you require for your particular type of component. but it does come with a good selection of basic Uh or usable selection of basic transistors for example.
And then if you go into opamps I mean if we go up here, these will all be uh, separate tutorials of course, but we can go over here and then opamps. and of course LT Spice only comes with all the LT ones it doesn't have. You know you won't find an LM 741 in there for example. but it does have generic ones like just a jelly bean opamp like that and that becomes a very important part of any uh spice model.
whether using just the generic one like this which is basically an ideal model uh Op amp, you know it doesn't have all the uh, you know the real world information programmed into them as these other ones. uh do you know there's the specific LT you know that's a 2.7 GHz low noise railto rail differential amplifier driver. oo that looks pretty good Actually like look at that one but that'll have uh and then you can open the macro models test fixture and oh man, it's just you know you can test the individual uh parts and wooo these um, circuit simulation? uh, spice things? they can. They've got so much depth to them I could probably do a 100 videos and I'm still not going to cover everything there's so there's always something new to learn when you're playing around with circuit simulators like this.
trust me. So that was a basic look at the simplest spice simulation analysis you can do DC operating Point analysis and so many tutorials out there. just completely skip that first. uh, basic step: They go straight into transient analysis which allows you to, you know, because it has the eye candy. It allows you to probe waveforms and see you're at like oscilloscope like waveforms around your circuit. but really, that is a more advanced analysis uh feature than your basic DC operating Point stuff. So this is very important to know and as a first step to your spice analysis. Yes, it's not very sexy, but it's vital to know.
so I hope you uh, found that useful And there will be follow-up videos with all sorts of different types of analysis. Uh, options. Catch you next time.
Too many numbers! How do you round the displayed values to three places or engineering notation?
when u find the world of electronic simulation its amazing that they are close to reality and u dont have to do the real building over and over again to get a project done!! thumbs up!!!
Excellent video. Thanks.
Yung Sung sleeping
theres a simple old online design for a 7805 constant current source… either simulation packages dont cope well with the way the regulator is used or i'm not understanding how i can be drawing half a mA from the 13v power source so less than a watt, but simulation shows 1.6w going back into the regulators ''ground'' pin. edit: i was using circuit wizard, ran it in ltspice (with a 1117) and it shows sensible figures so i guess cw is not understanding my abuse of the fixed voltage regulator as a current limiter.
Video was amazing, can anyone describe why was this done and what the title is please?
Title name pls?
This is a great video Dave! Thanks a lot!. I'm wondering if there's a comparable simulator for digital analysis. Digital Logic gates, etc. Thank you
He said that LTSpice could not measure the equivalent resistance of that resistor puzzle he drew in the software, however it will measure the equivalent resistance if you know how to do that in the software. Just use Vin/Iin in the AC Analysis window set for Linear instead of Decibels.
Thank you Dave! Explained really well!
"I can do probably 100s of videos …."
do it man ๐
Bang on again Dave. You're fast becoming my go to lecturer.
The best LT Spice tutorial I've seen.
I can't imagine why there are 39 morons giving a thumbs down to this video… oh well…
What is the purpose of voltage source "V4" in the amplifier circuit you show at the beginning of the video?
Nice
Hey Dave, thanks for the great stuff!! One question, how to change digits displayed on nets? Default on my version, XVII, seems to be five digits past the decimal point for millivolts! That's a bit much. My Fluke 8842A only needs to show three past the point to keep me happy, and that is overkill for anything I do. Even my DMM Check, traceable to NIST standards "only" shows five decimal places for volts. My LTSpice showing eight places is really pretty funny.
Love this!
My uni oughta pay you… they sent a link to your video to teach us this
This is like finding GOLD for beginner. Great work explaining.
How can i simulate the magic smoke?
LTSpice was developed inhouse because there were no spice simulators which would allow LTC to do an accurate and fast simulation of there Integrated circuits, especially the switching regulators!
LTSpice has had a long and continuous development. It's Free and Very Good!
Egad, "directional" resistors. Finally know where those weird negative currents come from. Why do we keep using LTspice with all its quirks? Just because it's free? Apparently. Just think of how many brownie points Analog Devices would get if they modernized the user interface. Now I'm dreaming. Must be the isolation . . .
Great video! Thanks! One unrelated question: do you know how I can add a fuse in LTSpice? Can't seem to find any library with a fuse…