Arduino Uno R4 WiFi LESSON 5: Explaining How Computers Work Based On Binary Numbers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is Paul mcarter with toptechboy dcom and we're here today with episode number five in our incredible new tutorial Series where you're learning how to think like an engineer using the Arduino Uno R4 WiFi what I will need you to do is pour yourself a nice tall glass of ice cold coffee that would be straight up black coffee poured over I no sugar no sweeteners none needed and as you're pouring your coffee as always I want to give a shout out to our friends over at sunfounder sunfounder is actually sponsoring this most excellent series of video lessons and in this class we will be using the sunfounder elite Explorer kit now most of you guys probably already have your gear by now but if you don't look down in the description there is a link over to Amazon you can hop on over there and pick your kid up and believe me your life and my life are going to be a whole lot easier if we are working on identical Hardware but enough of this Shameless self-promotion let's jump in and talk about what I am going to teach you today what we're going to talk about is we're going to talk about how do computers actually work how do these arduinos work how do single board computers work how does your desktop computer work all of this revolutionary technology that seems like it's magic how does it actually work and I'm going to give you an explanation today that I hope that you can follow along with because again it almost seems like magic all the things that you can do with modern electronics and modern computers so it's a pretty complicated topic but how would I start I would start by saying say all computers and electronics and single board computers all of that modern technology works on a pretty simple concept and that concept starts with everything that you're dealing with on a computer is represented by a number okay everything is represented by a number well how about if you have the numbers 1 2 3 4 5 well that's pretty easy they're represented by numbers already well how about if you had an alphabet like if you had letters a b CDE e f g well what you could say is the letter A will be represented by the number one the letter B will be represented by the number two the letter c will be represented by the number three and so we can give we can know all of the alphabet by assigning a different number to each one of the letters well then how would we do words well we would just string those letters together so hello might be 74 4361 or something like that you see you would assign numbers to letters and then string those letters together to create a word or an encyclopedia or a library so a whole lot of knowledge and a whole lot of power can be realized just by assigning numbers to letters well how about colors same thing you assign numbers to Colors well there's a lot of different colors but they're all made up of red green blue RGB and so you can represent any color possible just by having independent numbers of how red is it how green is it how blue is it so the red value is assigned a number the green value is assigned a number and the blue value is sign assigned a number and so with those three numbers we can we can identify any possible color so we can do numbers we we can do letters we can do words we can do books we can do libraries and we can do any color well how about a movie well a movie has a frame and that frame is a bunch of pixels that are in rows and columns and we assign to each one of those pixels a what a color RGB now it's a whole whole lot of numbers but a movie a movie is nothing but just a whole bunch of numbers coming by first the numbers Define the pixels then it defines the frame and then you cycle through the frames to get the movie how about music well tones you do what you assign numbers to tones so if you can convert everything into a number then you can do all types of different things as we see on these modern computers simply being able to handle numbers okay now how do the computers handle numbers okay how do they handle numbers because right for them to work they have to be able to understand and grasp and hold on to numbers how is that done well what you have to see is a computer now if you're talking about the hardware the computer the integrated circuit All Electronics all desktop computers all single single board computers new computers old computers all they are is a whole bunch of onoff switches now in the early days the onoff switch was a vacuum tube and a vacuum tube is like this big it's as big as a you know it's as big as a uh light bulb and if you wanted to have a thousand switches you would have to have a thousand of those vacuum tubes and actually the first computers were built based on vacuum tubes and they could do computation you could write programs on them and then what you found is those those uh vacuum tubes they didn't last very long they burned out really quickly they used a huge amount of power and they got really really hot okay and so because of that they used huge amounts of power they heated the room up you know they just were not practical but they showed that you could build a computer using nothing but switches nothing but onoff switches then what came along next was these uh this guy primarily Shockley invented what is called the transistor or the solid state switch and there instead of having this great big white bulb siiz vacuum tube to be the switch his switch was smaller than a grain of rice okay it was a very small switch and it was solid state and it didn't use very much power and it never wor out it never burned out it would kind of last forever and so with that step forward we were able to get much many more switches into our computers and our computers became more sophisticated more powerful well then somebody had the great idea well if these little transistors these little silicon switches are so great why are we building them individually and then wiring them up on a PC board or on a on a computer board so someone then had the great idea of build all the transistors at the same time on a piece of silicon on a silicon wafer and by doing that you can build the whole computer you can build all of the switches at once and then you can as technology advances make the switches smaller and smaller and smaller allowing you to have more and more and more power powerful computers and so let's say maybe the first integrated circuit the first computer chip had maybe a thousand or several thousand switches and you could do computation like maybe you could have something that would be a simple calculator but then as the technology advaned they begin to make the switches smaller and smaller and smaller meaning that on a single piece of silicon you could begin to connect more and more and more of those transistors together and what happened is something called Mo's law and what Mo's law is is that the number of transistors the number of switches on a silicon chip was doubling every 18 months so sooner than two years they were doubling how many transistors they could build so on a given chip so let's say they started out at a th000 it went from 1,000 to 2,000 to 4,000 to 8,000 to 16,000 and within some small number of those two-year periods we went from an integrated circuit that had a thousand switches to today an integrated circuit has like billion with a B billion or multiple billions of transistors or switches on a single chip okay now that is pretty incredible and again the way they did that was the chips didn't get bigger the transistors got smaller okay so let's review what we've learned so far in order for a computer to work you have to represent everything by a number okay now what we've seen is what can we do well I can make a whole bunch of little switches now how do we take a whole bunch of little switches and how do we make those little switches represent numbers okay how do we make those little switches represent numbers and so to understand that let's think of a switch so I've got a switch here and the switch can be either what or what it can be off like that or it can be on and that would be like this where the connection has been closed it can be off or it can be on well let's assign a number to those things if that switch is off we're going to call that a zero and if that switches on we're going to call that a one okay switch off is a zero switch on is a one so if I have one switch I can count to zero and then I can count to one okay so I got two numbers zeros and one and I can count to one well in most applications you need numbers higher than one so what do you do in those cases well to explain that what I really need to do is to really explain that I need you to First understand how our decimal numbers work like I know you you you know how to use them but we got to really think about what's going on how many characters do we have how many different symbols do we have to represent numbers we have 10 and that is the number 0 1 2 3 4 5 6 7 8 9 what is our problem now we're out of characters 0 to 9 is 10 characters we've used up all of our characters we could count to nine and then we are out of characters just like in the switch example we could count to one and then we were out of characters now one thing they could have done is they could have come in and said well a squiggly is 10 and an X is 11 and a uh symbol like this so we could just keep adding symbols symbol symbols but then you would never be able to remember all of those and so somewhere eons ago what they decided to do is that youve got to cycle through the numbers again so let's think of how we count 0 1 2 3 4 5 6 7 8 nine no no no don't say 10 don't say 10 if you say 10 you're not understanding this right right we're adding one each time one 2 3 4 5 6 7 8 9 now we have a problem we've run out of characters so when we add 1 to 9 what do we get we get 0 carry the one we get zero carry the one then we can go 11 12 13 14 15 and so forth when we get to nine again what do we do 9+ 1 is 0er carry the one 9 + 1 is 0 carry the one now if you want to understand how computers work you've really got to kind of understand that you've got to understand that when you get to nine you're out of characters what does it do it goes back to zero and it carries the one so let me clear this off let me put my onof switch back up up here so this is going to be off okay like that and that is a what that's a zero and then I'm going to have a switch that's on and that is going to look like this where the switch is closed okay and that is a one a zero and a one so now let's go in and let's count to 15 let's count to 15 using our decimal numbers and so with decimal numbers we're going to have two different places that we use okay two different places that we use and this is going to be 0 1 2 3 4 5 6 7 8 9 9 + 1 is what say it right 9 + 1 is what it is zero carry the one now I I add one 11 12 13 14 and we'll just count to 15 okay now how could I do that with switches if I wanted to do that with switches I would need four switches okay I would need four switches so we're going to have one 2 3 four switches now the first number is what zero and just like this is a zero what's this digit this digit also a zero so I'm going to go back and put my zeros in even though normally we don't write the leading zeros let's write them just so we can quote sort of see what's happening here like that okay so in decimal the number Z is 0 0 well we're going to have four switches okay we're going to have four switches and those switches are going to be what zero or one so those switches for our first number is going to be 0 0 0 0 now we're going to add one over at the right so 0 + 1 one is what it's one and then these remain zero now this is your make or break moment right this is you're either going to get it or you're going to miss it but I want you to think this is the most important thing that I'm going to show you today what is one we got 0000 01 what if we add one don't say two no 1+ one is not two 1+ one is what what's my problem I'm out of characters so what do I have to do I have to cycle back around so 1 + one is what 0o carry the one okay now I'm going to add another one and over here at the right 0 + 1 is 1 1 + nothing is 1 and then 0 0 now I've got 0 0 1 1 that would be what three now I got to add one 1 + 1 is 0 carry the one and so now I have the one carried and the one that's there what's 1 + one it is 0 carry the one and then a zero now I'm going to add one this is going to be easy right this is going to be one 0 1 0 now I add 1 1 + 1 is 0 carry the one 1 + 0 is 1 and then the one comes down and the zero now add a one that's going to be easy and that is going to be 1 1 1 0 so the number seven would be 1 1 1 0er how about eight this gets a little harder 1 + 1 is 0 carry the one 1 + 1 is 0o carry the one 1 + 1 is 0 carry the one now it starts getting easier again 1 0 0 0 + 1 is 1 0 0 0 1 1 + 1 is 0 carry the one and I've got the 0o and the 1 now I add one and that becomes a one 1 0 1 and now I add one 1 + 1 is 0er carry the one I've got the one that was there and the one that was carried 1 + 1 is 0er carry the one and then I've got a one now I add another one it becomes 1 0 1 one and now 1 + one is zero carry the one and then I've got the one and the one now I add one and I get what for 15 one one one one so do you see if I have four switches I can do what I can count to 15 okay but do these single board computers have four switches no they've got billions and with billions you can do any number that you want and you can do any number of different numbers and you just have enough switches to your heart's content so you can do anything because you can do anything by representing anything by a number and you can do any number by representing it with ones and zeros and you can recognize or you can realize ones and zeros in Silicon by making little bitty switches does that make sense okay now let's think of this let's think of one other thing now over here on our decimal numbers how much is this first place worth this right column how much is that worth each one you multiply the number by one and so if you have three that's worth three if you have five that's worth five how much is this next place worth each one is worth 10 so if I have the number one 1 that is 1 * 10 is 10 + 1 is 11 Okay so we've just got to figure out those same things over here for our four switches how much is this rightand switch worth it is worth one times whatever the number is the next one is worth two times whatever the number is okay let's see this you see this has a one here in the second column that's worth two that's the number two all right the next one is worth four and the next one is worth eight so just like in decimal each next place is worth 10 times as the much as the one before it why because we have 10 characters so every time we go to the next place it's worth 10 times as much as the previous place but in the case of using switches we have how many characters we have two so each place is worth twice what the one was before so if we had five switches the fifth one would be worth 16 and then 32 64 128 isn't that kind of strange do those numbers ring a bell with you you know 128 256 512 1,24 yeah when you're buying memory and computer related things it always sort of has numbers like that why because it's based on base two numbers okay now what I want you to do is I want you to think how can we take a binary number and figure out what it is in decimal well here like let's take this one okay well it's got a one in the four column so it's going to have four and it's got one in the eight column so it's going to be worth eight and so all together it's going to be worth 12 okay or if we come up here to this it has one in the one column so that's worth one it has one in the two column that's worth two and then the whole thing is worth three so you see how that works that works very very very well okay now this is what I want you to do okay this is what I want you to do you remember your circuit from last week where you built the circuit with four LEDs you built the circuit with four LEDs if you haven't built this yet or if you're just jumping into this lesson go back go back to lesson number four and watch that and I'll show you how I show you how to hook this circuit up but what I want you to do now is program up a binary counter I want you to program up a binary counter where these led count in binary okay well how would we do that let's come back over here and let's think about it we said that the and now instead of thinking about numbers we're going to go back and kind of think about the physical world okay we're going to go back and we're going to think about the physical world in those four red LEDs what would I want uh what would I want what would I want the LED to be to represent the number zero which in binary is 0 0 0 0 well I would want those four led to be off off off off if I wanted to represent the number one what would I do it would be off off off on okay how about the number two it would be off off on off okay how about the number three off off on on okay do you see that so do you see that you can come over here you can come over here and you can make these things count in binary because what do you know you know how to turn the LEDs on and off you know how to delay okay and so you should be able to create the patterns that will count from 0 to 15 at 15 what's your problem at 15 your problem is you are out of switches you you've used all of your digits and they're all one so if you would want to count more than 15 you would what you would need another switch here but you see you can keep going because if you can do this one to 15 you could do this to one to 100 bazillion right you just need to add more switches and and the switches add up quicker than you think okay the switches add up quicker than you think because each time you add a switch you're doubling the number of numbers that you can represent okay now what would you do well you could take those you could take those numbers these are good numbers now they're called binary I should say that this is binary you can represent any number with binary you can achieve binary with on andof switches and you can represent anything that you would want to represent by casting it in terms of numbers what type of numbers are we going to cast it in terms of we're going to cast it in term terms of binary numbers okay guys man I hope that you guys are enjoying this it's just when you think of the the way computers work it just really seems like magic and I'm hoping that I'm bringing a little Clarity to you that it's really pretty simple it's nothing but a whole bunch of switches and those switches are either on or off and each switch either represent resents a one or a zero now I guess I can say one more thing how is this switch how does this switch operate okay okay let's say that here is one terminal of the switch here is the second terminal of the switch and down here is a third terminal for the switch and if I put a voltage on that third terminal the switch closes so let's say I put V equal 5 the switch closes if I put V equal 0 the switch opens so these switches that make up a computer board those switches are voltage controlled switches and that's what a transistor is a transistor is a voltage controlled switch and if you look at a transistor in fact you can dig some out of your sunfounder kit there's some in there you'll see they have three leads one is one connector the other is the other connector and then you have the control pin which will either have one to two be open or have one to two be closed okay guys man I uh I hope you're enjoying this so remember when you do this homework what you've got to do is you have to make a little video of your LED counter working you have to show me your circuit you have to show me that the counter works and you have to show me your code make a video of that post it to YouTube in the description of your video link back to this video and then in this video in the comments down below leave a comment where you put your homework and then I will see that and I will go over to your video and I will look at it and I look at every single homework that's posted and I'll make a comment on it okay so that is your homework make the binary counter and then post your your homework solution to YouTube okay guys I hope you are having as much fun taking these lessons as I am making them I want to give a shout out to you guys who are helping me out over at patreon you guys that are helping on patreon you're the ones that keep that are keeping this great content coming I appreciate that you can also help me by leaving a thumbs up or leaving a comment down below also subscribe to the channel when you do make sure you ring that Bell so you'll get notification when fure lessons drop and most importantly share this video with other people because the world needs more people thinking like an engineer and fewer people sitting around watching silly cat videos Paul McCarter with top Tech boy.com I will talk to you guys later
Info
Channel: Paul McWhorter
Views: 6,242
Rating: undefined out of 5
Keywords: STEM, LiveStream, TopTechBoy
Id: cSOpMpynXAI
Channel Id: undefined
Length: 28min 50sec (1730 seconds)
Published: Thu Feb 22 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.