so this little guy I have here is a
transistor and the schematic symbol for
it over here is is this diagram here and
you can see just to kind of orient
there's the three leads on the
transistor and those correspond to the
three things here so we've got an
emitter a base and a collector and just
to kind of orient ourselves this would
be the emitter the middle lead is the
base and this lead is the collector so
that's just kind of how this corresponds
to the schematic symbol for it and what
a transistor is is it's basically a
current switch what that means is that
if we establish a current from the base
to the emitter in this direction
that'll switch the transistor on and the
transistor will allow a much larger
current to flow from the collector to
the emitter so what we can do with that
is something like this which is the
circuit that we've got set up over here
and basically what this circuit does is
we've got a switch that allows us to
complete a circuit that allows current
to flow like I said from the base to the
emitter from the base to the emitter so
if we close this this little switch push
this button that establishes a circuit
like this and causes current to flow
from the base of the emitter that turns
the transistor on once the transistor is
turned on then current is then allowed
to flow from the collector to the
emitter in this direction and that
allows this sort of second part of the
circuit to work where current will then
flow from the battery here through this
resistor through this light-emitting
diode or LED which will turn that on
let's see is light up and then through
the transistor and then if we aren't
putting current from the base to the
emitter then transit or shuts off and so
this this other part of the circuit will
shut off and the LED will shut off so we
can see in the circuit the first part of
the circuit we've got from the positive
voltage rail here we've got this
resistor that goes through the button
and then into the base of the transistor
and then that will allow us to get that
first current flowing to turn the
transistor on and that will go back out
through the negative terminal here and
once the transistor is on that will
allow current flow from the positive
rail here through the resistor through
the LED into the transistor through the
transistor now
it's on and then out through this this
negative rail so if we push the button
transistor turns on and consequently the
LED turns on okay so far so good let's
take a look at another circuit which is
on the other half of this red board here
and in this circuit we've got something
a little bit different going on we've
got the the transistor is is off but
with the transistor being off we have
this part of the circuit here which
actually allows current to flow through
this resistor and then through the LED
so the LED is actually already on which
you can see right here so the LED is is
on right now but if we turn the
transistor on then we'll actually sort
of allow current to flow through the the
transistor here and that will lower this
the voltage potential of this node and
so instead of having a positive voltage
here that allows current to flow through
the LED we we won't have a voltage
differential between the two parts of
the transistor when the transistor is on
and so that will actually have the
effect of turning the LED off so if we
do that we see the LED turns off so in
this case we're using this transistor as
a switch to kind of invert the the
voltage here so if we look at the
voltage here right now it's zero volts
because the switch is is open and the
LED is seeing a you know a positive
voltage and then if we turn the switch
on we have a positive voltage here but
then we get zero volts differential here
across the LED and the LED turns off and
so this is this little circuit is called
an inverter and there's there's actually
a symbol for it and that's this little
triangle with a circle and there's a
sort of a truth table for the logic it's
pretty simple if the input is off the
output is on or if the inputs is zero we
kind of use that as a to represent off
the the output is on if the input is on
then the output is off pretty
straightforward so let's look at some
other logic circuits that we can make
with transistors okay this next circuit
that we'll look at we've got two
transistors it's just kind of this this
left half of the board here we've got
two transistors and the way it works is
we've got
these inputs which which again are kind
of I haven't drawn the whole the whole
circuit out but it's we still have this
resistor coming from the positive rail
here through the push-button switch and
then into the base of the transistor and
so that that allows us to to put a
current through that transistor and
we've got two of those and so what
happens is that if both transistors are
turned on then that will complete the
circuit through this resistor here and
then through this LED and then you know
through the first transistor and then
over here and through the second
transistor and so if both transit are is
both transistors are turned on then the
LED will turn on and this is a little
piece of logic that is called a NAND
gate and this is the the truth table for
it this is the symbol that we would use
if we were drawing a more complex logic
circuit we would we would actually
instead of drawing all the little
transistors we would just you know kind
of draw this this whole circuit is just
a NAND gate using this symbols kind of
rounded on this side and squared off on
this side and the the truth table for it
says that if a and B are off then the
output is off and that's kind of what we
have now so both of these are often not
pushing either one and the output is off
if B is on and a is off then the output
is also often we can test that just by
pushing the button and the LED doesn't
come on same thing if a is off or seems
me of a is on and B is off then the
output is also off we can test that by
you know pushing the button here but if
both of them are on then the output is
on and that makes sense if both of these
are on then that completes the circuit
all the way through and so if I push
both the buttons then you can see the
LED comes on because we're completing
the circuit all the way through so how
about this other circuit over here it's
a little bit different I'll show you the
the circuit diagram first and the
circuit diagram for this is a little bit
different so the we still have two
transistors we still have our LED but
they're wired up just a little bit
different so in this case the
transistors are kind of in parallel and
so if either of the transistors is on
then then the LED would come on because
we can complete the circuit through this
transistor or through this transistor so
we look at the circuit kind of closely
here we can see that from the positive
rail
we come through this resistor and then
through the LED and then we can go
through this first transistor so from
the you know the collector here to the
emitter or we can actually kind of come
over to this transistor in through the
collector and out through the emitter
and then so if either of these
transistors is on then the LED will be
on so we can test that out so if we turn
this one on comes on if we test turn
this one on
it comes on as well and so this is
something called an or gate to make
sense if this or this is on then then
the output is on and so this is the
truth table for so if both are off the
output is off which is what we see here
but if one of them is on then the
outputs on if the other one is on the
outputs also on and also if both of them
are on because then that will just
complete the circuit either way and of
course either way current will flow and
so it'll be on so we push both buttons
you can see it's on so either way or
both it doesn't matter
it'll it'll turn on
you
so you can see here we've got two
different circuits they're very similar
very similar but slightly different
different operation one is an and
operation the other is an or operation
so let's try let's take a look at
something a little bit more a little bit
more complicated so this is a different
board here a different circuit and let
me just power this up so this we've got
actually five transistors in this
circuit and it is basically the same
kind of idea here we've got two inputs
that we can you know in this case turn
on and off with these little push-button
switches and we have got an output over
here which is this LED and what we've
what we've built is is what's called an
exclusive or gate or an XOR gate and
it's similar to the or gate which is you
know it's off if if both a and B are off
and it's on if a or b is on but what's
different is that it's off if a and B
are on and so we can we can actually
kind of see that operation so right now
it's off because neither of them are on
but if we if we turn on a yeah the
output is on and if we turn on B then
the output is on but if we turn on both
at the same time the output goes off and
to kind of understand how that works
I've got the the circuit diagram for for
what's built here and you can see that
if we just look at this part over here
it looks a lot like the or gate because
we've got the five volt source going
through our resistor through the LED and
that's what's going on here so we go
five volt source going through the
resistor through the LED and into either
of these transistors so it can go
through either of these transistors and
then the the inputs for those
transistors are the a and B so these
yellow wires come over here and then
jumper over to the to the switches so if
either this or this is on then that will
complete the circuit at least through to
this point and so in the or gate we just
had this connected directly to ground
and so if you this or this we're on then
that would complete the circuit all the
way to ground but in this case in order
to get to ground we've got to turn this
transistor on to otherwise you know
we've got a 5 volts sort of connected
back to 5 volts and there's no voltage
potential difference between 5 and 5
five so the LED is off so in order for
this or gate to work essentially this
transistor has to be on and that turns
Esther is is actually normally on right
because we've got this connected right
to five volt so we've got current
flowing you know from the base to the
diameter so this will normally be on
unless unless a and B are on if a and B
are on then then this this node here is
is then going to be connected to ground
that'll turn off this transistor so if a
and B are on then this transistor is uh
is turned off and if this transistor is
turned off then this or gate essentially
doesn't work which is kind of what we
want to do right if a and B are on we
don't want to really do the same thing
as the or gate we just want the output
to be off so that is that is essentially
what's what's going on here and so that
allows us to build you know from you
know takes us five transistors to do it
but it lets us build this this other
logic element which is this this XOR
gate and so again we can see at work if
we have a on it comes on if we have B on
it comes on but if we do both at the
same time it's it's not on and of course
if they're both often then the output is
off as well and so these are just a
couple of the different gates that you
can build with transistors and here's
actually kind of a whole list of
different ones so we saw you know the
and gate the or gate we just saw the XOR
gate and we were of course looking at
the inverter here there's also you can
make a buffer I guess is actually kind
of the first thing we made with the
transistor which is the input was on the
or on then the output was on the impose
off the app was off not very exciting
but it can be useful and there's a
couple others that we that we could also
make that we didn't look at which are
the the not and or NAND the not or and
the not X or the X nor it's called and
these are basically the same as the and
gate but the output is inverted if
actually if you look at the symbol you
have this little little bubble on the
output there which just means that the
output is inverted and so it's the
basically the exact opposite you know
the X nor is the opposite of the X or
nor is the opposite of the or and so on
so you can build any of these with with
a few transistors and then of course you
can take these logic gates and then
build more complex circuits that allow
you to do arithmetic or store values in
a memory and other things that allow you
to to build a computer