Go Down

Topic: how to calculate resistor to a base of a 2n2222? (Read 11865 times) previous topic - next topic

cabecinhas

Hi. I have heard a lot about how to calculate the resistor that goes connected to a abse of a 2n222.

This transistor will controll how high is the output of 2n2222.

I want the output to be 3v...

See picture:

Does anybody know how Could I calculate it?

MarkT

That's a bad circuit.  You cannot use the base current to control the collector voltage,
transistors don't work like that.

The base resistor sets the base current.  For a switching transistor you want the
base current to be high enough to saturate the device, bringing the collector
right down to 0.1V or so.   The current for the LED is set by having a current-determining
resistor in series with the LED.

You cannot do it with the base because the gain of a transistor is not at all stable or
predictable - it varies with:

o  temperature
o  collector current
o  collector voltage

So we never rely on the gain being exact.

With analog circuitry feedback from collector to base is often used to bias the
transistor into the correct operating area - negative feedback trades gain for
accuracy, in particular the resulting gain is much less sensitive to the transistor
gain, and much more determined by the feedback network.

Here we are switching, so saturation is needed.  To saturate the base current
needs to be many times higher than for linear circuits.  Perhaps 3 to 5 times higher.

If your LED needs 20mA and has a forward voltage of 1.9V (typical red LED), then
there is 1.9V across LED, 0.1V across saturated transistor, leaving 3.0V across
the current-limiting resistor.  Thus you would use a 150ohm resistor (3V/20mA) between
collector and LED, and the base current should be about 1mA, therefore 4k7 base
resistor would work nicely.

If the transistor has a gain of 100 we are setting the collector to base current ratio at
20 - giving it fives times as much base current to ensure proper saturation.

[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

cabecinhas

Hi.. First of all, thank you for your explanation.


Well.. I'm kind of new in this area but I'l learning a lot!!!


Well..

Could you give me one more detailed axaplanation about my project?

I have 5v where I want to use a 2n2222 as as switch using 5V on base and LED Feed.

Could you PLEASE explain my how to calculate the base and the led resistor?

Led = 700mah and the tension is 5v


Thank you very much


cabecinhas

I'm not sure if I understood the datasheet but it says 700mA,

Am I wrong?

AWOL

It wasn't the "700" or the "ma" I was complaining about (though the former is high, and latter lacks a capital), it was the presence of an "h".

cabecinhas


MarkT

The 2n2222 is the wrong transistor, it cannot take 700mA and saturate when driven
by an Arduino pin (it can't even saturate with 50mA base current trying to give
500mA collector current (Vce = 1.0V)) - the Arduino pin can only give about 30mA
before you risk overloading it (absolute max = 40mA).

You need a better transistor or one that can dissipate more power without
overheating, or a logic-level MOSFET.

My favoriate high current switching transistor is the ZTX851, give it 30mA
of base current and it'll handle over an amp without overheating.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

cabecinhas

Hi!!

thank you for your answer!


Well.. I'll drive about 450mA in my led.. so I think tghe 2n222 will handle itm right?

westfw

Quote
I want the output to be 3v...

This is the first problem.  Since LEDs are current driven, you actually want a particular current to flow through the LED when the transistor is on.  To limit the current, you need  a resistor in series with the LED.  You can find lots of tutorials on how to pick the series resistor for a particular LED and power supply; none of the details change significantly just because you have a transistor acting as the switch instead of just wires.  For 450mA through a 3V Vf LED and 5V supply, you should have a resistor of about 5 ohms (and you should figure out how I got that...)

Now, the transistor is also a current-operated device.  When you put a current into the base, the transistor will allow a current of up to Ibase*gain to flow through the collector/emitter path.  Just like with an LED, you need to limit the current into the base to a level that is safe for both the transistor AND the AVR pin providing the current.  That means about 30mA.  Using the same formulas used for LEDs, and assuming that the Base Voltage drop is .7V (typical for Silicon bipolar transistors), you should use a base transistor of about 150 ohms.

Then you start to run into the practical issues that MarkT mentions.  For the transistor to act as a switch and be fully ON, so that the output circuit behaves like we want, the gain of the transistor should be significantly greater than Ic/Ib
(450/30, or 15.)  (Significantly greater ideally means something like 5x or more, not G+5)  If you look at a datasheet (I'm actually looking at a PN2222A; an actual 2n2222 is probably a rarity these days), you'll see that the typical gain is 100 to 300, so that should be fine, right?  No; the gain is dependent on the collector current; reading more carefully, at Ic = 500mA, the gain might be as low as 40.  Less than 3x the gain we were hoping for.  Which makes it a bit  ... questionable.

I would go ahead and wire it up, check the LED brightness, measure the currents, and see if the transistor gets overheated.  (This would probably not be risky for the Arduino, but you could also test it with just a wire from the base resistor to +5V or GND...)

michael_x

Quote
To limit the current, you need  a resistor in series with the LED

This is ok for small leds of about 20 mA
Your big 1W (400 mA) led needs a current source of about 300 to 450 mA, which is something different than a 5V voltage source.

cabecinhas


Quote
I want the output to be 3v...

This is the first problem.  Since LEDs are current driven, you actually want a particular current to flow through the LED when the transistor is on.  To limit the current, you need  a resistor in series with the LED.  You can find lots of tutorials on how to pick the series resistor for a particular LED and power supply; none of the details change significantly just because you have a transistor acting as the switch instead of just wires.  For 450mA through a 3V Vf LED and 5V supply, you should have a resistor of about 5 ohms (and you should figure out how I got that...)

Now, the transistor is also a current-operated device.  When you put a current into the base, the transistor will allow a current of up to Ibase*gain to flow through the collector/emitter path.  Just like with an LED, you need to limit the current into the base to a level that is safe for both the transistor AND the AVR pin providing the current.  That means about 30mA.  Using the same formulas used for LEDs, and assuming that the Base Voltage drop is .7V (typical for Silicon bipolar transistors), you should use a base transistor of about 150 ohms.

Then you start to run into the practical issues that MarkT mentions.  For the transistor to act as a switch and be fully ON, so that the output circuit behaves like we want, the gain of the transistor should be significantly greater than Ic/Ib
(450/30, or 15.)  (Significantly greater ideally means something like 5x or more, not G+5)  If you look at a datasheet (I'm actually looking at a PN2222A; an actual 2n2222 is probably a rarity these days), you'll see that the typical gain is 100 to 300, so that should be fine, right?  No; the gain is dependent on the collector current; reading more carefully, at Ic = 500mA, the gain might be as low as 40.  Less than 3x the gain we were hoping for.  Which makes it a bit  ... questionable.

Quote
I would go ahead and wire it up, check the LED brightness, measure the currents, and see if the transistor gets overheated.  (This would probably not be risky for the Arduino, but you could also test it with just a wire from the base resistor to +5V or GND...)


Hi! First of all, thank you for your explanation..

We... I've searching on internet and found out some formulas and Now I'm testing one and actually I'm having the base transistor at about 4mA and the led current is about 420mA.

The Brightness is grat and under its maxtimum current(700mA).

The LED is handling about 420mA but the 2n2222 IS overheating. I can't even touch.  I have changed the base input to to 2ma, providing about 200mA of LED current and the 2n222 keeps hot(really hot)

I Have tested another 2n2222 and same overheating problem...:(

What Could be Wrong?


michael_x

Quote
What Could be Wrong?

That's normal.
The transistor does not run as a switch and dissipates about 2V * 400mA ~ 1W of heat.
( It's rated for max 500 mW, so even cooling it with a heatsink won't help  )

cabecinhas


Quote
What Could be Wrong?

That's normal.
The transistor does not run as a switch and dissipates about 2V * 400mA ~ 1W of heat.
( It's rated for max 500 mW, so even cooling it with a heatsink won't help  )


Hi Michael.  Thank you for your answer!

Could you tell me wich one could do the job without overheating?

thank you so much

michael_x

Well, I would not go for a bigger transistor but use a different design:

If this 5V source is a given, and you got that 2N2222 already, westfw's  4.7Ohm (1W) resistor with a base resistor of 330 Ohm (for more than 10mA base current) to your transistor will do the trick.

Alternatively:
Get a ready built 350mA current source ( usually fed by 12V )  and use your transistor with a smaller base resistor to have about 10mA base current as a switch. (better use a logic level mosfet as a switch)

Or you could build a current source from an LM317 and a 3.9 Ohms 1/2W resistor.
http://users.telenet.be/davshomepage/current-source.htm


Go Up