Arduino Forum

Using Arduino => General Electronics => Topic started by: STDummy on Oct 07, 2011, 07:58 pm

Title: 2N2222 base resistor
Post by: STDummy on Oct 07, 2011, 07:58 pm
Dummy question for you guys.

I'm switching a parallel array of 10 leds (3.2v, 20mA with each led ballasted with a 82R resistor) with a 2N2222 transistor.  The led supply is 5V as is the base voltage (from an Arduino digital pin).

How do I calculate the value of base resistor will I need for the transistor?  I've tried many methods suggested to me but always end up with a different value each time!  The latest formula I used was  RB = 0.2 x RL x hFE with values of 8.2R for RL and 300 for hFE.  That gave me a value of 492R.  Does that sound right?  I have seen values of as high as 100K being used with this transistor, so have I used the right formula and values?

Any help gratefully received  :)

Bernie
Title: Re: 2N2222 base resistor
Post by: Magician on Oct 07, 2011, 08:20 pm
Rb = Vr / ( Ic / hfe ) = Vr x hfe / Ic
where Ic is collector current or sum current of all your leds (200 mA)
hfe - 40, worst case scenario Ic = 500 mA, V = 10V
Vr - Voltage across resistor, V output - Vbe = 5 - 0.7 = 4.3

Rb = 4.3 x 40 / 0.2 =  860 Ohm
Title: Re: 2N2222 base resistor
Post by: STDummy on Oct 07, 2011, 08:37 pm
Many thanks Magician!

I can see now I was using the wrong hFE figure (amongst other things).  I was using the figure of 300 as quoted in the catalogue, rather than 40 for the worst case scenario taken from the data sheet.  That'll teach me  :smiley-red:.

Bernie
Title: Re: 2N2222 base resistor
Post by: Magician on Oct 07, 2011, 08:45 pm
You are welcome. To get more accurate results, be aware that Vout isn't exactly 5V, as it also drop down when more current drain out from output, to 4.4 or even 4 V. So Vr = 3.7 / 3.3V  instead of 4.3
Title: Re: 2N2222 base resistor
Post by: MarkT on Oct 07, 2011, 09:34 pm
I think its worth an extra safety factor to ensure the transistor is driven into full saturation - make the base current say twice the calculated value for worst-case hfe...

If a transistor is still on the borderline of linear region and saturation it's Vce could be higher and less predictable.  A factor of two or so will probably cover the obscure effects you haven't allowed for like logic high drooping under load, lower than nominal 5V supply, hfe depending on Vce, or whatever.
Title: Re: 2N2222 base resistor
Post by: STDummy on Oct 08, 2011, 12:45 am
Thanks again for the help people.

I think I'll take on board both your comments and start off with a 500R resistor.  That'll give me base current around 7-8mA which should be ample.  Besides, it just so happens I've got a whole load of 500R resistors lying around!!

Bernie
Title: Re: 2N2222 base resistor
Post by: Grumpy_Mike on Oct 08, 2011, 03:18 pm
Are you sure 500R is an unusual value, a value of 510R is more standard.
Title: Re: 2N2222 base resistor
Post by: STDummy on Oct 08, 2011, 09:52 pm
I knew that!!  :smiley-red:

Slight shlip of the mind!  Yes of course you're right I did mean 510R, my brain hasn't woken up in a while  XD

Bernie
Title: Re: 2N2222 base resistor
Post by: vbnewcomer on Mar 26, 2013, 10:44 am
This link might help you http://www.csgnetwork.com/transistorcalc.html (http://www.csgnetwork.com/transistorcalc.html)