Arduino Tutorial 3: Understanding How Breadboards Work

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is polemic order from top tech boy calm and I am here today with lesson number three in our new our improved our exciting series on working with the Arduino if you haven't done it already you need to order your a lego super starter kit from the link below hook a brother up in the description there's a link help me out a little bit order your kit and you will be able to play along at home as I go through a lot of exciting projects using this kit the other thing I need you to do if you haven't done it already pour yourself a nice mug of iced coffee yes and then you can play along with us at home you guys in the old series I did hot coffee this is summertime here in West Texas and so I will be for this series of lessons be drinking iced coffee I hope you will do the same okay in lesson number one we did a very simple program you wrote your first program for the Arduino where you could make this LED blink and you could control the timing and characteristics of how the blink occurred then in Lesson number two we talked about how to are how an LED works sort of the physics behind the LED if you haven't worked on lesson number two go back and watch it because I don't want you to think about you know microcontrollers or raspberry PI's or Arduino zazz things that you just type commands into and once you start understanding what's going on the magic that is really going on down in the silicon that these chips are made out of so what's that lesson so you know what's going on today what we're gonna do is we're going to move forward and start looking at how to hook up external circuits because one of the really amazing things about the let me move out of your way before I go on one of the amazing things about the Arduino is that you have all of these pins and then you can write programs that will send signals to these pins or read signals from the pins and so as you hook these pins up to things like LEDs or sensors or GPS or other components that's where the magic happens this is like a computer where you can interact with the external world through sensors and actuators and GPS and things like that so the trick though is is that we've now got to learn how to connect things up how do we go about connecting these pins to things that will work in the next work with and interact with the external world well one of the things would be that you always end up with and let me zoom out so that you can see this better you end up with something like this which is a circuit diagram this is what you want to do and this is what we talked a little bit about in lesson number two how to make an LED work this is the LED you apply a voltage to the LED but you need a current limiting resistor in series with the LEDs so the LED doesn't get too much current and burn out and then this is kind of the ground look to the negative of the power supply so this is a schematic or this is a circuit diagram how do we turn this into something that is working with the Arduino well good news is if you have ordered your kits you have everything that you need in order to start building circuits and what you don't want to do in building circuits is you don't want to like get your LED and try to twist it together with the resistor and then come over and plug it in and just try to kind of hook things together by twisting leads together you want to have a neat and organized way to hook things together and luckily your kit has just the thing for that and let's see if I can put this kit over here Oh microphone disaster okay let's zoom out a little bit so you can open your kit up and if you look in this top section hidden down in here yeah the prototyping board okay the PC board or breadboard or prototyping board and so what we're gonna do today is we're gonna learn how to use this prototyping board in order to actually build a circuit and this is kind of lets you go from a circuit diagram down to something that will actually work so we're gonna take this and we're gonna open it up and we're gonna pull it out and then this is the board onto which you will build your circuit so we're gonna start hooking things up from the Arduino to components that are going to be plugged into the board but the challenge is how do we go from this picture into things on this board how does this board work alright that's what we're gonna do today so what we're gonna do is we're gonna learn how the board works and then we're gonna get a resistor and we're gonna get an LED in Arduino and we're gonna hook the whole thing up but step one is you have to understand how the board works like what is the mentality or what is the the algorithm behind how this board is laid out and then you will understand how to hook things together and so we will come over here to this background and this is kind of the key to understanding how to hook things up on the board and so let's go back and I'm sorry I'm trying to kind of kind of get you rolling with this but let's go back and let's look at this I lost my mouse okay let's go back and let's look at this circuit see see that you're you're going to want to take the voltage which will be the positive voltage which we could have like right if we connect it to pin 13 we could get the voltage from pin 13 so pin 13 needs to go to one leg of a resistor the other leg of that resistor needs to connect to the long leg of the led right the long leg of the LED needs to be pointed towards the positive voltage and then the other leg of the LED the short leg of the led needs to come back to ground or the negative and you can see that there's a ground pin right next to pin 13 so if we have pin 13 go to resistor the other resistor go to the long leg of the LED then the short leg of the LED coming back to the ground pin we could build this but we need to build it on this circuit board well how does that work well let's look at the circuit board and this is the thing that you have to understand is looking at it at the at the board here the thing to understand is the columns these little holes in the breadboard the columns are connected together the holes along the columns are connected together so if I brought one leg of the resistor into this column and one leg of the LED into this column those two legs would be connected together okay except for across this Center region so let's go back and look at the actual board do you see you have this kind of dividing layer all of these holes are connected together in a column all of these holes in a column are connected together but those two columns are not connected across this little divot that is a channel okay so let's go back and look here nothing sorry if I'm repeating but you really got to understand this and I have a lot of students that I teach and I just see it takes a little while to understand this so these holes are connected together anything that is plugged into these holes will be connected together these holes in this column are connected together okay but this is not connected to this the red is not connected to the balloon similarly as you go across a row over here as you go across a row I hope you can see my mouse but the little green row those holes along the rows are not connected gather and if you jump over this center channel those are not connected together so column is connected on the top column is connected on the bottom holes along a row not connected and holes across this channel are not connected but we do have some special rows these rows across the top are all connected together this row across the top is connected but this row is not connected to this row so first row all connected second row all connected first row not connected to second row similarly on the bottom the entire bottom row is all connected and the second to the bottom row is all connected and you can see that on the live shot here let me see if I can zoom in okay so you see on your board if you connect anything all the way along there it's connected or all the way along there it is connected but that row is not connected to that row so what is this for well a lot of times you might need a lot more than just the one or two ground pins like you see the ground pin on the Arduino what if you needed a lot of grounds well you could run a wire from the ground pin on the Arduino and then hook it up to this negative row and now all across this entire row that is labeled negative that's going to be a ground or if you wanted to bring 5 volts you can see that the Arduino has a 5 volt output if I can show it yeah you see that 5 volt output you can take that 5 volt output and then you can connect it to the plus row and then they're all connected together ok so you see the board is a way to plug components in and get nice secure connections nice secure connections that allow you to build this circuit man because students struggle with this I'm gonna go over this one more time okay holes along a column like you see in this red column they're connected holes along the column on the bottom they're connected the two columns are not connected together rows in general are not connected except for the top row is all connected the second row is all connected the second to the bottom row is all connected and the bottom is all connected so this will allow us to hook up a circuit so now what we need to do is we need to go to our Arduino kit and we need to find some things well what do we need to find let's go back and look at our circuit we need to find a 330 ohm resistor if you don't have this kit anything in that range will be okay a couple of hundred ohms probably 200 to 500 or 600 ohms would work you need to find that and then we need to get an LED and then we need to get some wires and so let's look in our kit and let's see if we can find some of this stuff we got our PC board we got our Arduino let's see if we can find some other components that we need for this project and so if I look here I find this envelope which has resistors in it okay what you have to see is these resistors have different values and what you've got to do is you've got to pick the one that you want and you can see this one set of resistors has a label on it to help you out we can talk on another day you can actually figure out what the values are by looking at these color codes but today we're going to cheat and just see that these are the 330 ohm resistors you can see that your kit also has some like 1k resistors I see 1k I see 5 k I see 10 ohms I see 100 you got a lot of different resistors here but what do we want we go back and we look at our circuit and we see that we want a 330 ohm resistor and so I will take this and I will carefully pull off a individual resistor don't bend these up keep them nice and then put the other ones back in okay and then put your little envelope back in down here okay you now have this resistor that you need what do I need now I need an LED so we come and my LEDs are right here in this little packet and we are going to use a red LED okay red LED so now I've got my red LED I've got my current limiting resistor and now I just need a few wires to hook this thing up and so your oligo kid has got a generous assortment of these wires so let's see if we can figure out how to hook this thing up let me see if I can kind of get this and this all together yeah I want to kind of try to lay it out physically like what it is going to be on the circuit diagram okay so let's let's try to do it like this alright where do we start well we start with the positive supply voltage where are we going to get our voltage from remember from lesson one we're going to get our voltage from pin 13 so we can control pin 13 so I need to get a wire and my goodness it looks like they've got these things in with a zip tie and do I have a knife yes I have a knife actually what I would recommend that you do is I don't have one handy I would recommend that you get a rubber band and try to keep all these things together so that you can keep your hit neat wouldn't it be funny if I like sliced an artery right here on YouTube and started bleeding profusely okay so I have an individual wire so let's look on this circuit diagram I want to go from the positive voltage which we're going to get from pin 13 so I'm going to plug that wire into pin 13 and you've got to really pay attention because it's very easy to be off by one so I've got the wire into pin 13 and then I am going to come over here to just a random column okay I'm going to just connect it to a random column and then what do I want to connect to I want to connect to one leg of the resistor what I like to do is try to keep things neat so I try to kind of make my resistors look like this so I can keep them neat now I want that voltage to be connected to the resistor so what do I do do I put them in the same row no if I put them in the same row in the same row they are not connected they need to be in the same what they need to be in the same column so I'm going to come and I'm going to put this resistor in the same column okay do you see that this resistor has one leg that is in the same column with this wire that is coming from the 13 volts okay so let's back off a little bit so you can see the whole thing now what do I need to do I need to connect to my led so the other leg the second leg of the resistor first leg of the resistor second leg of the resistor needs to connect to what the led did you watch lesson number two what's very important about an LED the direction matters and it's the long leg the long leg needs to go tour the positive voltage so here's the positive voltage so the long leg needs to go to the second leg of the resistor so long leg look how we're doing this let me see if I can zoom in again this is going to get annoying I think to you after a while but that long leg needs to connect to the second leg of the resistor so what does that mean it needs to be the same column okay so let's see if you can see this we kind of make it like that I really want you to see this okay long leg of the LED is in the same column as the resistor so now this is connected to this long leg of the LED is connected to the resistor the other leg of the resistors in the same column is this wire and then that wire is connected to pin 13 of the Arduino all right so now let's back off and let's see how we connected this and if you already have this figured out I'm sorry that I'm boring you but I just see the first time students do this a lot of times it's really confusing because this is an abstract schematic of the circuit and you have to turn it into a physical a physical connection so we've got the positive from the Arduino pin 13 going to the one leg of the resistor then the other leg of the resistor goes to the long leg of the long leg of the LED are we done no the short leg of the LED right here needs to come back and connect to negative which is ground where do we get ground oh my let's look at the Arduino I'll try to zoom back in and do you see the GND it's right by pin 13 that GND right there by pin 13 got to put it in carefully I think I got to put it in carefully okay so you see the red wire is in pin 13 and now the GND wire is coming here to this okay now before I hook this up we need to go back and write our program okay we need to go back and write our program so let's see if I can switch back over here let's fire up our Arduino environment and this will just be good review so you guys should already know how to do this okay and I'm going to go to a slightly different view here so you can see the physical circuit with the Arduino and the breadboard you can see that at the same time that you see the code that we're working on okay so what do we do to start a sketch this is review from earlier we're going to go two examples we're gonna go to basics and we're gonna go to bare minimum okay every Arduino program has two things it's got the void setup which starts with the curly bracket ends with a curly bracket and the void loop starts with a curly bracket ends with a curly bracket okay so what are we doing the setup we do things that we want to do one time what do we want to do one time well if we're gonna work with 1013 we have to do the pen mode we have to tell it that we're working with pin 13 so how do we do a pin mode we go pin2 mode2 orange happy little color saying it represent recognizes that that command if you did not type it in right it would not turn orange okay what pen are we going to work with 13 and 13 is going to be a what output all capitals all right every line in Arduino almost every command ends with a colon we have now set this up to tell it that we're working with pin 13 pin 13 an output that's what we're gonna do once what do we want to do over and over we want to turn the LED on and then turn it off so how do we do that we do a digit toll right capital W everything else lowercase turned orange means we it recognizes the command we got to give it the parameter so we open the parentheses what's the parameter we got to tell it what pin we're connecting to what pin are we connecting to 13 now we've got to tell it are you gonna turn it high which is on are you gonna turn it low which is off well we want to turn it on so we're gonna say hi okay now every almost every command in Arduino ends with a semicolon now what do we want to do well we want to leave it on for a while so we do a delay so we sit for how many milliseconds that one parameter for the delay command and it is in milliseconds we are going to put 500 milliseconds 500,000 milliseconds in a second so 500 milliseconds is a half a second almost every command ends with a semicolon so we turn the LED on we wait half a second then we're going to turn it off so did cheat all right what are the parameters well we're still talking to pin 13 and now we turn it lo hello W tightly okay and with a semicolon now what do we want to do well we want to leave it off for half a second so we say delay and then 500 okay and then we end with a semicolon all right now what we are going to do is we are going to download that into the Arduino so we come up and we get this little right mouse arrow right Mouse all right right arrow we see the happy little green bar okay and now it is all hooked up remember just make sure that you're on the right port you can see if you come too huell's port that you can see that my Arduino is on comm three years should say Arduino but it might not be calm three you pick whichever calm has the Arduino byte and then make sure you're doing the right board we're doing an noe set it here for you know with that stuff it should work and so now we've downloaded the program let me come back over here and let's just look at this circuit so you can see that on our circuit we now have the program in the Arduino and we have everything on the circuit except for we had not made the connection from the short leg of the led back to the negative which is the ground and so we need to take this which goes to the ground all right it goes to the ground on the Arduino and we need to connect it to this short leg and so look boom what is happening boom the LED is blinking we have built our first circuit in that circuit is controlled by the Arduino which is controlled by the program that you wrote so let's come back over here let's blink differently again okay let's do something a little more exciting let's jazz it up a little bit let's go 50 milliseconds on 50 milliseconds off this is going to be brent blinking really fast in fact I don't even know if you'll be able to see that's over here okay we downloaded it and look at that limited today it's going really really fast so now you can control this led by you can control the LED by the program that you're riding does that make sense you changed the program and you're able to control how this blinks okay guys and we have done some really neat stuff today let me let me play around let me just do something else okay all right so so let's look over here let's look over here mmm where am i where am i let's go to this one okay do I have to use pin 13 no let's use I can use anything from pin 2 all the way to 13 0 & 1 those are used for communication so you don't want to use that let's use a different pin instead of pin 9 let's take our let's take our red wire out of pin 13 and let's put it on pin 8 or yeah let me put it on pin 8 I missed it by one so always check this carefully okay so now I mean I'm on 10 8 I'm on pin 8 instead of pin 13 when I plug it into pin 8 it doesn't work anymore the LED isn't blinking why because on the program I told it that I am working with pin 13 so if I want to make it work with pin 8 if I want to make it work with pin 8 which I'm connected to now over here I've got to do the pin mode now for what 10 8 now what I still write digital right 13 high no I'm gonna write digital write pin 8 high in digital write pin 8 low now what do I do ok be watching this LED as I download the program now I'm reprogramming it to use pin 8 and look at that now it's working with an 8 okay so you have learned how to use the breadboard you have learned that you need to use a current limiting resistor you have now written a program where the Arduino is you're writing a program in Arduino which is controlling an external circuit this is huge because an LED isn't that exciting but you could put exciting things on here instead of controlling an LED you could be controlling a PS or a servo or all types of different things so this is really huge that we can that we can do this alright I need to give you your homework for this assignment and on your homework what I want you to do is instead of having one led that you're controlling I want you to control three LEDs I want you to have a red LED a green LED and a blue LED and I want you to blink the red LED five times and then blink the green LED ten times and then blink the blue LED 15 times okay so your program is going to be more complicated are you going to be able to do it all from pen eight no this time you're gonna need how many pins you're gonna eat three pins how many pin motes you had to do a pin mode for each one of those pins and then you can have to write the code here where you like go on off on off on off on pin eight and then you're gonna have to go on off on off on off on off on off on off on the pin that you have connected also each resistor is going to need its own current limiting resistor so you're gonna have to have a resistor an LED a resistor an LED a resistor an LED and then your code is gonna have to do that I think you guys can do it okay I think you can guys can do it palma quarter top tech boy comm if you like this lesson think about giving us a thumbs up think about sharing it think about actually doing the homework because this time around I want to be giving you guys assignments where I show you a simple thing I have you go out and do a more complicated thing Palma quarter from top tech boy calm I am enjoying my iced coffee and I will talk to you guys later
Info
Channel: Paul McWhorter
Views: 631,921
Rating: undefined out of 5
Keywords: Breadboards, Prototyping, STEM, PC Boards
Id: CfdaJ4z4u4w
Channel Id: undefined
Length: 30min 47sec (1847 seconds)
Published: Thu Jun 06 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.