1 00:00:00,104 --> 00:00:08,138 All right, I'm gonna do a quick LTspice crash course for Mac and Windows users. 2 00:00:08,138 --> 00:00:15,334 Go to and it'll be this link. 3 00:00:18,981 --> 00:00:20,490 Right here on the main page. 4 00:00:20,490 --> 00:00:21,481 Choose your download. 5 00:00:25,104 --> 00:00:27,764 Once it downloads, you're gonna double-click on it. 6 00:00:27,764 --> 00:00:32,561 It's gonna show here, you're gonna go into here. 7 00:00:32,561 --> 00:00:36,013 This is a little different than what you're expecting on Macs normally. 8 00:00:36,013 --> 00:00:39,831 You're gonna put that in there and, actually, I've already got it in here, so 9 00:00:44,160 --> 00:00:47,635 LTspice, open it up. 10 00:00:51,219 --> 00:00:56,378 This will pop up consistently, it's actually a bug. 11 00:00:56,378 --> 00:00:59,993 Just ignore it, you don't need to update anything. 12 00:00:59,993 --> 00:01:02,050 So here you go. You can start a new schematic. 13 00:01:05,720 --> 00:01:10,104 You can add grid dots so it's easier to see the scaling. 14 00:01:10,104 --> 00:01:14,552 And this is the difference with Windows and Mac, is Mac, 15 00:01:14,552 --> 00:01:19,558 you actually have to access things through your right-click or 16 00:01:19,558 --> 00:01:22,628 Cmd, whatever, Cmd + left-click. 17 00:01:22,628 --> 00:01:24,676 I just do double tap. 18 00:01:24,676 --> 00:01:28,598 So let's just draw a simple circuit. 19 00:01:28,598 --> 00:01:35,795 It's easier to start with the wires and the shape of the circuit that you want. 20 00:01:35,795 --> 00:01:39,162 And then you can just drop in, 21 00:01:39,162 --> 00:01:44,974 hit Esc to go back to normal view, normal tool tip. 22 00:01:44,974 --> 00:01:48,108 So Wires is F3, I'll probably end up using that more. 23 00:01:48,108 --> 00:01:49,243 Component is F2. 24 00:01:51,376 --> 00:01:55,057 So let's say we want to do a voltage source, 25 00:01:55,057 --> 00:02:00,442 then you can just drop this right in, and it clicks it in for you. 26 00:02:03,775 --> 00:02:10,439 Function F2 for part, resistor, that's just showing right here anyways. 27 00:02:10,439 --> 00:02:16,069 So by the way, notice the folder that these are all in up here. 28 00:02:16,069 --> 00:02:18,420 If you had access to other folders, it would show here. 29 00:02:18,420 --> 00:02:22,758 In fact, I'll show it is going to autogenerate another folder for 30 00:02:22,758 --> 00:02:24,080 your own circuits. 31 00:02:24,080 --> 00:02:27,286 It'll auto generate for this particular circuit, in fact. 32 00:02:27,286 --> 00:02:31,884 [COUGH] So we also need a ground, which another 33 00:02:31,884 --> 00:02:36,845 quirk of this is you don't actually get to ground 34 00:02:36,845 --> 00:02:41,696 through component, you go Net Name > Ground. 35 00:02:41,696 --> 00:02:45,264 All circuits apparently have to have a global ground. 36 00:02:45,264 --> 00:02:48,889 I tried to use COM, this is a common. 37 00:02:48,889 --> 00:02:53,557 And you'll learn about this, but for some reason, 38 00:02:53,557 --> 00:02:56,961 these circuits need a global ground. 39 00:02:56,961 --> 00:02:58,423 Okay, click there. 40 00:02:59,811 --> 00:03:01,531 So this circuit is ready. 41 00:03:01,531 --> 00:03:05,098 Well, we have to give it some values here. 42 00:03:05,098 --> 00:03:09,690 Just right-click on that to give it a value here in this. 43 00:03:09,690 --> 00:03:11,291 Probably another number. 44 00:03:11,291 --> 00:03:16,445 When you see the hand here, you right-click on it, 45 00:03:16,445 --> 00:03:20,438 it gives you sorta the same option here. 46 00:03:20,438 --> 00:03:23,972 You can also include a resistance and series just so 47 00:03:23,972 --> 00:03:26,612 that it's no longer an ideal source. 48 00:03:29,432 --> 00:03:33,539 We're gonna use ideal everything essentially. 49 00:03:33,539 --> 00:03:36,092 Resister here, let's just say 1k. 50 00:03:40,826 --> 00:03:42,253 Resistor 1k. 51 00:03:46,461 --> 00:03:49,873 Okay so let's try to simulate this thing, and 52 00:03:49,873 --> 00:03:54,083 you'll see what happens, no one else is command found. 53 00:03:54,083 --> 00:03:55,911 So this is a Spice program, 54 00:03:55,911 --> 00:03:59,893 which means you actually have to give it a Spice directive. 55 00:03:59,893 --> 00:04:05,214 And the way that you do that is draft a Spice directive. 56 00:04:07,561 --> 00:04:09,440 And it'll give you this. 57 00:04:09,440 --> 00:04:10,671 You just type in the directive. 58 00:04:10,671 --> 00:04:14,430 If you don't know Spice directives, which you shouldn't know, 59 00:04:14,430 --> 00:04:16,454 unless you've used Spice before. 60 00:04:16,454 --> 00:04:19,163 Then you can actually go like this. 61 00:04:19,163 --> 00:04:24,003 Help me, and you can do step which is to step 62 00:04:24,003 --> 00:04:28,584 through values, or just do an analyse. 63 00:04:31,870 --> 00:04:37,015 So Transient is if you want to run over a certain amount of time. 64 00:04:37,015 --> 00:04:39,628 For this analysis we're doing, 65 00:04:39,628 --> 00:04:43,931 we just wanna find what's called an operating point. 66 00:04:43,931 --> 00:04:46,621 And it's over here, DC bias point. 67 00:04:46,621 --> 00:04:52,811 And it tells you how the syntax for that, all it requires is this .op. 68 00:04:52,811 --> 00:04:57,081 So if you wanted to do transient for example, the syntax for that is .tran, and 69 00:04:57,081 --> 00:05:00,864 then you have to enter all these options, whatever options you want. 70 00:05:00,864 --> 00:05:02,500 So time to stop. 71 00:05:02,500 --> 00:05:06,391 So how much time do you want it to run for? 72 00:05:06,391 --> 00:05:09,467 Let's say we want it to run for one second. 73 00:05:09,467 --> 00:05:12,042 And that's really all, all the rest of these are options. 74 00:05:12,042 --> 00:05:15,717 You can add all these extra things in here as options. 75 00:05:15,717 --> 00:05:17,577 So I can run this for one second. 76 00:05:17,577 --> 00:05:21,815 But I don't need a transient on this because it's just going to be boring, 77 00:05:21,815 --> 00:05:22,903 nothing going on. 78 00:05:22,903 --> 00:05:26,918 But I do want to find the point at which I'm trying to find the value, 79 00:05:26,918 --> 00:05:29,043 the operating point it's called. 80 00:05:29,043 --> 00:05:32,304 For this particular, I'll show you another option when we get to it. 81 00:05:32,304 --> 00:05:36,153 So this is called the spice directive, 82 00:05:36,153 --> 00:05:40,945 just place that in there and this will run [COUGH]. 83 00:05:40,945 --> 00:05:46,841 And Mac, for some reason maximizes these when I run them. 84 00:05:46,841 --> 00:05:52,824 It does the same thing with MatLab for some reason, on figures. 85 00:05:52,824 --> 00:05:54,958 So there's nothing going on, right? 86 00:05:54,958 --> 00:05:55,605 Doesn't look like it. 87 00:05:55,605 --> 00:06:00,234 So when you go over, hover over your circuit, you can put a probe. 88 00:06:00,234 --> 00:06:05,482 And notice up here on the top it tells you where that location is. 89 00:06:05,482 --> 00:06:10,083 So you're measuring voltage at node 002. 90 00:06:10,083 --> 00:06:15,622 N is not node, in fact, it's net, so these are all called nets. 91 00:06:15,622 --> 00:06:18,814 So this is net 001. 92 00:06:18,814 --> 00:06:20,518 So this is a voltage probe, 93 00:06:20,518 --> 00:06:25,790 which means you're measuring the voltage at this location with respect to ground. 94 00:06:25,790 --> 00:06:27,299 Any time you see one probe, 95 00:06:27,299 --> 00:06:30,850 it's always with respect to the common of your entire circuit. 96 00:06:32,490 --> 00:06:34,337 So also, you see this? 97 00:06:34,337 --> 00:06:37,917 This is an ammeter and it gives you the arrow here. 98 00:06:37,917 --> 00:06:42,467 It's telling you that it's measuring the current going through the resistor down 99 00:06:42,467 --> 00:06:43,646 towards the ground. 100 00:06:43,646 --> 00:06:45,200 And we can see this. 101 00:06:45,200 --> 00:06:49,371 That's also the same direction, same direction, same direction, and 102 00:06:49,371 --> 00:06:53,205 sometimes you'll notice that when it doesn't give you the arrow, 103 00:06:53,205 --> 00:06:55,708 it's actually measuring into the device. 104 00:06:55,708 --> 00:06:58,343 So if it didn't give you the arrow here, 105 00:06:58,343 --> 00:07:02,773 then it would actually be measuring the current into the resistor. 106 00:07:02,773 --> 00:07:06,653 So it would be opposite of this arrow as it sees right here. 107 00:07:06,653 --> 00:07:08,148 So let's measure the voltage right here. 108 00:07:09,784 --> 00:07:11,664 Here you go. 109 00:07:11,664 --> 00:07:17,484 So it's five volts and we didn't give it any directive for the x axis so 110 00:07:17,484 --> 00:07:23,318 it's just arbitrarily showing it going on for the whole, whatever. 111 00:07:25,029 --> 00:07:28,707 So that's it for how you do an analysis for 112 00:07:28,707 --> 00:07:32,504 just a DC operating point, it's called. 113 00:07:32,504 --> 00:07:37,744 Now what if we wanted to sweep through different values of resistances here? 114 00:07:37,744 --> 00:07:43,814 So make sure you're hovered over this one to get rid of it. 115 00:07:43,814 --> 00:07:47,040 So I wanna get rid of this, actually I can just delete that in a minute here. 116 00:07:47,040 --> 00:07:50,088 I just right-click on this to change this guy. 117 00:07:50,088 --> 00:07:52,599 So now I wanna sweep through this, so 118 00:07:52,599 --> 00:07:56,495 I'll have to create a variable which is in curly braces. 119 00:07:56,495 --> 00:07:58,793 You give that value in curly braces, and 120 00:07:58,793 --> 00:08:01,711 then you can call it later in your Spice directive. 121 00:08:01,711 --> 00:08:04,430 So I think I can just right-click on this, yeah. 122 00:08:04,430 --> 00:08:09,953 So I can actually, Let's see. 123 00:08:09,953 --> 00:08:13,915 Ctrl + Return gets me to a new line. 124 00:08:13,915 --> 00:08:15,515 So let's say I wanna do this. 125 00:08:15,515 --> 00:08:19,051 This line here I want to do a sweep. 126 00:08:19,051 --> 00:08:20,050 And it's not in the analysis. 127 00:08:20,050 --> 00:08:24,056 It's up here in this step. 128 00:08:24,056 --> 00:08:25,697 Step, sweep same thing. 129 00:08:25,697 --> 00:08:30,947 So name of parameter to sweep is gonna be R. 130 00:08:30,947 --> 00:08:34,775 [COUGH] Nature of sweep let's just do, 131 00:08:39,448 --> 00:08:42,919 Decade is every multiple of 10. 132 00:08:42,919 --> 00:08:50,044 Start value let's start at .1 And let's stop at 100K. 133 00:08:50,044 --> 00:08:53,950 Number of points per decade, 10 sounds reasonable. 134 00:08:53,950 --> 00:08:58,825 And it's showing you how you would type this directive here if you didn't 135 00:08:58,825 --> 00:08:59,856 use this tool. 136 00:08:59,856 --> 00:09:03,264 So I could have just typed this out. 137 00:09:03,264 --> 00:09:10,622 Okay, and it got rid of my other directive. 138 00:09:10,622 --> 00:09:12,303 So let's see if I can. 139 00:09:14,839 --> 00:09:19,523 [COUGH] Actually, I'm not even sure if I need that .LP anymore. 140 00:09:19,523 --> 00:09:22,314 Let's try this. 141 00:09:22,314 --> 00:09:23,419 No analysis command, right? 142 00:09:23,419 --> 00:09:24,330 So you have to do an operate. 143 00:09:24,330 --> 00:09:25,657 You have to do some sort of analysis. 144 00:09:25,657 --> 00:09:30,853 This is just telling you what sort of parameterization do do. 145 00:09:30,853 --> 00:09:36,354 But it doesn't give you the analysis direction. 146 00:09:36,354 --> 00:09:39,859 So you have to do this dot op for this particular type. 147 00:09:39,859 --> 00:09:40,395 There is no need. 148 00:09:40,395 --> 00:09:45,100 I don't think there is any need in doing a time. 149 00:09:45,100 --> 00:09:45,956 Let's see if it works. 150 00:09:49,918 --> 00:09:54,037 So you can actually add traces here. 151 00:09:54,037 --> 00:09:57,492 It tells you what all the possible values are. 152 00:09:57,492 --> 00:10:03,633 And if I remember right, it was Vn002, right? 153 00:10:03,633 --> 00:10:07,506 So you look at the the x-axis here, 154 00:10:07,506 --> 00:10:13,975 it's sweeping between 0.1 kiloohm to 100 kiloohm. 155 00:10:13,975 --> 00:10:17,987 And then you can see that the voltage at that node is gradually increasing as we 156 00:10:17,987 --> 00:10:19,604 swoop through that resistor. 157 00:10:23,444 --> 00:10:28,271 So what if we wanted to adjust both these resistors at the same time, 158 00:10:28,271 --> 00:10:30,652 complementarity to each other? 159 00:10:30,652 --> 00:10:35,197 So in other words, as this one sweeps through values 160 00:10:35,197 --> 00:10:39,534 going from almost 0, which I didn't do 0 here, 161 00:10:39,534 --> 00:10:45,238 because, Spice complains for doing zero resistances. 162 00:10:45,238 --> 00:10:47,528 You have to just choose something really small. 163 00:10:47,528 --> 00:10:51,525 So if we want to sweep this one the same as it's sweeping now, but 164 00:10:51,525 --> 00:10:54,428 we want to sweep this one complementing that. 165 00:10:54,428 --> 00:10:55,563 So this one increases. 166 00:10:55,563 --> 00:10:58,466 R2 increases, while R1 decreases. 167 00:10:58,466 --> 00:11:01,634 But so that the sum of the two is always the same. 168 00:11:01,634 --> 00:11:04,175 That's called a potentiometer. 169 00:11:04,175 --> 00:11:11,737 So, I've got a potentiometer made, 170 00:11:11,737 --> 00:11:18,052 unfortunately it's not included in the Spice library, 171 00:11:18,052 --> 00:11:24,775 so before I can use it I have to know where to put those models. 172 00:11:24,775 --> 00:11:29,463 But you guys just go to Canvas and download the model for the plot. 173 00:11:29,463 --> 00:11:33,222 And you have to know where to put the model for Spice to find it. 174 00:11:33,222 --> 00:11:37,806 And it's not straightforward, cuz you don't want to put it in Spice's 175 00:11:37,806 --> 00:11:41,641 library cuz otherwise when you go update Spice's library, 176 00:11:41,641 --> 00:11:45,645 then it doesn't know that the plot exists, it just erases it. 177 00:11:45,645 --> 00:11:50,504 So the easiest way to do this is just to save. 178 00:11:50,504 --> 00:11:54,424 And then, just keep track of where it saves to. 179 00:11:54,424 --> 00:11:58,520 See, this saves to Documents, 180 00:11:58,520 --> 00:12:03,685 this is My Documents folder, LTspice. 181 00:12:03,685 --> 00:12:09,039 So LTspice actually creates this extra folder for you. 182 00:12:09,039 --> 00:12:13,042 And notice down here I already had the part here cuz I already knew where it went 183 00:12:13,042 --> 00:12:14,902 but you wouldn't have known this. 184 00:12:14,902 --> 00:12:21,669 So test circ, so you just need to keep track of where that is so 185 00:12:21,669 --> 00:12:25,936 you can go place those items in there. 186 00:12:25,936 --> 00:12:30,891 And if we can look at that again, I'll show you what those items mean. 187 00:12:30,891 --> 00:12:37,757 So this plot.asy, that a symbol that just describes what it looks like. 188 00:12:37,757 --> 00:12:39,669 And then this asc, that's a circuit. 189 00:12:43,123 --> 00:12:45,899 So I'll show you what they look like in a second here. 190 00:12:45,899 --> 00:12:49,402 So if we want to place that component now, 191 00:12:49,402 --> 00:12:53,316 now we have those components available here. 192 00:12:53,316 --> 00:12:56,019 So place the pot. 193 00:12:58,570 --> 00:13:01,761 Escape wire is F3, 194 00:13:07,269 --> 00:13:11,622 And in order to be able to probe this center off, I have to put a wire. 195 00:13:11,622 --> 00:13:15,078 It doesn't probe directly to that pin. 196 00:13:15,078 --> 00:13:17,546 So now I can go up here. 197 00:13:17,546 --> 00:13:19,409 I right-click on this and 198 00:13:19,409 --> 00:13:23,991 it gives me the default values that I have programmed into this. 199 00:13:23,991 --> 00:13:28,478 This particular model, I've programmed the default values into it. 200 00:13:28,478 --> 00:13:35,011 But in order to sweep, we're gonna want to sweep these values, and 201 00:13:35,011 --> 00:13:42,482 this val parameter changes the percentage of the bottom relative to the top. 202 00:13:42,482 --> 00:13:46,015 So you can call this anything, but I'm calling it slider. 203 00:13:46,015 --> 00:13:50,406 And then you can change this as well to whatever value you need. 204 00:13:50,406 --> 00:13:54,312 And let's open the schematic. 205 00:13:54,312 --> 00:13:57,250 So this is what I drew just using two resistors. 206 00:13:57,250 --> 00:14:03,487 And then I set these R23 and R13 as parameters that are, 207 00:14:03,487 --> 00:14:11,364 these are just Spice directives that determine how this model functions. 208 00:14:11,364 --> 00:14:16,474 And you can see that R13 is equal to some minimal value, so I never hit 0. 209 00:14:16,474 --> 00:14:21,210 Plus, these values that are variables. 210 00:14:21,210 --> 00:14:24,944 And it gets kinda confusing because these ones have to be in braces, but 211 00:14:24,944 --> 00:14:29,072 these ones can't be in braces because this is a mathematical operation here. 212 00:14:29,072 --> 00:14:35,382 So this directive on the bottom is saying some percentage of the total R, right? 213 00:14:35,382 --> 00:14:41,010 So this val has to be 0 to 100, so that it gives you some percentage. 214 00:14:41,010 --> 00:14:43,512 And then this is one minus that. 215 00:14:43,512 --> 00:14:47,479 So you're always getting something between 0 to 1 multiplied by this R. 216 00:14:49,791 --> 00:14:54,843 So that's the circuit schematic. 217 00:14:54,843 --> 00:14:56,244 And that's what gives it. 218 00:14:56,244 --> 00:14:59,067 And there's also the symbol. 219 00:14:59,067 --> 00:15:03,123 And the symbol is just a drawing. 220 00:15:03,123 --> 00:15:07,258 [COUGH] And there's no directives, 221 00:15:07,258 --> 00:15:12,118 I created this instance name so you knew what the name was when you created it. 222 00:15:12,118 --> 00:15:13,910 See, this name is X1. 223 00:15:17,931 --> 00:15:22,062 Okay, so I've created the step perimeter, 224 00:15:22,062 --> 00:15:27,726 I've called it slider, so let's change this to the slider. 225 00:15:30,235 --> 00:15:35,619 And we're gonna step slider, 226 00:15:38,231 --> 00:15:42,981 Through 0 to 100 in 227 00:15:42,981 --> 00:15:47,481 increments of 10. 228 00:15:49,895 --> 00:15:54,334 And then Ctrl + 229 00:15:54,334 --> 00:15:58,777 Enter .OP.. 230 00:15:58,777 --> 00:16:00,107 Okay let's see if that works. 231 00:16:02,368 --> 00:16:08,219 And we wanna see that center voltage again. 232 00:16:08,219 --> 00:16:13,052 Let's go, somehow it didn't actually save this. 233 00:16:16,057 --> 00:16:19,295 Okay, let's do that again. 234 00:16:19,295 --> 00:16:21,769 Okay now it's working. 235 00:16:21,769 --> 00:16:28,008 Okay let's step through 10 increments from 0 and went 0, 10, 20, 30, 40, so on. 236 00:16:28,008 --> 00:16:31,895 And it's measuring the voltage here so you can see that that voltage is increasing as 237 00:16:31,895 --> 00:16:34,704 we're increasing the bottom resistor relative to the top. 238 00:16:34,704 --> 00:16:38,658 And it goes all the way from 0 to 10 volts now instead of 5. 239 00:16:38,658 --> 00:16:42,904 So there's numerous different directives that you can use but don't get buried and 240 00:16:42,904 --> 00:16:44,110 doing the directives. 241 00:16:44,110 --> 00:16:51,178 This first semester is not for spending too much time on directives, just minimal. 242 00:16:51,178 --> 00:16:54,344 There's just gonna be a minimal subset. 243 00:16:54,344 --> 00:17:00,988 But you can, you can see what those directors mean, 244 00:17:00,988 --> 00:17:04,612 that view Spice net list, so 245 00:17:04,612 --> 00:17:09,896 this is the description of that circuit, 246 00:17:09,896 --> 00:17:13,676 in code, this is spice code. 247 00:17:13,676 --> 00:17:20,997 So its saying that there was a sub-circuit within this guy, that is this R1, R2. 248 00:17:20,997 --> 00:17:26,298 That's the circuit within here, 249 00:17:26,298 --> 00:17:29,048 you have, okay. 250 00:17:29,048 --> 00:17:35,107 So this is the value of using this particular software is that you're gonna 251 00:17:35,107 --> 00:17:40,588 be introduced to doing these types of things which is what you really 252 00:17:40,588 --> 00:17:47,437 need to learn going on with your education if you're gonna do anything in circuits. 253 00:17:47,437 --> 00:17:50,403 This has taken plenty of time though.