Welcome to crash course we try this Halloween edition. Did you see that. The power's out. It's the week of Halloween and all kinds of things are going wrong here inside of this lab. Power went out on U.P.S. is right now powering everything up. That's why I'm in the dark so I don't know I've been hearing a lot of things a lot of weird things are going on. So I don't know. Anyway it's pretty scary. Now what we're going to talk about is kind of scary also h bridges and but we're going to try and make it not so scary. Bridges are not half bridges as opposed to half ridge and full bridge which is kind of a bridge rectification for power H-bridge is a motor driver and it looks like an H and that's where the name H-bridge comes from. So this lecture we're going to talk about how to build an H-bridge from the ground up. We're going to do it out of transistors. But you could do it out of a mosfet. And typically that's what you would want to do is build it out of most FETs you wouldn't really want to use transistors because the transistors can't conduct enough power and there's a number of other reasons. So but it's easier to build it with transistors because a lot of people have those on hand and we can kind of just grab a few parts and build something whereas working with FETs a lot of times your newer fats or surface mount you might have to solder them together and so forth. So anywhere we're just going to do this a transistors to get the kind of basic idea. So first thing let's do is let's go ahead and let's take a look. And in fact let's just google for H-bridge here and we'll say motor driver. All right lot of things come up here and that's kind of what we're talking about. These are obviously off the shelf drivers here. Let's go to images and any of these are kind of what we're talking about so let's grab something. Let's grab something. This is a fat based one. This is a that's a transistor based one. There's kind of an abstract. Oh this one's a good one I like this one. All right. Let's go here and we'll say open a new tab. All right. So what do we have here. So say you have a DC motor. Right. So a DC motor and we're now talking about brushless motors. That's kind of a different thing. But a normal DC motor you apply DC voltage to it it rotates clockwise or counter-clockwise you reverse the polarity then it rotates in the opposite direction. Standard DC motor. Now a lot of times you want to be able to do that electronically so you want to be able to make the motor go clockwise and then counter-clockwise. So the problem is is you've got this motor and you've got a basically a plus apply plus and minus. And then to switch the direction you've got to apply minus and plus. So how do you do that. Well how you do it is with an H-bridge and all that H-bridge is this kind of configuration. So each one of these is basically a switch just a simple switch and it could be a transistor or a fat or it could be a switch even. All right you could do this with switches if you wanted to make a simple circuit kind of for a classroom demo or something. All right so let's take a look at it. So say in one case we want current to flow down here through here and down here right. These are transistors. So these transistors are going to turn on when we apply a high to them. All right. And they're going to turn off. We apply a low to them. Right now this configuration what the designer is done is he's tried this one this input to this input. All right. So we can turn these both on at the same time or both off. And then this B input is tied over here to this input and tie that together. And that's kind of the two different ways that we want to turn this thing on. All right. So let's say that we apply a low to be here. All right so that means that you Q2 are right and Q3 are off. Right now let's go and apply a high voltage to note here. Right so that means that q 1 and come around here. Q4 are both going to be on. So these are in and transistors. We apply a high voltage to the base. Right. We forward his transistor the transistor starts conducting it turns on it acts like a switch when it saturates and is more or less becomes a short. Right. OK. Same thing over here Q4 this turns on more or less becomes a short. So let's now let's follow the current so far up here and say this is our positive supply the subsea see maybe it's 12 volts or 9 volt something like that something to drive a motor with a lot of current. So currents going to slow down here. It can't get through Q3 because that's off like Q3 is off right. So currents going to flow down here forget this diode for a minute. It's going to flow down through here. Now can it get down through Q2. Q2 is off because member B is turning Q2 off. So currents going to come down here now can go through the motor and it's going to want to come down here. Can't go through this diode and then Q4 is on. So it's going to go through Q4 back down to ground. So basically we've got this conduction path so the motor is going to turn on and it's going to rotate in one direction. Now if we turn off and we turn on apply a Heibel to show that we're going to have the opposite thing happen. So now we're going to turn Q2 on and we're going to turn Q3 on. So we've got a plus voltage up here. Q One is turned off. No it's going to flow there but Q3 is turned on. So we're in the get current flowing through Q3 and Q4 is turned off. Now things can happen there so the currents going have to go through the DC motor come through here and then it's going to throw a flow through Q2 to ground and boom now the motor is going to rotate the other direction. Now the other cool thing that we can do is we can just turn these full blast on right. Or we could apply a lower voltage. And that would cause less current to conduct inside of these branches. But that's a little bit hard to control because depending on the transistors or the fets or this or that what we really want to do is really want to use these transistors or Fettes in an on off kind of switch fashion. So that means the best thing to do if we want to control how fast this motor rotates is use a P.W. signal member a pulse with modulated signal and put a pulse train on it on off on off with a duty cycle and then that let that control us or just turn it on turned off turn on turn off when the duty cycle of that on and off with and change the rotation rate of the motor in either direction. Right. So this is kind of what an age fridge is. And it looks like an H-bridge because you know here is kind of the H in here is the vertical bar. Here is the other vertical bar. All right. So that's kind of what we're dealing with right. So now what we're going to do is we are going to do a number of things we're going to design one of these. We're going to kind of draw on paper real quick on the blackboard then we're going to create a simulation of it. So we actually built this circuit up step by step inside of Proteus flaps and opprobrious then we're going to go on the bench I've already built one and we're going to experiment with it so you can see it working. All right. So this is kind of what we're you know roughly going to make very similar to what we're going to make actually. And and then we're going to talk about what all these components are and why we're adding them and some other features also. This is just a random you know I just found this right now and you know coincidentally it's similar to what we're going to actually build but we're going to have some more features. OK. All right so let's go ahead and we will and another thing also. Go ahead. And if you search Wikipedia for H-bridge Now there's obviously countless references in white papers and explanations of H-bridge is surprisingly normally Wikipedia just has pages and pages of stuff right. I'm really surprised look at is H-bridge entry is pretty weak there's probably a different way to spell it. Maybe at Ashbridge or this or that something bigger will come up. But anyway this is this is the very abstract simplified version of the H-bridge and there's our motor and then there's just four switches. The switches can be anything. The problem is is when you're building one of these H-bridge you have these four switches she up for different things she can turn on and off. So you could accidentally cause problems what if you were too. So here's a power source right. What if you were to turn on one and as to simultaneously leaving S3 S4 off. Well this would create a short ride across the power supply. So whatever the internal impedance of this one is too would be you would get you know that kind of current flow so you'd get the voltage divided by the impedance would give you the current it could be a lot it could actually burn the switches out. Same thing over here or you could short these two. You could turn three and turn as four on and leave us one or two off. And then in this case you'd get another short here. All right. So you have to be careful shorting these. Right. So this is why you'll see motor controllers or Fritsch controllers that are kind of intelligent and they may have a command where you say hey turn the motor right turn the motor left and with an added P.W. signal or some other analog signal that it controls the switches so that you can't possibly short them together because if you have individual control of them then obviously you can short them together. Moreover there's some things like for example say you're turning the motor clockwise. Right let's just say for example if we have an S for close then the motor will sit rotate clockwise. Now I want to change it and make it go counter-clockwise if we just immediately turn on S3 and s2 to right. We open up S1 and ask for that immediately hit S3 and as to the motors already has momentum. It's rotating in one direction. Then when I start rotating in another direction. So we're going to get kind of this inductive braking and then it's going to start rotating the other direction but there's going to be a huge surge of current. Right. So these kinds of transit transitions going from one direction to another direction slowing down speeding up all that some of these intelligent motor controllers are aware of how these motors react and they can look at the back of the motor. Right. So they can better control the motor so that smoother making these transitions so motor control. Very complicated subject but we're just going to take a first whack at it for something fun. One of one of the students in the course had mentioned he went to see motor driver and of course I said I was going to do motor drivers so here we are. So anyway that's talking about the switches and then here's the state space so there's four possible switches they can be on or off right. So two the fourth is 16. So those are 16 combinations and you can see here is all these short circuits these braking States coasting States and then motor moves right moves left and all that. So kind of some interesting things that you can do. Right. All right. And then just talks about some drivers and so forth in the use of n and peak semiconductors or and channel semiconductor is why you might want to do that and so forth. I'm not going to talk about that. I'll let you guys read all that right. Anyway so let's go to our famous drawing program here. Right here we go. And since it's Halloween time let's do this in Orange. All right so let's start off with. We'll come down here and we're going to go across here. Right. And then we're going to draw our first transistor and let's see how do we want to draw these how do we want to draw these I want to draw. Yes let's draw in this direction here. Right. I want to try really hard to draw these nice which is never easy with this drawing program. All right. And member and the transistor the emitter points away. OK. And then here is kind of the center area where we're going to put the motor. There's the two bases. Right. So now what imma do is I'm going to just kind of put a note here and a note here just kind of keep ourselves centered here. Or else try and draw the transistor this way this time go like this there's art collector and remember current always flowing in the same direction kind of downward. Right. But then we either shifted to the left to right or right to left through the motor. Right. And then that's what gives us the different direction changes. The motor here. It's got our collector get our emitters OK and we've got our bases. All right. That's looking good. Then that's maybe go down like this and we'll go like this. And then down here is going to be ground. OK. That up here is in a b b c c kind of let's make this one. Greene at least. And let's just let's just say you know for fun this is you know nine to 12 volts a lot of times those are kind of your motor voltages six to 12 volts 9 to 12 volts. And this is a DC supply obviously and can supply a lot of current. All right so we have four different switches here. All right. So let's go ahead label them and I'm just going to label that Q1 Q2 Q3 Q4. All right. Now let's get our motor in here so let's go ahead and let's make our motor will make our motor. Let's make our motor read centers are motor and motors kind of have this symbol like this sometimes. And now here's the interesting thing. We are just literally going to short it right to here. And we're going to short it right here just like that. So those are wires shorted straight across or this or DC motor. All right. So we'll call that one. All right. So now we've got four bases we've got this thing potentially powered up. All right. Now let's go ahead and let's add some will do these in orange here. Let's do these. Let's actually do these in blue. So let's let's go ahead and make sure this thing is always off so we're not doing anything to make sure it's off. So since these are and transistors we're just going to put a resistor to ground on each one of the bases. And that just makes sure we're all safe. So we're not doing anything remember to turn. And in Transistor we're going to apply a high voltage to the base. Right but we're not doing anything. I don't want any funny business. So we're going to go like that. OK. OK. So we have our four resistors and now you know what kind of transistors are these. You know maybe let's say the transistors for the transistors transistors maybe these are you know two and thirty nine or four or maybe two and 2 2 2 2 A's or there's a multitude. We basically just want transistors and then we might want transistors that can handle half an amp or an amp so you just kind of Google or Digi-Key or Mouser or Octa part in search. But these little simple kind of low cost ones will do. And these will be able to pass anywhere from 0 200 to 400 million amperes. So you can you know play around with it with a small DC motor. OK. So just real simple little 5 10 cent transistors or get it done for these transistors. OK. Now so we've got these bases set up. Right. And then again if you're watching this bonus video that may mean that you watch a whole class haven't the class you just skipping it that's great. And that's what the idea the bonus videos are you can just kind of watch these out of order and it doesn't really matter. It is kind of fun if you don't know how transistor works there. There's a lot of lectures on it. But in a nutshell real quick here. Let's pick a color pick this color maybe. So you've got this transistor and it's kind of like a switch in the way that we're going to use it and use it as an amplifier switch and how this works is like this if we apply a positive voltage right here right to an engine transistor. Then what we do is we start forward biasing or turning this transistor on. And then if there is a positive to negative voltage here then what happens is we've got a current flowing like this and then a little bit of current flows here and then adds up to this current label some together and we get a current like that. So basically it's like a switch so it's a current controlled switch. All right current controlled switch. OK. Now let's see here. All right so everything is off right now. And now we want to be able to turn everything on. OK so let's go ahead let's add some more stuff here. So why don't we just for so let's do this passively. So we're just going to use resistors so let's add a resistor here and a resistor here and then what value should these things be. Well we'll talk about that. And that's why we simulate we built things so we kind of tune and figure out what we want to do here. All right. So I'm going to tell you right now let's go ahead and make these pulldowns. We can make them anywhere from 10 to 100 k. We want to just make sure that transistors are not on. So they're kind of being held off. So we'll just call these 100 K 100 cal. All right. And again you got to play with these values. You got to see how the whole system works together and what kind of currents are being generated and so forth. All right so those are a hundred Kheta ground that's going to kind of keep those things off. Now we really want to turn these transistors on really hard right. We want to. These are like switches. These We want to use these transistors switches so to turn these things on really hard. So for these resistors here I want to go ahead and let's make these like 100 or 220 or so real small. All right. And so let's go now we'll call them 220 is for now 220 ohm 220 ohm. All right well you know we're going to play with this right 220 ohm and 220 for example. Again if you don't know transistor's this you're kind of get lost a little bit here but so this is 220. And then let's go ahead and let's put some switches on the other end of these things. So we're going to put a switch here we're going to put a switch here going to put a switch here switch here that looks like this. Sue why don't we put a little momentary switch like that. And then the other end of this is going to go up to this box of s.c.s I'm just going to again just put vse of C the same voltage it's going to be whatever this is going to be the same. All right. There's been another switch here momentary switch to the subsea C and momentary switch here and this is kind of the symbol for a little push button momentary switch right and right here rates get this kind of architecture. So it's good to see you have these four switches. Let's name these a little bit. All right. Name the switches. So this q one. So just call this S1 we'll call this S3 we'll call this s for and we'll call this s two resistors I don't care so much about naming them. All right. So as we close the software to close close S1 and S four we would turn the motor on and it would go in one direction. All right. Now let's let's go back and talk about this a little bit. So this node right here. So this node right here is equal to zero volts. So this is equal desirables right here. All right. Now when this transistor is on and it's on really really hard. Right. If you guys recall for those that have done this this voltage drop from the base to the emitter is going to be approximately point six point seven volts point six points and volts. All right. So that's point seven volts. So this is the subsea C than the total voltage drop over this 220 ohm is going to be B C of C C minus point 7. Right. That would be the voltage drop. So if we wanted to find the current here. So if we want to find the current through here let's use green. So we don't find the current through here that's going to kind of come through here and this current right here is called Ice be ice be going into the base. Right. So I said be roughly is equal to what vse of CC minus 0.7 volts over this 220 ohms. Right. And if we plug in real numbers let's just say that we're using 12 volts here. So you plug in 12 volts minus 0.7 volts over 220 ohms right. Is going to give us eleven point three eleven point three volts 1.3 volts over 220 ohms. All right let's get our calculator out and pray that we have enough photons to do this. All right so we've got about 50 51 million years 51 million years. So it's a lot of current. So we're really driving this thing really hard we probably don't need that much current to turn it on but we're just going to leave it at that. We can always make these resistors a little bit bigger. OK. So the point is is that when we close the switches so let's do some closures. So if we say S1 plus S for and by Plus that means these are all the switches that are close. Right. So in this state. So in this state that's one plus as for what's going to happen well in that case we're going to get a current. And again I'm use green here. So we're going to close S1 and we're going to close S-4. All right. So when you do that what's going to happen is to get this visa CC here. Right. Giving us that base current that's going to turn on that transistor we're going get this piece of s.c here we're going to turn on this transistor. Right. And when we turn these transistors on we're going to get a big current over here in the collector side. Right. So we're going to get current that's going to flow down here. Right. And it's going to go down here and a little base current is going add up with it but we don't care about that right now and it's going to go here it's going to go this direction it's going to go right through the motor turning the motor on it's going to go down here again it's going to go through here. It's going to come up with this little base current here and that it's going to go to ground. So that's what's going to happen when we turn on S1 and S4. All right cool. So now it's back up and let's try another one. So now what happens if we do the other state which is say let's turn on S3 and as to so state s three plus two. What what goes on in that situation right. So let's go ahead and we'll pick a different color here. So estuaries S2 S3 S2 S2 S3. See right here. All right so if we close this we're basically going get a current here we're going to get a base current right that basically it's going to turn on this transistor that it's going to end up going down here a small base current like $50 amperes. All right then we're going to turn this transistor on. Also we've already got that little line there. But just bear with me and we're going to turn that on. So both transistors are going to be turned on in both of those based currents are going to shoot out of those emitters right. But we're going to turn these transistors on. So each one of these transistors are going to basically act like a closed switch. So now current's going to come from the source it's going to come down this way. It's going to go through here this time. It's going to flow in this direction of course. The little base current here adds up into it. It's going to go through our motor here down here. All right keep going keep going keep going we're going to pick up that base current right there and we're going to go down to ground. And so that's the other state right there. So those are two different motor states turning on 100 percent full as much power as this circuit can flow as much current as a certain can flow. The motors are going to turn on and then and then rotate. Now how can we control this. Well we could control we could control how much we turn these bases on. We could control them with analog. But the problem is these are open these are open loop circuits. Right. We've talked about this before. Each one of these transistors if we just use it in this this kind of switch configuration right here depending on what the gain is of the transistor it could be 100 200 300 400 you're going to get kind of a different amount of current flow. So we need feedback we need to make an actual amplifier and have feedback so we have some control over it so that whatever the gain is the transistor gain is factored out. So we get again set by components right. That's what we really want so we could control the gain. Right. But the simple configuration we can't do that. So what else can we do. Well what we can do is instead of instead of having little mechanical switches here for example where we can do is we can use W.M.. Right. And if you don't know this is pulse with modulation and the whole idea of this is right and of course of course of course of course of course of course of course of course we talk about this and we have a waveform here and let's say let's say that we've got a signal let's say a kilo Hertz one kilohertz. Right so we got say 1 kilohertz signal. All right. So that means the period of each one of the waveforms of each one of the individual cycles is going to be one millisecond one millisecond. All right. So that means from from here. So say here's one of these waveforms goes from here down to here. That would be one complete cycle right here. This is the high part and this is the low part from here to here is one millisecond OK one millisecond. All right. That's one cycle then with then we have another cycle goes up goes down and so forth. Now this right here if we look at this here is when the waveform is high. And here is when the waveform is low you can see they're equal right so it's 50 50 right now. The ratio of this. So as we change the ratio of the height of the low so coming back here we can start to make a waveform that looks like like this it can be long long long long long and then it can be off just a little bit and then a long long long long long and then off just a little bit and on and on and on and so forth. Or we can flip it around and we can just turn it on just a little bit. And then it's off off off off off off off turn it on a little bit and then it's off off off off off. And the total cycle time is always the same it's that one millisecond but how long it's on or off. Right. That that's the modulation. So the pulse with modulation we're modulating the with how long this thing is on or off. So in essence if we were to take these signals and then apply them to the switches right. Right of course we'd have to apply them to the correct switches so the switch in the switch or the switch and this switch we can turn these voters on just a little bit of time. All right. And so they're going to turn on just a little bit of time. And what that is going to result in is the energy transfer instead of being full blast on it's going to be a percentage of full power. So the motor is going to rotate at a lower angular velocity and that's kind of how you can control the motors rotation rate digitally with a pulse with modulation. Right so that is H-bridge and then of course we could just switch these. Right we could switch these guys you know for Fettes. OK. And that's what you do. So these are transistors. All right. And then Indians are recommended for there's a number of reasons but typically if you can do with Francis use you'll use Anand's But if you do it with Fettes then a lot of times what you'll see is on the high side here you'll see a p type a p type that you see in anti-Fed and type that because of the charge carriers you want to put the types on the high side. The types of the low side. But then they turn on and off with different voltages right. So that you kind of have to play around with these inputs a little bit more. But the reason why you like FETs is the on resistance is very low you're talking about milah ohms right. So these things are nearly dead shorts. So you can create these h bridges that can flow enormous amounts of current for very cheap. Right. So you might be able to make up a 10 20 50 amp H-bridge with very cheap parts as opposed to doing with transistors which would be much more expensive. OK. All right. So that's kind of what we're building. All right. And a one other thing. One other thing I want to talk about here. I want to add we are driving Motors here. All right. And one thing that we learned when we were doing our Course Lectures is are driving Motors is that when this motor is you know we're driving the motor. And then when we turn the motor off this is an inductor inside of here in this inductor is going to want to maintain this current. And so what happens is the inductor creates a voltage. Right. And in the opposite direction it can damage the transistors. All right. So what we do is we're going to put these catch diodes here and we're going to put them in this configuration right here. So just like this or each one we're going to put a diode and this is for the you know the inductive kick we use a few different names to kind of identify these but they're going to go in this configuration right here. Sorry if it's a little bit hard to see through things but it's hard for me to raise this. So they're going to go so normal current is going to flow down in this direction right here. All right. And when that happens and let's let's use a different color for that. It's you use so many colors this on. All right so let's say that we got the motor to the motors running like this. Right. As to the a little bit better the motor is going like this like this like this like this like this and down like that right. When we turn the motor off what's going to happen is we're going to get a large positive voltage here and it's going want to drive current this direction and instead of the current going back up here through this transistor it's going to go through this diode and then you can kind of follow that same pattern and it'll work always the same. So the diodes always go in the same direction the opposite of the normal current flow of the transistors or of the fats. And then that will protect these semiconductor devices and they will get blown up which can actually happen quite easily. All right. And the other thing is what kind of diodes. So when you guys do this you know you can use a 1 and 4 Double-O one a simple little diode or or you can use a Shaki diode which has a much lower voltage but one end fordable of one two three four five six. Any of those the those will be fine. Just run of the mill when you're just building a fun circuit. If you're going to do real motor control please do not build your own fridges. Companies spend years literally engineering these things and optimizing these things and doing a very deep analysis of them testing them out with different motors and all that for all those different conditions I talked about in thermal this and being able to control the motor break the motor. So many different things. But this is just for fun seeing kind of see the process. OK. Now let's go too our simulation tool where is it where to go. Here it is here. OK. Now OK so the first thing you know what let's let's move this and we're right here. OK. And you know we are always out of time. I do these big lectures. I do them unscripted. So they're honest and we kind of talk about things as we go. And you know we just don't have a lot of time a lot of time especially with the bonus lecture because I wanted to be one lecture not two or three or four. So you know we can only do so much stuff now. If you haven't seen Proteus this lapse in our Proteus if you had a lapse intercom this is a simulation PCB layout schematic design. This is an awesome tool like Circuit maker. It's very cool like Circuit studio it's very cool except what this has is a simulation where a circuit maker the PCB tool we're going to use the Course for free does not have a simulation. So this is not free but you can use the simulator for free but you just can't save. Right. So if again you're coming to this for the first time you like what's this. This is Lap's center Proteus go to a lab center dot com download a totally free install it and then you can build these things you just kind of copy this and you could but you can load simulations. So this is a simulation H-bridge or one it will be inside of the lecture materials for this lecture. So just look in the download section and just download the zip file boom it'll be in there. All right. OK. What are we doing. All right so let's take a look at this so this is basically what I just designed right here right. This is that. OK. Let's take a look. All right so we've got our motor here which is just the standard motor device from Proteus and we've got our transistors and this is just some random transistors CTX 450 that I looked up as one of the parts here that this tool had. Remember if we want to run the simulator we need models of things. And if we don't have a model then a lot of times we'll just use a transistor or a federal device that's similar to it and then build our real devices on solderless breadboard or printed circuit boards. Then we kind of have to extrapolate or imagine with the real parts is going to work a little bit different but we can kind of use models that are similar because we can't build all these models in here now some tools and give models for the devices of full complex models. But this company gives you these models. There's not much you can do. You can't create your own models but a lot of times they're parameterize so you can actually mess with them a little bit. For example if you go to the motor it says how many revolutions I believe this is revolutions per minute and then the load resistance What's the motors DC resistance viable. But there's not a whole lot of other properties here in nominal voltage 12 volts you know not much else here you can mess with right. If we go to the transistors. All right. Again not much else we can mess with. Right. So again depending on what you know and here's the Shaki diodes again the model is kind of intrinsic so we can't mess with it. Sometimes you can mess with the models more if they expose some of the parameters. All right. So let's look at the circuit. So what do we have here we have a voltage source a DC source this motor 12. So motor 12 and it's 12 volts DC. Ok cool down here we've got ground. All right so that each one of our lakes of our H-bridge. So we've got again these are NPM transistors. The emitter is pointing out and again and again and again and then we've got these Schottky diodes instead of using the one in front of low one ridge using. In this case. These are pretty high current Sharky's. I believe if we if we were to look them up if we're to take that number right and if we were to go over here to our favorite little tool Digi-Key and were to look these up and see what's the story with these 38 cents they can handle 30 volts and an amp of rectified current. Good enough good enough. And their forward voltage is 560 millivolts at 1 amps. That's pretty good. It's better than the one in fordable one which is going to be about 0.7 maybe even point eight volts. It'll drop. And remember Ideally you want it to drop zero. We want it to be perfect so we just want it to be a diode but but not drop any voltage right. Right. Anyway moving back. So here's our configuration and then we've got our switches one two three four these are interactive switches so we can kind of turn them on and turn them off. All right. And these are not momentary because I couldn't there's no way to press two things at once. So we turn them on and turn them off. So they're latching All right. And let's see. OK. Now we also see there's some capacitors here I want to talk about these. Whenever you're doing motor control a lot of times the motors generate a lot of noise electrical noise. So what you do is on the plus side the minus side and this motor here there's no plus or minus right goes either way so there's no you know correct way to connect it. We can just arbitrarily say one side is plus one is mine. In any case some of the designed tactics that you'll see designers do when they're putting Motors in things is put a small capacitor on the plus and minus to ground and that gets rid of one kind of noise and that capacitor typically is like POINT a one to a point when micro faired in that kind of range. And then you'll put one right across the Vasser the motor leads you put a capacitor across that. And that might be a little bit smaller point 1 to point 0 1 microflora it's right that you might. Another thing you might even see is putting inductors extra inductors to get rid of high frequency noise inside of the power lines as well. Right but we don't have it so we just have a few capacitors here for noise. All right then we have our resistors here looking back at our design. You know we've got our base resistors right 220 and then we've got our base pulldown resistors to keep the thing off to keep the transistor off. And again we pulled. We used 100 k 1 hurricane Hurricane 1 hurricane and then these are 220 to 20 to 22 20 for the base resistors that are going to be the injection path for the base. All right. And then you see I've got a bunch of instrumentation here for you. So you kind of see what's going on. Right and then what's interesting is will this match the circuit that we build on the bench which we'll do in a little while. OK. Then up here you see I've got a big capacitor this big bulk capacitor when we turn these voters on. Right there's going to be a lot of inrush current lot of currents and we don't want to pull that from the power supply. So those this is a simulation. We still want to have good design. And so you want to put big capacitance on these motors 220 470 thousand micro-grids or more. All right. And that way when you need that current it'll pull from this capacitor and not from the power supply and dip down your power supply and potentially cause ripples and issues with your other power supplies that are pulling maybe from this 12 volt. Get your digital supplies right. OK we're always concerned about that. OK so we're I think we see and get this on the screen. So what I want to do is I want to kind of put it just like that. Proteus is this lab center my lab center Proteus is a United Kingdom company. And you know they took. Here is the interesting thing when they made this tool they were kind of pushing the limits of windows when they made this tool initially and they kind of came up with their own things and then Windows got really really really good. And now this tool if you look at it looks very dated it looks like a 90s tool. Right. And a lot of things are very 90s ish. They're not like normal windows or what you would expect on a Macintosh either. So you know you scroll the scrub will try to make these you can't do this smoothly there's just lots of issues that make navigation a little bit different than what you would expect just with any Windows app. So it's kind of like hard to get things centered and all that. Anyway here we go. All right so I'm going to run the simulation and I've got nine messages in two messages. They're really good. So here's the two messages. Everything is working simulation log. Cool. And it's an animating. And see if you load is 0 percent which is completely incorrect I'm sure. All right. So it's running. And we can see all these voltages and everything is going here now the motor is just sitting there. All right. So now if we turn this switch on right nothing nothing happens. Right. We turn the switch on. Nothing happens switch nothing happens you got to turn two of these things on right. All right so let's go ahead and let's turn this transistor on and this transistor will get a current flowing through the sky like this. Here we go. So I turn this one on. Now look what's what's going on here right now on the collector circuit we have a very little current because we haven't turned the the emitter here has no ground right now still floating because this is not turned on. Right. But now we're going to go ahead turn this one on. And now in the video you can't really see which way this turn is a matter of fact let's go ahead. Let's let's modify that. Let's see if we can make that a little bit more instead of 10000. Let's make it just five loops five maybe we'll be able to see a little bit better. All right. I'm going to save that. So we go we're going to run it. OK. And now this is on and this is on so that we can actually see it turning the correct way and it's not doing any kind of crazy super position superimposing on our eyes. So it's turning counterclockwise right now excuse me clockwise. Yes it's late I'm tired. I always do these really late so it's real quiet when I'm recording. All right. So it's turning clockwise right now. Now let's take a look at some of these currents. So coming through this node right here we have 483 Mike ramp years which is getting dragged through here and then over here we have 546. So what will what's going on. How can we be pulling all the 483. But then we've got five hundred forty six Well remember we've got 43 right here then we have some base current How much do we have here 22 million amperes we're pushing through this base that's going to add. Right. So whatever this current is here we're going to add to it. Then we've got that current coming through here coming through here coming through here coming through here. Then here we go. Then what are we going to do it again. We're going to add this current here this 41 Milli amperes which is driving this Basir. And so that's 41 is going to add when you add all those together you get 546 amperes boom going down to ground. All right. So this is working exactly as we would expect. Let's turn this off. All right. And all of these little switch got to hit him just right and this going the other direction. Boom and boom. And now we're going in the other direction we're going counter-clockwise we went backwards in time cool. So that's working. And again we have almost a very symmetrical configuration we have 43 on this lake now. And over here we have 546 the opposite way so current is flowing down down down through Q twell in these numbers because I did a lot of copy and paste these numbers are kind of crazy. Q 12 then comes through here then it comes through and one goes through 14 and then back down to ground. OK. Now let's have some fun because we can't blow this up let's short this thing out. So I'm sure these two switches so right now I'm getting no current through here right. I'm only getting this this base curve here just this right here. Right. We're just getting this but we're not getting a lot of collector current. So watch this boom. Now we're getting currents coming from the source. Five hundred seventy four million amperes are coming through here then we're getting our $70 amperes here. Ouch. And that's adding up and then we're getting on a base curve here which it's splitting off in both directions here and then they all sum up and we get $644 amperes. The good thing about transistors is these the the impedance of the transistor itself right. It's not going to flow you know much more current than it can handle it's going to kind of get stuck and kind of not be able to blow itself out. Now if you keep riding it yeah it's going to it's going to Pops and overheat. But the nice thing is it's not going instantaneously just explode. Right. So the simulation we can't hurt that. Now what happens if we turn them both on. Let's check we turn this on now and then we turn this on. So what's interesting here is we were shorting this site out. But what's happening is we're kind of creating this asymmetrical voltage situation so that we can get some rotation some current flowing through the motor because it's an on balance circuit. All right. Now let's let's rebalance it and then let's unbalance it over here. All right. And on balance it over here. See so you can do that. That would be very bad. You don't want to do that. Right. So you want to keep all these back open OK. And that one. There we go. So there is our H-bridge. And again what you want to do now is these four things. Since you want to make sure you don't ever turn this motor on in short things out you would try like switch nine and switch 11 to one signal then switch 10 and switch 8 to 1 signal and then you'd only turn one on or the other one on. And then even better yet you would make sure that there are inversions of each other so you can to the turn when you turn one on the other one turns off or when you turn one off. The other one turns on. That way you never ever hurt your motor. Right. So you or your drivers or transistor's or your Fettes. OK. So we are running out of time. Let's get over to the bench and let's go and play with that saucy over there. OK so what do we have here is we've got a model of our H-bridge almost identical to what we've built. We've got our four switches we've got our four transistors we've got our motor plugged in right here which is suspended on this device here. It's a little so the focus is you know we're focusing here so we can't really see this. But anyway the motors over there will get to that in a minute. All right then we've got a little bit of instrumentation right here. I'm measuring current and we're going to see that on a meter which will bring in ice so we can see that once we back away from us everything is identical. We've got our capacitors or that we saw we've got our diodes get a kickback diodes on there. And now another interesting thing that we have is over here down here for one of the switches I have a signal from my signal generator that I can turn on and enable. So that signals at 50 kilohertz. And unfortunately the signal only goes up to 10 volts. All right. Whereas we're powering this with a 12 volt supply. So those bases only turn this Bassong we can't turn on super hard as we can with the switches. But but hard enough but we're not going to use that at first. All right. So what we're going to do is I'm going to back away here a little bit so we can get most of the stuff in here. We kind of see. All right. So let's put this in here. Right. And this is you know again this is always very hard to film all this stuff and get everything on here and kind of see everything. Obviously we don't have a film crew. All right. And I'm going up. How about I put this right here maybe. OK. So here's the deal. Let's see if everything's on the power supply is on the signal generator is off. So the signal that we're injecting into this one switch is off right now so the switch will turn it on. All right. And then keep an eye on this current right here so this is the amount of current that's going to be flowing. So if we want to turn the motor in one direction we basically need to turn on two of the switches so let's try these two right here let me get my hand out of the way. All right so press one in the press the other and you can see we're doing about 300 250 let it stabilize about 247. Now here's the interesting thing. All right so first what direction is that turning. All right. Let me. All right. So that's turning Yes that's turning counter-clockwise. Now watch that current. So see how the current is high because the motor we're spinning the motor up and then it drops down. So there's two kinds of things happening here. Right. When I turn this motor on boom boom. Look at that point four amps roughly. Point four. Then it drops down. So that's the initial start current. That's the start current. Right. Then there's what's called stall current. And let me do this. My fingers are going to turn these both on and I'm going to stop this motor. All right. And look at that point for and let it go. So we got to be able to handle that stall current OK without blowing things up. All right. So then it's going that direction. All right so now the current is going to be roughly the same some of that kind of cover you'll see my fingers cover a little bit here it's kind of hard to get in here. Let me see right so I'm going to do these two switches here and do it the other way. Here we go. All right. I'll kind of put my fingers there and then. And then you can see it's going clockwise. Now look at the current the current the same it starts off high and then it drops back down to the same. Now let's try a different experiment. So now if I let go of these let's look how long it takes to coast down. Ready. One two three four five. The switches are actually burning my fingers the switches are not rated for this current. They're actually burning my fingers do that again rev it all the way up and burning my fingers. One two three four five. Ouch. OK so that's which is getting really hot. Here we go. We're going to do it again but this time I'm going to stop it with the other two switches. I'm going to reverse the direction so forget the current You're not going to watch that focus origo going to go in one direction. When we hear the motor full blast and then you see it I did I use the other direction as a break and then switched it really fast. So boom. All right. So that's breaking. OK. OK. So there is the H-bridge the fridge works. And then we can change directions very quickly instead of letting it coast down. We can just flip directions and of course that's going to cause more current draw. All right. Now over here we've got my misdoing point my finger over here over here someplace there's a signal generator and a signal generator right now is at a 20 percent duty cycle. All right so what I'm going to do is I'm going to turn the signal generator on. It's going to basically pulse this for us with the 20 percent duty cycle and we're going to hold this one and just keep this one on. OK. So what I can do is I'm going to put my finger around here and I'm going to turn on the signal generator signal generators on. Everyone's happy. I'm going to turn this one on and then notice it starts turning. But notice what the current is it's less see because we're PWI it. All right. All right. Isn't that cool. Now I'm going to turn it on now and adjust the duty cycle manually over here. So first let's turn to turn it up see it's not. Don't pull that point for amps and it's not hanging at almost 300 million amps it's only hanging at 200 million amps right. OK. Now here we go. It's a 20 percent duty cycle. Here comes 30. Look at that. Here comes 40 50 60 70 80. And with this tool I can only go 20 percent to 80 percent you can't go less than 20 and greater than 80. But look at is that cool. Now watch. So now isn't that cool. All right. That is PWO having that one leg right. And of course you could P.W. on both. You could overlap the PWO as you do whatever you want you to all kinds of things. OK. So that is the H-bridge right. So we've made a discrete rich out of transistors very cheap it does work. This is not a tiny motor. Let me show this to. This is a pretty big motor. This I think this particular motor you probably put an amp through it. Big motor. We're just using a little simple transistor stuff is definitely getting hot but this is a good starting design to kind of get things going. And then you can kind of work from here and then you could change these the fats. You could control things with only one control signal you could get rid of the switches and then connect these directly to a microcontroller so you could turn it on and so forth and that's exactly what a H-bridge chip does. Right. So let me see here. So I have some of these out of the way just a little bit here. Moves out of the way for you. And then I've got a couple of manufacturers here. So here are some fridges right here and that I bought just to check them out. One's really really tiny and one is a little bit larger. So let's go ahead and let's take a look at these real quick on the computer there's thousands of ridges and then motor controllers and so forth. So there's no limit to what you can do as far as cost and performance. But these are just a couple cheap ones and simpler ones to solder together. Let's take a quick look at the computer and take a look at these. All right go back to the computer. OK so we're back here on the computer and we're taking a look at the first little motor driver So this is this SIOP 21:00. And if we click on this we look and we see it at 0 0 0 0 0 and it's about a buck. And what I like about this is it. It will go up to an amp and it's pretty simple. And let's go ahead let's grab the data sheet. And you can see it right here. So it's a very simple 8 pin package and I believe it only is. So I see package I don't think there's a through hole version of it. It's only an associate and very simple though. It's got power here so there's your power. Right. And then it's got ground and then it's just got a few control signals so here is an A and B out a outby to your motor so right here here is out a and b this is a horrible PDA. If this goes to your motor right here. All right. And then these signals here essay and SB I believe these are for sensing these might be sensing signals. And then yeah. And then these ends in a and b this is what controls the motor so you only have four different combinations because they're tied together so you can't really get in too much trouble. So one zero turns the motor in one direction on and off 0 1 turns the motor in the other direction. 0 0 turns the motor completely off both outputs and then one one is interesting that puts them into high Z. All right so instead of grounding both outputs it puts it into a high Z right and then these s signals this s say an S V R for feedback. So if you look through here this is a brand new product we see here it is right here. Driver output returned a driver output return be seen kind of see what's going on with those signals. So this is a nice little part very simple and very easy to use saw. So I like this right here. And this will drive a pretty big motor if you want to do something kind of you know this is you're not doing a discrete design now. Right. But you're doing one that you're using. I see that doesn't have a whole lot of control logic but it does have some control logic right does it have a lot of super advanced features but it does have some. OK. So that's that that's out one. Now take a look at the other one. Let's search for that right. And the other one is right so the other one is this. MP 6 5 1 3 GJ A dash Z and what I like about this is it's teeny tiny. It's one of these ISOT two three kind of packages. Right. So this is really cool. And this one's a little less current. This one's 800 amperes but it works at a wider voltage range which is kind of cool. And let's take a look at that. Very cheap. You know again under a dollar. So look how simple this one is. So you just put your motor there your DC motor or you can put a separate motor too. All right. And then we've got power here we've got ground here and this is all they got to signal so you don't have those feedback signals a sign you've got one in and two and then there should be a little truth table again. But this is a great way to control a motor and be safe with a nice fat driver. Right. And let's see if there is a little truth table and let's see let's see. And then look at that see those are pulled down so there's no funny business on those inputs right. And these are using FETs again. Right like what you should use. And there's is truth table area right there. So there's a two table kind of showing what's going on if they're both low in Coast Mode low high reverse high low and forward and then high high brake so high high no matter which way it's turning. It will want to stop it. Right. Which is very cool. All right so this has braking also which is nice. So again that's this part right here and all. You know what I'll do is in the materials for this lecture I'll throw the data sheets for both of these chips inside of that zip file see of the data sheets the data sheets are public domain you can get them but just so you have to remember this number. But like I said there's thousands of motor drivers and H-bridge is so kind of look around see what you want see would help you out with whatever it is that you're doing. All right. So that is it. So you know that's kind of where we started from. All right we kind of designed through this we talked about it how it works and so forth and we went and built our simulation simulation file of the inside of the lecture materials in the Zip's simulation H-bridge 0 1 0 2 whatever I ended up saving it as a matter of fact save right now and I think yeah we'll just leave it like that. So that will be inside there we did the benchwork so you could see it actually work and it does actually work. And that is motor control. So very cool. Now these are brushed DC motors and you're gonna have to look up what that means for there's brushes inside of it. There's commutation that goes on and then there's a permanent magnet and there's a electromagnet and it's a super ingenious I mean electric motors are fascinating there's some really good YouTube videos. I didn't take time to find them for you but there's you know just a little segue here depending how old you are if you're my age. About half a century old. Back in the 50s 40s 50s 60s mostly I think the 40s or 50s there were these educational videos the world used to be a different place specially in the United States in the United States like if you bought a radio you got the schematics of the radio. It explained how it worked. People wanted to know how things work now they just could care less. Right. Which is really sad. But there are these videos that they made which would show how things worked and there were a whole series of them. And I think it maybe was for military so that people can understand but like people wanted to know how a car works how does a differential the rear end work or brakes work or this. They had some motor videos that have amazing animation made in the 50s. And if you YouTube around and say the operation of a DC motor How does a DC motor work or whatever. You might even stumble upon it and they're actually pretty amazing. I mean these things are over half a century old and it's showing electromagnetic induction is showing Motors choice is very amazing to me that we had this technology you know 70 years ago more. Right. 100 years of TV was invented in 1890 8 roughly first cathode ray tubes right. Crazy. Over 100 years ago. But anyway we had this stuff. And so those videos show this and they show a really clear way where some of the more modern stuff is kind of it's it's you know it's hard to see what's going on. But but any way you could look and see how these voters work for these brushed motors and then there's these brushless motors where we get rid of this mechanical aspect and we control it completely electronically. You need a different kind of control system for that. All right because the motors themselves need to be sensed usually with a magnetic sense or how sensor has the sense what's going on magnetically in the motor and then use that information to control the motor. But with standard simple brushed DC motors these are the kind of controllers that you need. All right. So that's it for this lecture. I hope you liked it. And that's it. So good Botha's lecture and we'll see what we do next time. Right. So see you in the next one by. Questions Search for a question 0 questions in this lecture No questions yet Be the first to ask your question! You’ll be able to add details in the next step. Video course LyftPinterestadidasPayPalSurveyMonkeyBooking.com Udemy ©