Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsElectronicsBasicsRepairDesignCADComponentsEquipmentElectrical Engineering
ElectronicsKB.com
Contact UsLink To UsSearch & Site Map

Electronics Forum / Basics / June 2007



Tip: Looking for answers? Try searching our database.

Q: Transistor as a switch with pull down ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Benjamin Sølberg - 26 Jun 2007 23:35 GMT
Hi all.

I am interfacing an PIC microchip to a relay by using a normal NPN
transistor. The relay is connected between +12v and collector. A
protection diode in reverse has also added. Emitter is grounded. My
concerne is that by only adding a 10k resistor between base and the
digital output pin (5v) the base will be floating if the PIC failes to
start as all IO pins are default input. Would it be correct to add a
pulldown resistor at 10k and replace the IO pin to base with say a 1k
resistor.

I have been looking at schematics by searching in google but it seems
that every one of them i found are just having a IO to base resistor
with no pull down.

What would any of you advise ?

Regards
Benjamin
Eeyore - 26 Jun 2007 23:44 GMT
> Hi all.
>
[quoted text clipped - 6 lines]
> pulldown resistor at 10k and replace the IO pin to base with say a 1k
> resistor.

For what purpose ? The transistor's leakage current won't be enough to turn the
relay on.

Graham
Benjamin Sølberg - 27 Jun 2007 21:36 GMT
On 27 Jun., 00:44, Eeyore <rabbitsfriendsandrelati...@hotmail.com>
wrote:
> Benjamin S?lberg wrote:
> > Hi all.
[quoted text clipped - 12 lines]
>
> Graham

You might be right. I just wanna make sure that the transistor doesn't
turn on because it is floating
as the microcontroller is defaulted to an input pin upon startup.

So to be short: Even if the micro controller does nothing else than an
infinit loop after startup and the IO pis is
defined as an input there are no chance of the base of the transistor
can go beyond 0,7v and thereby setting
the collector emitter in an on state, even so that no other resistor
is on the base except the one from base to
the IO pin (defined as an input) ?

I hope you don't mind my exact question. I am just trying to make sure
i understod everything.

Regards
Benjamin
Eeyore - 27 Jun 2007 22:04 GMT
> > > Hi all.
> >
[quoted text clipped - 24 lines]
> I hope you don't mind my exact question. I am just trying to make sure
> i understod everything.

If the uC defaults to an input on start up is there an internal pull-up ?

Maybe it's wise to have a resistor from base to ground anyway. Say 4k7.

Graham
Benjamin Sølberg - 27 Jun 2007 22:21 GMT
On 27 Jun., 23:04, Eeyore <rabbitsfriendsandrelati...@hotmail.com>
wrote:
> Benjamin S?lberg wrote:
> > > Benjamin S?lberg wrote:
[quoted text clipped - 34 lines]
>
> - Vis tekst i anf?rselstegn -

Exactly my point, but looking at schematics around the net i usually
only see a resistor between base and IO pin.
And i was surprised so i just wanted to know if this is normal/good
pratice.

Regards
Benjamin
John Fields - 27 Jun 2007 23:01 GMT
>On 27 Jun., 23:04, Eeyore <rabbitsfriendsandrelati...@hotmail.com>
>wrote:
[quoted text clipped - 39 lines]
>And i was surprised so i just wanted to know if this is normal/good
>pratice.

---
Good practice dictates that you know what your circuit is doing all
the time, and even though it's tempting to think that a floating
base won't affect anything downstream, it might.

Consequently, it's a good idea to pull the base down (or up,
depending on what your circuit's supposed to do) in order to take
the uncertainty out of it.

Be careful with attaching too much importance to what the donkey
states.

Note that he's back-pedaling in order to try to fix his earlier post
and hasn't stated whether the pull-down should be on the µC side or
on the transistor side of the series-connected base resistor.

 
Signature

JF

Benjamin Sølberg - 27 Jun 2007 23:38 GMT
> On Wed, 27 Jun 2007 14:21:27 -0700, Benjamin S?lberg
>
[quoted text clipped - 65 lines]
>
> - Vis tekst i anf?rselstegn -

Hi JF

:-)

I think I would add the pulldown between base and ground and a current
limiter between base and IO.
It seems to be the safest way for me.. as a hobbyist as well :-)
A 10K to ground and a 1K to IO (or perhaps a 4.5K)

Would you agree on that ?

Regards
Benjamin
Eeyore - 27 Jun 2007 23:43 GMT
> >> > > > Hi all.
> >>
[quoted text clipped - 49 lines]
> Be careful with attaching too much importance to what the donkey
> states.

Couldn't resist sniping eh ?

> Note that he's back-pedaling in order to try to fix his earlier post
> and hasn't stated whether the pull-down should be on the µC side or
> on the transistor side of the series-connected base resistor.

Exactly what part of  " base to ground " is unclear ?

Graham
John Fields - 28 Jun 2007 13:37 GMT
>> Be careful with attaching too much importance to what the donkey
>> states.
>
>Couldn't resist sniping eh ?

---
Commenting on your back-pedaling is hardly sniping.
---

>> Note that he's back-pedaling in order to try to fix his earlier post
>> and hasn't stated whether the pull-down should be on the µC side or
>> on the transistor side of the series-connected base resistor.
>
>Exactly what part of  " base to ground " is unclear ?

---
Oops... my misread.  But in the morning, Madam, I'll be sober and
you'll still be ugly.

Signature

JF

Jonathan Kirwan - 27 Jun 2007 22:11 GMT
>On 27 Jun., 00:44, Eeyore <rabbitsfriendsandrelati...@hotmail.com>
>wrote:
[quoted text clipped - 31 lines]
>Regards
>Benjamin

I think he's basically saying that internal leaking in the BJT plus
any pin leakage (input pins still leak, though not all that much)
shouldn't be enough to cause the transistor to pass 100's of mA.  Even
for a moment.  Some folks may also worry about you rubbing your feet
on a carpeted floor on a cold dry day and static-zapping the higher
impedance base node of the BJT and doing something untoward.  But it's
not exactly floating as there are protection diodes and other
impedances present on the node.  So although I'm not an expert on the
details, my experience would say it's just fine without the pull-down.
But it won't hurt anything, either.  And if this were pinned out to a
connector, I'd add the pull-down.

Jon
Benjamin Sølberg - 27 Jun 2007 22:28 GMT
> On Wed, 27 Jun 2007 13:36:09 -0700, Benjamin S?lberg
>
[quoted text clipped - 51 lines]
>
> - Vis tekst i anf?rselstegn -

Hi

The uC (PIC12F508) has internal pullup but you must enable it first as
i understood from the spec.

Ok so it looks like it is safe to just have the base to IO resistor.

Say I remove the IC from the socket (to program it)  and accidentally
powers on the circuit, nothing is now connected
to the base except for a resistor with one pin floating. Will it be
able to turn on in any way (without the pull down resistor) ?

Again, I am just trying to learn something from you guys :-)

Regards
Benjamin
Jonathan Kirwan - 27 Jun 2007 23:12 GMT
>> On Wed, 27 Jun 2007 13:36:09 -0700, Benjamin Sølberg
>>
[quoted text clipped - 55 lines]
>The uC (PIC12F508) has internal pullup but you must enable it first as
>i understood from the spec.

Even without that enabled, there is leakage.  The spec for the part
will disclose that value, too.  The programable pull-up (weak mosfet)
just adds to that.

>Ok so it looks like it is safe to just have the base to IO resistor.

I can't tell you professional practice.  My knowledge is as a hobbyist
only.  I have used pull-downs before, myself, just to make myself more
comfortable.  And if I were sending this line to a connector, I'd
definitely use a pull-down.  I want to KNOW where the input signal is
going to be at, in that case.  The extra resistor gives me comfort, if
nothing else.

But I'm not a professional, so others will have to weigh in on that
score.

>Say I remove the IC from the socket (to program it)  and accidentally
>powers on the circuit, nothing is now connected
>to the base except for a resistor with one pin floating. Will it be
>able to turn on in any way (without the pull down resistor) ?

If this is to an important relay, let's say, and you are likely to
have folks replacing microcontrollers while powered up, I'd add the
resistor.  Yes, having a nice, low impedance to ground to hold the
base is a 'nice to have.'  In hobby stuff, I do it sometimes when it
is convenient (I'm not wire-wrapping or point-to-point soldering it
all up, in other words.)

>Again, I am just trying to learn something from you guys :-)

Well, if you are just asking if tethering the base to ground via a
nice resistor will cover more unintended ground, then yes it will.

Jon
Benjamin Sølberg - 27 Jun 2007 23:39 GMT
> On Wed, 27 Jun 2007 14:28:31 -0700, Benjamin S?lberg
>
[quoted text clipped - 96 lines]
>
> - Vis tekst i anf?rselstegn -

I will add the pull down then from base to ground.

Thank you all for your help.

Regards
Benjamin
Jonathan Kirwan - 28 Jun 2007 01:28 GMT
>> Well, if you are just asking if tethering the base to ground via a
>> nice resistor will cover more unintended ground, then yes it will.
>
>I will add the pull down then from base to ground.
>
>Thank you all for your help.

That's the safer/surer side.  Best of luck (though it seems you are
going to be fine without luck in this case.)

Since you are searching for various approaches here, you might also
consider inserting a zener in series with your protection diode across
the relay coil.  The rate at which current declines is proportional to
the voltage across (from dI/dt = V/L) it and adding a zener lets a
somewhat larger voltage to develop which allows a faster dI/dt.  That
has some benefits, at times.  Use something reasonable (most any
common value.)  If you don't have the diode or diode+zener, I believe
what happens is that your BJT has its own breakdown voltage and the
coil just dumps through the BJT after achieving its own breakdown
voltage.  That may or may not be okay, which is part of why diodes,
zener+diodes, or RC snubbers are added.

I don't recall reading what the coil current needs to be, but there is
another consideration here in sizing your base drive resistor (not the
pull-down.)  If you plan to use the BJT as a switch, where the voltage
between the emitter and collector is minimized and below say 0.3V or
so, you should imagine that the BJT is well into saturation and the
effective beta is then low.  I usually figure about beta=20 for modern
general purpose transistors and beta=10 for the old ones I may find in
an old box of parts.  That means you need to figure on about 1/20th or
1/10th of the collector current into the base.  Your PIC can handle a
fair amount on its own (worst case is 25mA, I think, but that is an
absolute maximum if memory serves and not something to rely upon for
normal use.)  And as yuo pull more current from the PIC, the voltage
drops at the PIC's I/O pin.  I figure about 80-90 ohms driving low and
about 120 ohms driving high.  Since you would be driving high, keep in
mind that there is some voltage drop going on inside the PIC.  Use
that to help calculate your resistor.

For example, let's say that you wanted the collector to handle about
100mA for your relay and you are using a 2N3904.  I'd say beta=20 and
figure that the base needs 100mA/20 or 5mA.  If the PIC is running on
5V (I think you said as much), then the I/O pin will be at 5 - 5mA*120
or about 4.4V (rough guess.)  I usually figure a base-to-emitter
voltage of about 0.7V when passing 100uA into the base.  5mA is about
50 times that much.  With about 60mV per decade of current change,
this suggests about an additional 100mV or so (close to two decades
worth.)  So make it 0.8V.  With 5mA, small general purpose transistors
like this are getting a bit non-log-linear though after about 1mA of
base current.  So add another .1V just to be safe.  Call it 0.9V. Your
resistor is then (4.4V - 0.9V) / 5mA or 700 ohms.  A 10k would
obviously be too weak in a case like that.  On the other hand, if you
only need about 10mA for the collector current, that would drop the
base needs to 10mA/20 or about 500uA.  We are talking now about a base
voltage of say 0.7V + 40mV or .74V.  Your PIC will only drop about
60mV, so now we compute (4.94 - 0.74) / 500uA or 8400 ohms for the
base resistor.  That's more like the 10k you are talking about,
earlier.

If you can accept a volt or more drop across the collector/emitter of
the BJT, then your gain is more like beta=100 to 200.  And you don't
need as much base current to drive the collector current.  But then
you lose some of the voltage applied to the coil, too.  And you may
need to consider power dissipated in the transistor.

Jon
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.