Searching \ for '[ee] 3904 base resistor' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=3904+base+resistor
Search entire site for: '3904 base resistor'.

Exact match. Not showing close matches.
'[ee] 3904 base resistor'
2006\02\05@123427 by

I am using a 2n3904 to drive a 12V relay off a 16F628 pic at 5V input, I'm
not sure how to figure out the resistor for the base?

>   I am using a 2n3904 to drive a 12V relay off a 16F628 pic
> at 5V input, I'm
> not sure how to figure out the resistor for the base?

Neither am I unless you specift the relay current. And while you are
looking that up, check the 2N3904 datasheet for the minium Beta. Divide
the relais current by that Beta and you've got the base current. Divide
3.5V by that current and you've got the base resistor. But don't forget
the freewheel diode!

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu

mrgizmo wrote:

>I am using a 2n3904 to drive a 12V relay off a 16F628 pic at 5V input, I'm
>not sure how to figure out the resistor for the base?
>
>
>
The gain of most general purpose NPN switches (PN2222A, PN3904) is about
100;
that means it will sink 100mA  if the base has 1 mA of current driving
it. That's because
an NPN transistor is a CURRENT AMPLIFIER.

For a relay, I'd calculate the load at 2x the current needed to reliably
close it. Let's
say that 100mA at 12V is needed to reliably actuate the relay. I would
then need (for
a load of 200mA) a drive of 2mA minimum from the PIC through the base.

To calculate the resistor value, you will use ohm's law, I=E/R. The
transistor switches
at 0.6V above GND, so the resistor will have imposed on it ((VCC of PIC)
- 0.6).

To obtain the proper drive of 2mA, 0.002 = ((VCC of PIC)-0.6)/R.
Multiply both sides of the equation by R makes

0,002R = Vcc-0,6

for a VCC of 5V,  R is  2200 ohms... and slightly less is fine..

for a VCC of 3.6V, R is 1500 ohms... and slightly less is fine.

--Bob

--
Note: To protect our network,
attachments must be sent to
attachengineer.cotse.net .
http://beam.to/azengineer

I am not 100% on this so ...

If I am on the right track all you have to do is subtract 0.7 (the
base - emitter voltage) from the 5 volts.

This gives 4.3v.  Then if you know the base current required for
saturation say 5 mA

This gives R = 4.3/0.005  = 860.
So use a 1k resistor.  I use these for pull ups, pull downs and
preceding transistor bases.

Dont forget to use a diode for spike protection.

On 2/6/06, mrgizmo <mrgizmovianet.ca> wrote:
>  I am using a 2n3904 to drive a 12V relay off a 16F628 pic at 5V input, I'm
> not sure how to figure out the resistor for the base?
>
> -
Some useful relationships

1.    IC = beta IB; Beta is the DC gain IC over IB, obviously.  2.    IE =
IC + IB
You can use Ohm's Law to solve for the relationship between IB, RB and EB.
There is a 0.7 volt junction difference.

As a rule stay within 10 percent of the max current for continuous loading.
Remember that inductive loads have an inrush current component.  The 2N3904
is a poor choice for a relay driver but a 2N3904A is OK for small relays.
It gets the junction heat out better.  Use a free wheeling diode in parallel
with the relay coil.  Make sure that the cathode is at the positive terminal
of the relay.  If not, the diode will short the coil current and draw
excessive collector current and heat the junction causing thermal runaway.
Bye Bye transistor!  I hope this helps.

Rich :-)

----- Original Message -----
From: "mrgizmo" <mrgizmovianet.ca>
To: "Microcontroller discussion list - Public." <piclistmit.edu>
Sent: Sunday, February 05, 2006 12:34 PM
Subject: Re: [ee] 3904 base resistor

>  I am using a 2n3904 to drive a 12V relay off a 16F628 pic at 5V input,
> I'm
> not sure how to figure out the resistor for the base?
>
> --
At 12:34 PM 2/5/2006 -0500, you wrote:
>   I am using a 2n3904 to drive a 12V relay off a 16F628 pic at 5V input, I'm
>not sure how to figure out the resistor for the base?

Assuming the coil current is under about 40mA nominal (>300 ohm coil), a
base resistor of 1K or 2K should be okay. Use a better transistor if it's
a higher current coil, switching a relay coil is actually rather hard on the
transistor. Some automotive 12V types have VERY low resistance coils.

A diode across the coil has been suggested, and is the simplest way of
handling the coil inductance. A 1N4148 is fine for any relay you'd be
likely to use.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff

Wouter van Ooijen wrote:
> Divide 3.5V by that current and you've got the base resistor.

3.5V?

******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products
rough guess: 5V - pic drop - Vbe.

> Wouter van Ooijen wrote:
> > Divide 3.5V by that current and you've got the base resistor.
>
> 3.5V?

Wouter van Ooijen wrote:
>>> Divide 3.5V by that current and you've got the base resistor.
>>
>> 3.5V?
>
> rough guess: 5V - pic drop - Vbe.

Vbe is pretty reliably limited to about 700mV.  That leaves only the PIC
drop.  Unless you are getting near the 25mA max limit, it's not going to be
much.  5mA assuming minimum guaranteed beta of 50 allows for 250mA relay
coil current.  That's going to cover most relays driven right from a PIC.
If you need much more than that, you should probably consider using a FET
instead of a NPN anyway, and you've got other power issues to think about.

******************************************************************
Embed Inc, Littleton Massachusetts, (978) 742-9014.  #1 PIC
consultant in 2004 program year.  http://www.embedinc.com/products
On 2/6/06, Wouter van Ooijen <woutervoti.nl> wrote:
>
> rough guess: 5V - pic drop - Vbe.

Always good to remember that those fets inside the device have significant
on resistance, and that it's not necessarily linear over load either.
At 09:15 AM 2/6/2006 -0500, you wrote:
>On 2/6/06, Wouter van Ooijen <woutervoti.nl> wrote:
> >
> > rough guess: 5V - pic drop - Vbe.
>
>
>Always good to remember that those fets inside the device have significant
>on resistance, and that it's not necessarily linear over load either.

And to remember that the p-channel MOSFET (source driver) is weaker.

Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speffinterlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
->> Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff

More... (looser matching)
- Last day of these posts
- In 2006 , 2007 only
- Today
- New search...