hey guys been here I
thought I'd make a
quick video that shows how I normally
design circuits with transistors so
today we'll focus on just switching
things on and off like actuators most of
the time you have a microcontroller and
want to control something like a motor
or solenoid or something so this video
will show you how to size the transistor
and set it up so let's zoom in and I'll
show you what I've got okay so one of
the most common tasks that I need to do
with the transistor is just to turn
something on or off so not really
amplifying a signal it's it's just
acting as a switch so I drew a couple
diagrams here today we're going to be
controlling this which is an air valve a
solenoid air valve and it's a 12-volt
device I just put power on it and it
opens pretty simple so I just drew it in
this diagram as a coil which is a good
way to represent it it's like an iron
core coil so to turn the thing on and
off we could either put a switch between
the coil and ground or between the coil
and our voltage source it doesn't really
make any difference to the coil but it
will make a difference to us later if we
choose a switching component so I listed
off a few of them and I'll describe why
I didn't pick why I did or didn't pick
them for this project we could have used
a relay it's a bit overkill in fact this
one is quite overkill it's big and
expensive it's mechanical it doesn't
switch very fast the best things about
relays are that they can handle very
high currents and they isolate the
circuit they isolate what is being
switched from the control circuit so
we'll save that for another day
similarly a solid-state relay also a
very cool component mostly used for
isolation and high voltages or high
currents so save that won a MOSFET or an
IGBT also for much much higher currents
they don't isolate I guess they sort of
could but we're not going to use these
today either a Darlington transistor
this is actually not a bad choice today
we don't need to use a Darlington but I
think I'll probably do a video on these
later because they
actually are quite useful in some
circuits generally for higher current
stuff today that that solenoid is
doesn't really use that much current so
we're going to use this little guy a
standard bipolar transistor bipolar is
just a plain transistor that's that's
what bipolar means and this one happens
to be a PN twenty to twenty two a and
this little tiny case here is called a
teo ninety two case so the next thing
the first thing to do when picking a
bipolar transistor is to decide whether
we're going to use NPN or PNP you may
have heard these terms floating around
so I made a little diagram here to help
us decide which one we're going to use
first off the schematic symbols the
arrow in the in the symbol always is in
the direction of the conventional
current flow and the arrow always points
to the N material so NPN or PNP so
that's one way to remember it
also watch out I switched the emitter
and collector on this between these two
in the in the diagram here so it's
collector base emitter emitter base
collector so in a PNP the conventional
current flow goes from the emitter to
collector and in an NPN it goes from
collector to emitter so you may be
wondering well you know what what can we
do with all this basically what we're
going to do is put one of these in place
of the switch here and the two terminals
of the switch are going to be the
collector and emitter or emitter and
collector depending where we put it in
the circuit here and the way that we get
these switches to turn on or off is by
either pouring current into the base in
the case of an NPN or drawing current
out of the base in the case of a PNP so
it's it's a switch that is controlled by
a current flow okay so a minute ago I
said that
a transistor is a switch that is
controlled by a current flow and that we
were trying to decide between PNP and
NPN for our circuit so how do we
actually decide in this case the thing
that's going to make the decision for us
is our control signal and in this case
it's going to be our favorite 0 to 5
volt logic signal that this could come
from a microcontroller or a PC parallel
port or a number of different things so
let's look at each case if we went for a
PNP transistor and we have this either a
0 volt or 5 volt control signal we don't
have an easy way of controlling how much
current is going to flow out of the base
of the transistor to turn it on and off
and the reason for that is if the base
is at 5 volts or we have a 5 volt signal
and then there's some sort of circuitry
between it and the transistor there's
going to be a current flowing from our
supply voltage in this case it's like 12
but it could be a number of different
things and and in in the two cases of
the base being 0 or 5 there isn't really
an easy piece of circuitry we can put
here that will allow us to control the
base current flowing from the emitter to
the base in the case of the PNP however
in an NPN transistor we have a really
great option it's just a resistor so
when this is at 5 volts we have a
current flowing from the base to the
emitter and that's going to turn the
transistor on and when this is zero no
current is going to flow and the
transistor will be off so this is
perfect so in this case the NPN is an
obvious choice in fact in all of my
projects I probably use NPN transistors
95% of the time in switching
applications like this I think you would
almost always want to use an NPN so just
keep that in mind it's I think in
general NPN s are quite a bit more
common so let's talk about actually
choosing a transistor and setting it up
with this solenoid valve so we've
decided to go the NPN route because it's
easier for us to control the base
currents with an NPN in the type of
circuit that we're using here
and I said that a transistor is a
current amplifier or a current
controlled switch so if we pour some
current into the base and it flows from
the base to the emitter that will turn
the transistor on and allow a large
current to flow from the collector to
the emitter and the amount of
amplification is known as the
transistors gain so a transistor with a
high amount of gain will allow a large
collector current to flow with just a
small base current and a transistor with
not much gained will not have as much
amplification and that amplification
factor is known as hf e or it's also
sometimes called beta
that's the gain of the transistor at DC
i should also point out that we're not
talking about AC circuitry here at all
this is all just steady-state DC
analysis to make our lives easy so what
we're going to do here is pick a
transistor and this is a little bit
where you know experience comes into
play I mean there's thousands of
transistors available how do you pick
one well you know for Hobby projects in
sort of small-scale design like this
there's really only a handful that come
up so I'm just going to say that we're
going to pick the PN 2222 a which is a
really great low medium power very
inexpensive easy to use switching
transistor and it has a beta of about a
hundred we could be more conserved in
that but we'll just say beta is a
hundred for this particular transistor
it varies quite a lot and I mentioned
Darlington transistors earlier
Darlington transistors are basically two
two transistors ganged together to
increase the gain so those can have
gains of like you know ten thousand or
something and that could be quite useful
for switching higher current loads while
keeping your in your base current low so
anyway so let's let's get back to the
design that we're actually doing today
this solenoid valve this is a Clippard
solenoid valve and if we get the spec
sheet in here
there's not very much for electrical
specifications
it just says 0.67 watts at 12 volts they
make this in 12 or 24 volts this is a 12
volt variant so we've got our our
schematic representation here 0.67 watts
at 12 volts well we want to know the
current so we use Ohm's law which is
current times voltage equals power or in
this case we want to go in reverse point
six seven Watts over 12 volts put some
units on there for you I just type this
one up is 0.05 five eight amps or about
fifty-six milliamps okay so if we didn't
know which transistor we were going to
use you could just start looking down
the list of transistors in a catalog and
think to yourself well the transistor is
at least going to have to handle 56
milliamps although you'll find it pretty
much every single transistor can handle
more than this this is not a very big
requirement here so what we know at this
point is that we're going to use an NPN
transistor it has to handle 56 milliamps
from the collector to the emitter and we
need now we need some way of turning the
thing on and off and if we did decide to
use the PN 2222 a we know that its beta
is 100 so what we have here is our
transistor and IB the base current is
flowing like this this is grounded this
is the coil with our voltage source and
this is the collector current flowing
through the coil to ground and I said
that beta is 100 meaning that this is a
hundred times less than the collector
current so IB is equal to 56 milliamps
over a hundred or 0.56 milliamps so now
the question is how do we how do we get
point five six milliamps to flow into
the base luckily there's a really easy
way we can just add a resistor so if we
put a resistor here and then send this
over to +5 volts if we sized the
resistor correctly we'll get exactly 0.5
6 milliamps to flow through here the
transistor will multiply it by a hundred
and we'll get the current to flow
through the coil so let me draw this a
little bit more clearly and then we can
choose our resistor value so our circuit
is almost done this is a pretty good
almost finished version of it here we've
got a resistor on the base where we're
going to put our 0 to 5 volt signal and
the coil is connected here the solenoid
is connected here so that when the input
is 5 volts we get a current flowing
through this resistor which turns the
transistor on and allows a large current
to flow through the coil to ground so
you're thinking yeah but I live in a
voltage world how do we actually get
this thing to turn on and off so we put
this resistor here to convert our input
voltage to a current and you might be
thinking well that's easy I'll just use
Ohm's law five volts over the resistor
value gives me the current almost
there's another little twist here the
base current is actually five minus 0.7
divided by the base resistor and this
point seven is a an intrinsic value two
silicon transistors this is an NPN so
there's a PN Junction here and silicon
PN junctions will drop a voltage and for
pretty much all transistors I think it's
about 0.7 volts I think it's point six
volts for diodes I'm not exactly sure
why that is but and you can look that up
and so we know that to get our coil
working we needed 56 milliamps to flow
so the IC has to be let's say equal to
56 milliamps
and I said that the transistor
amplifiers current by a hundred so we
need at least point five six milliamps
to flow through the base but it's
actually a better design practice to
shoot a little bit higher because we
want to make sure that the transistor is
fully on what would happen if we gave it
less base current let's say we only gave
it point one milli amps in the base so
you'd multiply that by a hundred and we
get ten milliamps flowing through here
and that would not be enough to activate
our solenoid so the way we have it
designed now if we chose a base resistor
that only allowed 56 milliamps to flow
through the collector the circuit would
just be on the cusp of working so we
want to design it to be a little bit
safer so let's just say we want to shoot
for a base current of 1 milliamp so we
use the multiplication factor of a
hundred and we get a hundred milliamps
through here so you might be thinking
we'll wait a minute how do we get a
hundred milliamps flowing through this
the answer is that we actually don't get
a full 100 milliamps because the current
is limited by the solenoid itself if we
were to short this or if we were to
connect the solenoid directly to 12
volts and ground it's only going to flow
as much current as the manufacturer is
rated 56 milliamps so a transistor can't
allow more current to flow through the
device than it would normally use on its
own but it can restrict the current okay
so let's let's solve this guy we've got
IB is equal to five minus 0.7 over RB
and I know the IB is one milliamp so
when doing the calculations always use
the standard units so enter this is
point zero zero one amps
4300 ohms
well they don't make 4300 ohm resistors
so we could either use a 4.7 K and since
we were pretty safe on our factor of
choosing one Billy amp for the bass this
4.7 K resistor will flow a little bit
less than one milliamp but we'd still be
pretty much okay so there's one other
thing I wanted to add here this for this
particular circuit since we're switching
a coil it's actually very important that
we add a clamp diode and that's going to
look like this so you might be thinking
that's stupid but having the diode is
pointing into our voltage source how
could this ever get higher than plus 12
and the answer is that when the
transistor turns off all of that current
that was flowing through this coil has
created a magnetic field in here and
when the transistor turns off that
magnetic field collapses and the voltage
is going to rise at this point it could
be quite significant if the coil has a
lot of inductance the voltage could get
to be you know hundreds of volts here
high enough where it would actually blow
out the transistor so it's extremely
good design practice to put a die a
clamp diode in there it could be a real
problem because you might design this
and switch it 20 times on the test bench
and it works fine and then you go out
and put the circuit into service and it
switches and it gets to be just high
enough and it blows your transistor out
so it definitely put a diode there and
you can also take it one step further
and add a capacitor in there as well
like this and this can be small like
point zero zero one micro farad's and
the capacitor will smooth out the pulse
here and give the diode time to turn on
and make sure that there's absolutely no
spiking or voltage rising going on in
here so let's build it and test it and
prove that the thing actually works
okay so here's the circuit yellow is
plus twelve volts black is a common
ground and red is plus five we've got
our transistor here the PN 2222 a 4.7 K
base resistor and our clamp diode so if
we put five volts into the resistor
control the valve quite nicely so what
we've done here is taken a very very
small signal five volts at one milliamp
or less and are able to control
admittedly a pretty small signal but
we've taken care of the inductive kick
from the solenoid valve so I thought of
just a couple other things you might be
wondering about throughout this I was
kind of trying to get the base resistor
value chosen and you might be thinking
well screw it we'll just put a zero ohm
resistor we'll just short this thing out
and make sure we have enough base
current but unfortunately you can't do
that because the transistor will draw so
much current through the base that will
destroy itself so so you have to have a
resistor here around the transistor will
self-destruct the very first time you
use it in fact when I was getting
started in electronics you know I
thought a transistor was basically just
a voltage controlled device and so yeah
I put five volts on that base and oddly
enough it didn't do anything it didn't
switch didn't allow current to flow so I
tried another one the same thing and I
thought man these transistors are just
totally defective but as it turns out
they were just being destroyed instantly
so yeah you have to have a base resistor
here also there's going to be a voltage
drop across here so so I said that
there's a point seven voltage drop here
so if we measure all these voltages
we've got five volts here we got zero
volts here we've got point seven volts
here that's you know five - point seven
over RB across this resistor gives the
current flow through here but what's the
voltage right here this is actually
pretty interesting this this voltage
could be
close to zero or it could be about point
one or point two volts depending on the
transistor and how much current is
flowing through it so I said that the
reason we have a point seven volt drop
from the base to the emitter is because
that's the way silicon semiconductors
are built we've got a PN Junction here
throughout the from from the collector
to emitter there's a PN and an NP
Junction so that point seven volts
cancels itself out so if the transistor
is perfectly built the voltage here will
be zero when the transistor is fully
conducting so but you know the problems
in manufacturing and I think they might
even build them asymmetrically on
purpose or something so actually let's
measure it and see what we've got
turn our circuit on okay sorry about
that guys I I had the wrong voltage set
on the supply here so we've actually got
0.1 1 7 volts alright see this thing
right about there we've got 0.1 1 7
volts which is what you would normally
expect for a circuit designed like this
so keep that in mind here if your device
requires exactly 12 volts across it
you're not going to get 4 full 12 volts
with a transistor like this you're going
to lose a tenth of a volt in the
transistor so I hope that about covers
it
obviously transistors get quite a bit
more complicated when talking about
switching things at AC when you start
talking about frequency gain and stuff
it adds a whole nother level of
complexity but I hope this gets you
started with DC design so let me know
what you think let me know if you have
any questions and I will see you next
time earn money online daily, online work at home and earn money, online earning, earn money online free, online money earning sites, earn real money online, e commerce ideas to make money, easiest way to earn money online, best way to earn money online, make money from home, make money online free, money making sites, earn from home, real ways to make money from home, online income ideas, make real money online, top online earning websites, earn money online fast, top 10 money earning websites, earn money without investment, earn money online for students, best sites to earn money, make money online 2019, earn easy money online, earn money online instantly, real money earning sites, make money from home online, make money online fast, earn dollar online free, online earning ways, best online money earning, earn money online with surejob, make money online, online money making sites, best sites to make money online, earn money online paypal, online earn money by typing, best survey sites, ways to earn money online, ways to earn money from home, make money online without investment, make money online surveys,
s
No comments:
Post a Comment