< Return to Video

LTSpice intro - potentiometer, voltage divider and resistance sweeps

  • 0:00 - 0:08
    All right, I'm gonna do a quick LTspice
    crash course for Mac and Windows users.
  • 0:08 - 0:15
    Go to and it'll be this link.
  • 0:19 - 0:20
    Right here on the main page.
  • 0:20 - 0:21
    Choose your download.
  • 0:25 - 0:28
    Once it downloads,
    you're gonna double-click on it.
  • 0:28 - 0:33
    It's gonna show here,
    you're gonna go into here.
  • 0:33 - 0:36
    This is a little different than what
    you're expecting on Macs normally.
  • 0:36 - 0:40
    You're gonna put that in there and,
    actually, I've already got it in here, so
  • 0:44 - 0:48
    LTspice, open it up.
  • 0:51 - 0:56
    This will pop up consistently,
    it's actually a bug.
  • 0:56 - 1:00
    Just ignore it,
    you don't need to update anything.
  • 1:00 - 1:02
    So here you go.
    You can start a new schematic.
  • 1:06 - 1:10
    You can add grid dots so
    it's easier to see the scaling.
  • 1:10 - 1:15
    And this is the difference
    with Windows and Mac, is Mac,
  • 1:15 - 1:20
    you actually have to access things
    through your right-click or
  • 1:20 - 1:23
    Cmd, whatever, Cmd + left-click.
  • 1:23 - 1:25
    I just do double tap.
  • 1:25 - 1:29
    So let's just draw a simple circuit.
  • 1:29 - 1:36
    It's easier to start with the wires and
    the shape of the circuit that you want.
  • 1:36 - 1:39
    And then you can just drop in,
  • 1:39 - 1:45
    hit Esc to go back to normal view,
    normal tool tip.
  • 1:45 - 1:48
    So Wires is F3,
    I'll probably end up using that more.
  • 1:48 - 1:49
    Component is F2.
  • 1:51 - 1:55
    So let's say we want to
    do a voltage source,
  • 1:55 - 2:00
    then you can just drop this right in,
    and it clicks it in for you.
  • 2:04 - 2:10
    Function F2 for part, resistor,
    that's just showing right here anyways.
  • 2:10 - 2:16
    So by the way, notice the folder
    that these are all in up here.
  • 2:16 - 2:18
    If you had access to other folders,
    it would show here.
  • 2:18 - 2:23
    In fact, I'll show it is going to
    autogenerate another folder for
  • 2:23 - 2:24
    your own circuits.
  • 2:24 - 2:27
    It'll auto generate for
    this particular circuit, in fact.
  • 2:27 - 2:32
    [COUGH] So we also need a ground,
    which another
  • 2:32 - 2:37
    quirk of this is you don't
    actually get to ground
  • 2:37 - 2:42
    through component,
    you go Net Name > Ground.
  • 2:42 - 2:45
    All circuits apparently have
    to have a global ground.
  • 2:45 - 2:49
    I tried to use COM, this is a common.
  • 2:49 - 2:54
    And you'll learn about this,
    but for some reason,
  • 2:54 - 2:57
    these circuits need a global ground.
  • 2:57 - 2:58
    Okay, click there.
  • 3:00 - 3:02
    So this circuit is ready.
  • 3:02 - 3:05
    Well, we have to give it some values here.
  • 3:05 - 3:10
    Just right-click on that to
    give it a value here in this.
  • 3:10 - 3:11
    Probably another number.
  • 3:11 - 3:16
    When you see the hand here,
    you right-click on it,
  • 3:16 - 3:20
    it gives you sorta the same option here.
  • 3:20 - 3:24
    You can also include a resistance and
    series just so
  • 3:24 - 3:27
    that it's no longer an ideal source.
  • 3:29 - 3:34
    We're gonna use ideal
    everything essentially.
  • 3:34 - 3:36
    Resister here, let's just say 1k.
  • 3:41 - 3:42
    Resistor 1k.
  • 3:46 - 3:50
    Okay so
    let's try to simulate this thing, and
  • 3:50 - 3:54
    you'll see what happens,
    no one else is command found.
  • 3:54 - 3:56
    So this is a Spice program,
  • 3:56 - 4:00
    which means you actually have
    to give it a Spice directive.
  • 4:00 - 4:05
    And the way that you do that
    is draft a Spice directive.
  • 4:08 - 4:09
    And it'll give you this.
  • 4:09 - 4:11
    You just type in the directive.
  • 4:11 - 4:14
    If you don't know Spice directives,
    which you shouldn't know,
  • 4:14 - 4:16
    unless you've used Spice before.
  • 4:16 - 4:19
    Then you can actually go like this.
  • 4:19 - 4:24
    Help me, and
    you can do step which is to step
  • 4:24 - 4:29
    through values, or just do an analyse.
  • 4:32 - 4:37
    So Transient is if you want to run
    over a certain amount of time.
  • 4:37 - 4:40
    For this analysis we're doing,
  • 4:40 - 4:44
    we just wanna find what's
    called an operating point.
  • 4:44 - 4:47
    And it's over here, DC bias point.
  • 4:47 - 4:53
    And it tells you how the syntax for
    that, all it requires is this .op.
  • 4:53 - 4:57
    So if you wanted to do transient for
    example, the syntax for that is .tran, and
  • 4:57 - 5:01
    then you have to enter all these options,
    whatever options you want.
  • 5:01 - 5:02
    So time to stop.
  • 5:02 - 5:06
    So how much time do you
    want it to run for?
  • 5:06 - 5:09
    Let's say we want it to run for
    one second.
  • 5:09 - 5:12
    And that's really all,
    all the rest of these are options.
  • 5:12 - 5:16
    You can add all these extra
    things in here as options.
  • 5:16 - 5:18
    So I can run this for one second.
  • 5:18 - 5:22
    But I don't need a transient on this
    because it's just going to be boring,
  • 5:22 - 5:23
    nothing going on.
  • 5:23 - 5:27
    But I do want to find the point at
    which I'm trying to find the value,
  • 5:27 - 5:29
    the operating point it's called.
  • 5:29 - 5:32
    For this particular, I'll show you
    another option when we get to it.
  • 5:32 - 5:36
    So this is called the spice directive,
  • 5:36 - 5:41
    just place that in there and
    this will run [COUGH].
  • 5:41 - 5:47
    And Mac, for some reason
    maximizes these when I run them.
  • 5:47 - 5:53
    It does the same thing with MatLab for
    some reason, on figures.
  • 5:53 - 5:55
    So there's nothing going on, right?
  • 5:55 - 5:56
    Doesn't look like it.
  • 5:56 - 6:00
    So when you go over, hover over
    your circuit, you can put a probe.
  • 6:00 - 6:05
    And notice up here on the top it
    tells you where that location is.
  • 6:05 - 6:10
    So you're measuring voltage at node 002.
  • 6:10 - 6:16
    N is not node, in fact, it's net,
    so these are all called nets.
  • 6:16 - 6:19
    So this is net 001.
  • 6:19 - 6:21
    So this is a voltage probe,
  • 6:21 - 6:26
    which means you're measuring the voltage
    at this location with respect to ground.
  • 6:26 - 6:27
    Any time you see one probe,
  • 6:27 - 6:31
    it's always with respect to
    the common of your entire circuit.
  • 6:32 - 6:34
    So also, you see this?
  • 6:34 - 6:38
    This is an ammeter and
    it gives you the arrow here.
  • 6:38 - 6:42
    It's telling you that it's measuring the
    current going through the resistor down
  • 6:42 - 6:44
    towards the ground.
  • 6:44 - 6:45
    And we can see this.
  • 6:45 - 6:49
    That's also the same direction,
    same direction, same direction, and
  • 6:49 - 6:53
    sometimes you'll notice that when
    it doesn't give you the arrow,
  • 6:53 - 6:56
    it's actually measuring into the device.
  • 6:56 - 6:58
    So if it didn't give you the arrow here,
  • 6:58 - 7:03
    then it would actually be measuring
    the current into the resistor.
  • 7:03 - 7:07
    So it would be opposite of this
    arrow as it sees right here.
  • 7:07 - 7:08
    So let's measure the voltage right here.
  • 7:10 - 7:12
    Here you go.
  • 7:12 - 7:17
    So it's five volts and we didn't give
    it any directive for the x axis so
  • 7:17 - 7:23
    it's just arbitrarily showing it
    going on for the whole, whatever.
  • 7:25 - 7:29
    So that's it for
    how you do an analysis for
  • 7:29 - 7:33
    just a DC operating point, it's called.
  • 7:33 - 7:38
    Now what if we wanted to sweep through
    different values of resistances here?
  • 7:38 - 7:44
    So make sure you're hovered
    over this one to get rid of it.
  • 7:44 - 7:47
    So I wanna get rid of this, actually I
    can just delete that in a minute here.
  • 7:47 - 7:50
    I just right-click on
    this to change this guy.
  • 7:50 - 7:53
    So now I wanna sweep through this, so
  • 7:53 - 7:56
    I'll have to create a variable
    which is in curly braces.
  • 7:56 - 7:59
    You give that value in curly braces, and
  • 7:59 - 8:02
    then you can call it later
    in your Spice directive.
  • 8:02 - 8:04
    So I think I can just right-click on this,
    yeah.
  • 8:04 - 8:10
    So I can actually, Let's see.
  • 8:10 - 8:14
    Ctrl + Return gets me to a new line.
  • 8:14 - 8:16
    So let's say I wanna do this.
  • 8:16 - 8:19
    This line here I want to do a sweep.
  • 8:19 - 8:20
    And it's not in the analysis.
  • 8:20 - 8:24
    It's up here in this step.
  • 8:24 - 8:26
    Step, sweep same thing.
  • 8:26 - 8:31
    So name of parameter to
    sweep is gonna be R.
  • 8:31 - 8:35
    [COUGH] Nature of sweep let's just do,
  • 8:39 - 8:43
    Decade is every multiple of 10.
  • 8:43 - 8:50
    Start value let's start at .1 And
    let's stop at 100K.
  • 8:50 - 8:54
    Number of points per decade,
    10 sounds reasonable.
  • 8:54 - 8:59
    And it's showing you how you would
    type this directive here if you didn't
  • 8:59 - 9:00
    use this tool.
  • 9:00 - 9:03
    So I could have just typed this out.
  • 9:03 - 9:11
    Okay, and
    it got rid of my other directive.
  • 9:11 - 9:12
    So let's see if I can.
  • 9:15 - 9:20
    [COUGH] Actually, I'm not even
    sure if I need that .LP anymore.
  • 9:20 - 9:22
    Let's try this.
  • 9:22 - 9:23
    No analysis command, right?
  • 9:23 - 9:24
    So you have to do an operate.
  • 9:24 - 9:26
    You have to do some sort of analysis.
  • 9:26 - 9:31
    This is just telling you what
    sort of parameterization do do.
  • 9:31 - 9:36
    But it doesn't give you
    the analysis direction.
  • 9:36 - 9:40
    So you have to do this dot op for
    this particular type.
  • 9:40 - 9:40
    There is no need.
  • 9:40 - 9:45
    I don't think there is
    any need in doing a time.
  • 9:45 - 9:46
    Let's see if it works.
  • 9:50 - 9:54
    So you can actually add traces here.
  • 9:54 - 9:57
    It tells you what all
    the possible values are.
  • 9:57 - 10:04
    And if I remember right,
    it was Vn002, right?
  • 10:04 - 10:08
    So you look at the the x-axis here,
  • 10:08 - 10:14
    it's sweeping between 0.1
    kiloohm to 100 kiloohm.
  • 10:14 - 10:18
    And then you can see that the voltage at
    that node is gradually increasing as we
  • 10:18 - 10:20
    swoop through that resistor.
  • 10:23 - 10:28
    So what if we wanted to adjust both
    these resistors at the same time,
  • 10:28 - 10:31
    complementarity to each other?
  • 10:31 - 10:35
    So in other words,
    as this one sweeps through values
  • 10:35 - 10:40
    going from almost 0,
    which I didn't do 0 here,
  • 10:40 - 10:45
    because, Spice complains for
    doing zero resistances.
  • 10:45 - 10:48
    You have to just choose
    something really small.
  • 10:48 - 10:52
    So if we want to sweep this one
    the same as it's sweeping now, but
  • 10:52 - 10:54
    we want to sweep this
    one complementing that.
  • 10:54 - 10:56
    So this one increases.
  • 10:56 - 10:58
    R2 increases, while R1 decreases.
  • 10:58 - 11:02
    But so that the sum of
    the two is always the same.
  • 11:02 - 11:04
    That's called a potentiometer.
  • 11:04 - 11:12
    So, I've got a potentiometer made,
  • 11:12 - 11:18
    unfortunately it's not
    included in the Spice library,
  • 11:18 - 11:25
    so before I can use it I have to
    know where to put those models.
  • 11:25 - 11:29
    But you guys just go to Canvas and
    download the model for the plot.
  • 11:29 - 11:33
    And you have to know where to put
    the model for Spice to find it.
  • 11:33 - 11:38
    And it's not straightforward,
    cuz you don't want to put it in Spice's
  • 11:38 - 11:42
    library cuz otherwise when you
    go update Spice's library,
  • 11:42 - 11:46
    then it doesn't know that the plot exists,
    it just erases it.
  • 11:46 - 11:51
    So the easiest way to do
    this is just to save.
  • 11:51 - 11:54
    And then,
    just keep track of where it saves to.
  • 11:54 - 11:59
    See, this saves to Documents,
  • 11:59 - 12:04
    this is My Documents folder, LTspice.
  • 12:04 - 12:09
    So LTspice actually creates
    this extra folder for you.
  • 12:09 - 12:13
    And notice down here I already had the
    part here cuz I already knew where it went
  • 12:13 - 12:15
    but you wouldn't have known this.
  • 12:15 - 12:22
    So test circ, so you just need to
    keep track of where that is so
  • 12:22 - 12:26
    you can go place those items in there.
  • 12:26 - 12:31
    And if we can look at that again,
    I'll show you what those items mean.
  • 12:31 - 12:38
    So this plot.asy, that a symbol that
    just describes what it looks like.
  • 12:38 - 12:40
    And then this asc, that's a circuit.
  • 12:43 - 12:46
    So I'll show you what they
    look like in a second here.
  • 12:46 - 12:49
    So if we want to place that component now,
  • 12:49 - 12:53
    now we have those
    components available here.
  • 12:53 - 12:56
    So place the pot.
  • 12:59 - 13:02
    Escape wire is F3,
  • 13:07 - 13:12
    And in order to be able to probe this
    center off, I have to put a wire.
  • 13:12 - 13:15
    It doesn't probe directly to that pin.
  • 13:15 - 13:18
    So now I can go up here.
  • 13:18 - 13:19
    I right-click on this and
  • 13:19 - 13:24
    it gives me the default values
    that I have programmed into this.
  • 13:24 - 13:28
    This particular model, I've programmed
    the default values into it.
  • 13:28 - 13:35
    But in order to sweep, we're gonna
    want to sweep these values, and
  • 13:35 - 13:42
    this val parameter changes the percentage
    of the bottom relative to the top.
  • 13:42 - 13:46
    So you can call this anything,
    but I'm calling it slider.
  • 13:46 - 13:50
    And then you can change this as
    well to whatever value you need.
  • 13:50 - 13:54
    And let's open the schematic.
  • 13:54 - 13:57
    So this is what I drew
    just using two resistors.
  • 13:57 - 14:03
    And then I set these R23 and
    R13 as parameters that are,
  • 14:03 - 14:11
    these are just Spice directives that
    determine how this model functions.
  • 14:11 - 14:16
    And you can see that R13 is equal to
    some minimal value, so I never hit 0.
  • 14:16 - 14:21
    Plus, these values that are variables.
  • 14:21 - 14:25
    And it gets kinda confusing because
    these ones have to be in braces, but
  • 14:25 - 14:29
    these ones can't be in braces because
    this is a mathematical operation here.
  • 14:29 - 14:35
    So this directive on the bottom is saying
    some percentage of the total R, right?
  • 14:35 - 14:41
    So this val has to be 0 to 100, so
    that it gives you some percentage.
  • 14:41 - 14:44
    And then this is one minus that.
  • 14:44 - 14:47
    So you're always getting something
    between 0 to 1 multiplied by this R.
  • 14:50 - 14:55
    So that's the circuit schematic.
  • 14:55 - 14:56
    And that's what gives it.
  • 14:56 - 14:59
    And there's also the symbol.
  • 14:59 - 15:03
    And the symbol is just a drawing.
  • 15:03 - 15:07
    [COUGH] And there's no directives,
  • 15:07 - 15:12
    I created this instance name so you knew
    what the name was when you created it.
  • 15:12 - 15:14
    See, this name is X1.
  • 15:18 - 15:22
    Okay, so I've created the step perimeter,
  • 15:22 - 15:28
    I've called it slider, so
    let's change this to the slider.
  • 15:30 - 15:36
    And we're gonna step slider,
  • 15:38 - 15:43
    Through 0 to 100 in
  • 15:43 - 15:47
    increments of 10.
  • 15:50 - 15:54
    And then Ctrl +
  • 15:54 - 15:59
    Enter .OP..
  • 15:59 - 16:00
    Okay let's see if that works.
  • 16:02 - 16:08
    And we wanna see that
    center voltage again.
  • 16:08 - 16:13
    Let's go,
    somehow it didn't actually save this.
  • 16:16 - 16:19
    Okay, let's do that again.
  • 16:19 - 16:22
    Okay now it's working.
  • 16:22 - 16:28
    Okay let's step through 10 increments
    from 0 and went 0, 10, 20, 30, 40, so on.
  • 16:28 - 16:32
    And it's measuring the voltage here so you
    can see that that voltage is increasing as
  • 16:32 - 16:35
    we're increasing the bottom
    resistor relative to the top.
  • 16:35 - 16:39
    And it goes all the way from 0
    to 10 volts now instead of 5.
  • 16:39 - 16:43
    So there's numerous different directives
    that you can use but don't get buried and
  • 16:43 - 16:44
    doing the directives.
  • 16:44 - 16:51
    This first semester is not for spending
    too much time on directives, just minimal.
  • 16:51 - 16:54
    There's just gonna be a minimal subset.
  • 16:54 - 17:01
    But you can,
    you can see what those directors mean,
  • 17:01 - 17:05
    that view Spice net list, so
  • 17:05 - 17:10
    this is the description of that circuit,
  • 17:10 - 17:14
    in code, this is spice code.
  • 17:14 - 17:21
    So its saying that there was a sub-circuit
    within this guy, that is this R1, R2.
  • 17:21 - 17:26
    That's the circuit within here,
  • 17:26 - 17:29
    you have, okay.
  • 17:29 - 17:35
    So this is the value of using this
    particular software is that you're gonna
  • 17:35 - 17:41
    be introduced to doing these types
    of things which is what you really
  • 17:41 - 17:47
    need to learn going on with your education
    if you're gonna do anything in circuits.
  • 17:47 - 17:50
    This has taken plenty of time though.
Title:
LTSpice intro - potentiometer, voltage divider and resistance sweeps
Description:

Introduction to LTSpice for absolute beginners.

DC voltage division with resistor sweep.

Very simple potentiometer sweep through complementary resistances.

Applicable for Mac and Windows, but shown on OSX to demonstrate LTSpice quirks on a Mac.

Contents:
1- Download and install (0:08)
2- Add grid dots (1:02)
3- New circuit schematic, draw wires [F3] (1:25)
4- Insert component [F2] (1:48)
5- How to GND (2:35)
6- Enter values (3:03)
7- Include internal source resistance (3:11)
8- How to simulate circuit (3:45)
9- Using voltmeter and ammeter probes (5:56)
10- Variable sweep analysis, v-divider (7:32)
11- Viewing output by adding trace (9:51)
12- Inserting and sweeping a potentiometer (10:25)
13- Sweep resistor values in pot (13:15)
14- Looking inside the pot (13:52)

more » « less
Video Language:
English
Duration:
17:51

English subtitles

Revisions