do you know what this is It's the backbone of all of Technology do you know how it works would you know how to put it into a circuit or build something around It Well by the end of this video you will so if you haven't figured it out yet this is a transistor a transistor can act as an amplifier or a switch but to go from that basic knowledge to building an entire computer is a pretty big leap but we're going to start you down that path first we're going to build a simple circuit then we're going to combine two circuits to build an oscillator after that we'll build a toggle circuit to turn the oscillator on and off and then at the end we're going to have more than just an abstract understanding of transistors we're going to have a fairly complex system all built from scratch for each of these circuits I'm going to build on a breadboard but I'm also going to show a schematic so you can see what's going on a little better the parts we're going to need are four npn transistors we use the 2N 2222 it's probably considered the most common in versatile transistor out there we're going to use 10 1K resistors we will only need one 10K resistor four LEDs two blue one green and one red a 22 microfarad capacitor a one microfarad capacitor two tactile buttons a pzo buzzer a diode for this project you can use just about any diode an optional thermister an optional photo cell some wires and a breadboard one of the easiest ways to power your projects are with a USB power supply a little 5volt power supply and an old USB cable I just cut the end off strip the wires back tin the wires and you can plug those right into the breadboard if you'd like to follow along with this and future projects we we offer a complete kit that has plenty of extra components in our store all right so let's get into this we're going to start with the standard full size breadboard first thing I want to note is what's going on behind the scenes on a breadboard you'll notice you have two power rails one on each side they run the entire length of the breadboard on these particular models you have your positive and negative but something to note is they are not connected so this is a separate power rail than this the other thing to notice is on the build section of the breadboard which is between the power rails there's two sections where the power rails are connected this way the build section they're connected this way and they are separated in the middle so here's what it looks like inside of a breadboard so you got the power rails which go the entire length this way and then you have your two build sections which are split in the middle and these are connected so all these holes here are connected this way and all these are connected this way and then they're divided in the middle now that we understand how a breadboard Works let's jump into building a simple circuit I think if we can break everything down to its least common denominator it's going to help us digest the whole project so on an LED there are three primary ways to tell which is positive and negative if the leads haven't been cut the longer one is always the positive if the leads have been cut one thing you can do is look for the flat spot on one side one side always has a flat spot you might have to catch the Light just right but that is the negative so the flat spot is on the negative if for any reason you can't see that flat spot and you're still a little confused you can look inside the LED and you can see there's a bigger portion and a smaller portion the bigger portion is always the negative okay so I already have this one cut down and I have you can see the negative is on the left there's the flat spot and we're going to put this in this way and we're going to start wiring this up so now we have the LED in there we need to connect I'm going to start with the ground the negative we have the negative to negative and then I'm going to add the positive here now I'm going to hook it up and ah there we go so we burned it out I did that intentionally because I want you to know that you always have to run a resistor for an LED um we're not going to go into all the reasons why right now but just know you always want to run a resistor with an LED and since we're using a 5volt power supply I went ahead and chose a 1K resistor because that's more than enough to protect the LED I'm going to take the one that we burn out and here's the thing it's kind of hard to tell you can't really look in it and see that it's burned out you just have to test it and know so I'm throwing that one away and we're going to bring in a brand new LED figure out which side's the negative and here's the thing it's not a big deal if you accidentally install it backwards I'm going to intentionally install it backwards so I ran it without a resistor and now I'm running it with a resistor but I'm running it backwards and it just doesn't come on so we can go ahead and turn that around and you can see that now it's wired in properly so that is a very basic circuit I know it's hard to see sometimes how things are connected on a breadboard so I'm going to use a schematic here just to walk through the basics I thought it'd be nice to use schematics because you can see what's going on a little more clearly and we have some basic symbols here you have your power supply and it's usually labeled what voltage it is and then this is the symbol for ground um you have the little squiggly line is your symbol for a resistor and then the LED is typically a a diode looking symbol but with the circle around it and the little arrows I guess emanating light so in this particular circuit we have uh and I'm going to show you in conventional current flow which is from positive to negative uh so you have your power coming from the positive it goes through the resistor the resistor slowing down the current a little bit so or limiting I should say the current so it doesn't burn out the LED goes through the LED lights it up and returns to ground and that's the uh the basic circuit right there now what I'm going to do is invert the circuit so what I did is effectively shorted out the circuit but it's not a true short because we have a 1K load here so at 5 volts a 1K resistor shorted across the leads is fine it's not going to blow it out but what it does is it gives the electricity a shorter path to follow because the wire has much less resistance than LED I showed you with a wire to make the point but now I'm going to show you with a button so now when you have a button there you push the button the light goes off that's why it's an inverted circuit so when I activate the signal which is the button it actually turns the light off the reason I'm showing you all of this is because it helps demonstrate how a transistor works on this particular transistor you have a collector which is the first leg over here you have a BAS base and then you have an emitter so what it's doing is we'll pull the base out here separately this is like a switch when you activate the base by applying a voltage you connect these two what we're going to do is we're going to treat this very similarly to the switch that I just showed you we're going to activate that Center leg which is going to connect the outer two it'll create a short behind the LED turning it off now the problem is I just did something very bad and I wanted you to see um that in this case we were okay but sometimes you're going to end up blowing your transistor by doing that why because we didn't have a resistor so resists are our friends that helps regulate and limit the flow of current because lots of current will harm things we're going to add a resistor to the base and when we power that base up you'll see it activates the transistor which is turning the LED off okay for the sake of clarity I'm going to uh come back to the schematic here and talk through it this is our our wire lead here it's coming from power through the resistor into the base of the transistor which is activating it but let's just assume that's disconnected for a moment and let's follow the path so if this is not active this is like an open switch it means there's no connection across here to here so all of this is irrelevant if that's not connected at least that's how we're going to look at it for uh this diagram so what's happening is the power comes out goes through the resistor and it's going to follow the path of least resistance and since this is an open circuit it's going to go through the LED back to ground and it lights up and that is just your simple circuit right there now once we activate the base we are closing this connection here so that's like a almost like a solid wire going across there so what happens is the electricity comes in goes through the resistor now this has lower resistance than this so it'll actually flow through that down here robbing this of any energy and not lighting up that led so that's how this circuit is working now that we've completed our inversion circuit we're going to go to the Second Step creating an oscillator to start we're going to have to duplicate this exact circuit that we created okay so now we have our circuit duplicated you can see when we add power we've got two independent circuits right now so let's just test them we're going to run power to the first one turns off second one it turns off now here's where it starts to get a little bit interesting let's uh go ahead and connect them together and see what happens right now what I'm going to do is I don't have to add these little jumpers but I want to make it a little visually cleaner I'm going to add these little yellow jumpers so we have a very clear input and output okay so just to be clear here we've got it set up so the the input of the resistor is the input of this inversion circuit the yellow is the output So currently because it's an inversion circuit when the when the board is powered up we have 5 volts coming out of this circuit So in theory if I take the output of the first one and run it to the input of the second one what do you think will happen correct it'll turn it out because this is powered so it's sending 5 volts and we just sent that 5 volts over to the other circuit turning it out so what do you think's going to happen if I power the first one now when I power the first circuit it turns the first light out since it is no longer sending 5 volts to the second circuit the second light turns back on now that we know we can send power between the two circuits we can create a loop we already have the output of the first circuit connected to the input of the second circuit so we just need to connect the output of the second circuit to the input of the first circuit time for the big reveal and nothing is happening well it looks like nothing is happening that's because everything's happening instantaneously if we want to make it interesting we want to create this oscillator we have to introduce a delay to introduce a delay we're going to use a resistor and a capacitor we're not going to go into the details as to exactly how it all works I just um I'm going to show you that we want to take the output of the second one and run it to the input of the first one with a capacitor and the wire is going to directly connect the output of the first one to the input of the second one and then because a capacitor doesn't actually pass current we need a little recharge here with a 10K resistor between the input and output of the first one and this is going to create a little bit of a delay and it gives us an oscillation okay I have the schematic here so we can see how everything's hooked up um we have two inversion circuits just uh you know if you want I can I can segment these off you got one here so this is one inversion circuit and then you have the other right here and those are your two inversion circuits and they're connected and parallel the only two components we added uh we added a wire you know from the out to the in and then we added a capacitor from the in to the out over here and then a resistor in between on this side between the in and an out and that is to recharge that cap capacitor so without going into all the Gory details that's the basic wiring diagram of this circuit so you can actually change the speed of the oscillation by changing the size of the capacitor the smaller the value on the capacitor the higher the frequency of the oscillation so that's a visual oscillation a lot of people may or may not know this but an onoff or a high low oscillation is really no different visually or audibly it's an onoff that means if we added a little speaker we're going to put one end here and I'm going to run that to ground you should be able to hear what's going on so that just sounds like a a little bit of a click but let me move this out of the way so I can get everything in there now I'm G to use a smaller value capacitor and it looks like they're both on but it's actually flickering so fast you can't see it and what that's going to do is give us a higher frequency so we're going to have a a much faster oscillation which equals a higher frequency and you'll be able to hear it in the speaker oops extra points if you notice my mistake I connected the speaker wire to the positive leg of the power rail rather than the ground in this case it's okay it'll work the same either way the reason is because the signal going to the speaker is just an onoff signal 5 volts to zero or ground and it's just pulsating between those two states so technically you can go to positive or ground it just needs a reference all right up to this point I've been giving you just enough information to be dangerous and have some fun I'm going to go ahead and try to explain in a little more detail what's happening here so this is our oscillating circuit where we have two inversion circuits we have our little delay circuit up here which is just the capacitor and the resistor and then we added the speaker so what's happening is in in concept it's very very simple concept but it's a little harder to explain the flow of electrons you have two inversion Gates or two inversion circuits and one turns on and while it's on the capacitor charges up once the capacitor is charged then it activates the other one which turns the first one off so what's happening is as you get this oscillation because it uh there's two states to the capacitor fully charged and fully discharged and as it goes one way and the other it turns on one and then the other so again without going into all the Gory details of uh the electron flow that's the basics of it and these two allow that to happen now what the speaker is doing it's just piggybacking off of what's happening over here so through this line you're getting an oscillation of you know positive negative positive negative and uh when I connected it up on the board I actually connected it up uh wrong I I connected what was supposed to be on ground to the positive actually I'm missing a little node here I just realized that um the node should show you that it's connected to this and not this so my apologies um but when I connected it to the positive it still made a sound it's because all this is doing is giving it a a positive negative uh pulsation um and then it going back and forth it's making the speaker vibrate and that's what gives you the sound so whether you connect it to ground or positive you're still going to get an oscillation now that we have an oscillating circuit we need a way to control it we're going to do that with a toggle CC circuit known as an Sr latch the really cool thing is the new circuit we're going to build is very similar to the Circuit that we've already built so to build our Sr latch we're going to need the same circuit the inversion circuit we're just going to duplicate both of these over here now we duplicated our two inversion circuits we're going to connect them together we're going to take a 1K resistor and go from the output of number two back to the input of number one of this circuit and then we're going to take the output of number one and go to the input of number two and if we power it up at this point you're going to see that one of them is active and the other is not so let's just run power to the input of the first one and you can see it switches to the second one now we're going to run power to the input of the second one and it switches to the first one that is a basic Sr latch but just to make it more official we are going to add some little tactile buttons now you're going to see more wires added here but don't get confused it's we're just doing the same thing that I just showed you with the red wire we're just going to make it work with a push button the first button we are going to put to the first inversion circuit and then the second button to the second inversion circuit set reset set reset all right I'm going to do my best to try to explain an Sr latch and how it works very quickly so what we're doing is we have the output of this one going through a resistor to the input of this one and then the same thing going back the other direction from the output of this through a resistor to the input of this one and these resistors are the same value so it creates this hold State and nothing changes so if this one's active then it stays active if this one's active then it stays active but they can't both be active at the same time we added two push buttons essentially to give one circuit or the other a little extra juice and what that's doing is it throws that balance out of balance and whichever one has more juice becomes the active one I created a little um visual display of what's Happening Here with some popsicle sticks in a marble so what we're doing is again it's in a hold State because everything's um in Balance uh but both can't be active just like a you know just like this you can't have both sides down at the same time so what's happening is you push one button and it favors that side then you push the other button and it favors that side but then it retains its hold state but that's essentially how it's working okay now it's a little confusing because both lights are blue we want to create an onoff switch so let's disconnect our power we're going to swap this one over here with a red light and that's going to simulate our off position and then we're going to swap this one with a green one all right let's power it back up now we have an easy way to visualize on and off all right I'm I'm going to zoom out a little bit and you can see we've completed two independent circuits we have the SR latch we just created and the oscillator we completed in the step before we can't hear the oscillator currently because I disconnected the ground wire I'm going to disconnect this so you can hear me and the next piece that we're going to put in is called a diode this diode allows electricity to move in One Direction but not the other the reason we want to use a diode is we want to be able to feed power from the SR latch over to the oscillator without a back feeding back to the SR latch these two circuits connect together from the output of the SR latch to the input of the first inverter on the oscillator we're going to connect this back up so we got our sound and now we're going to be able to turn our sound off on off you might ask why would you want to turn a an annoying tone on and off I'm glad you asked what if we added a photo cell a photo cell is essentially a resistor that allows current to flow whenever light hits it if we add this photo cell to the on position you can see it comes on I'm going to cover it up and whenever the photo cell is exposed to light it activates the circuit and you can't turn it off because it's still exposed to the light so I have to cover it up and I can reset it now this one's kind of interesting we have a thermister a thermister is a resistor that is extra temperature sensitive okay we're going to reset it and here's what happens let's warm it up and you see it activates it and then you hit this to reset it so what's really cool about a thermister is you can adjust the temperature range and now you've got a little warning device as something gets over a certain temperature so with this one component we were able to make a more complex system we started with a transistor using it as a switch we're able to build a little circuit around that combine that into a bigger system and eventually come out with a practical application there's a lot you can do with this and there's way more than I was able to cover in this video I hope you were able to learn something but more importantly I hope you were inspired I wanted to make this video because this is something that helped me get over hump I was able to learn so much more once I I broke stuff down to its basic components like that if you like this video and you want to follow along we sell the kit in the store it's got extra pieces parts so if you burn out an LED or destroy a a transistor it's fine there'll be extra pieces in there also in the description we're going to have links to each one of these schematics and we will also have all of the schematics that we ever make on our website so you can always get them there I know everybody ends their videos the same way I'm going to do it my way I'm going to end with a joke why did the chicken cross the road to hit the like button all right now subscribe I'll see you next time [Music] sh