What resistor value at the transistor base?

I am going to use a 2N2222 transistor to light up an array of LEDs. I should hook no more than 15-20 LEDs in each transistor.

What's the correct the value of the resistor that goes between the transistor base and the Arduino pin?

Thanks!

:slight_smile:

Draw a diagram showing what you are proposing.

.

NCC1966:
I am going to use a 2N2222 transistor to light up an array of LEDs. I should hook no more than 15-20 LEDs in each transistor.

What's the correct the value of the resistor that goes between the transistor base and the Arduino pin?

Determine the DC voltage (Vemitter) that you are expecting at the emitter (for however many LEDS you plan to use, and knowing the operating current of the LEDs).

Then know decide on what voltage you're going to apply (on the source side of the base resistor)... eg, Vinput.

Look up the specs for 2N2222. If the continuous base current information says don't go over 20 mA (or whatever the value will be), then Vinput = Ibase*Rbase + 0.6 + Vemitter.

So Rbase = (Vinput - Vemitter - 0.6)/Ibase; where Ibase could be 20 mA.

The question can't be answered correctly if the collector current is unknown.
Are these LEDs all going to be in parallel, or in series, or a combination of that.
In general, for small transistors like the 2N2222, the base current should be >= 1/20 of the collector current.
There is usually a saturation graph in the datasheet.
Leo..

Assuming 20 LEDs each using 20mA, then that's 400mA load, so you want 20mA minimum for the base,
but the Arduino outputs are abs. max. of 40mA, so lets say 25mA base current, so at 5V logic supply
thats about 4.2/0.025 = 170 ohms or so, so 150 is the closest standard value (output pins have a few dozen
ohms internal resistance anyway, so 150 is better than 180).

OP also mentions "in each transistor".
How many transistors.
At those base currents, you also have to watch total MCU current.
Leo..

Wawa:
OP also mentions "in each transistor".
How many transistors.
At those base currents, you also have to watch total MCU current.
Leo..

Not sure. Without enough output current capacity on each arduino output pin, probably better to just use 1 arduino output for 1 transistor.

Not what I meant.
"Array" was mentioned.
At 25mA per pin, you can only use 6 pins.
http://playground.arduino.cc/Main/ArduinoPinCurrentLimitations
Leo..

My simple diagram:

I found the following formula:

Rb = Vr x hfe / Ic

Ic - 0.2 (sum current of all leds)
Hfe - 40 (worst case scenario Ic = 500 mA, V = 10V)
Vr - 5 (Voltage across resistor)

Rb = 5 x 40 / 0.2 = 1K

Is this correct?

So if it would be 5 LEDs the resistor would be 2K; if it would be 20 LEDs resistor would be 500R and so on?

PS: It doesn't matter the voltage used to feed the LEDs (12V)? So, it could be 12V or 12000V?

LED resistor: (Vs - Vf - Vce)/.02A = resistor, Vs = Vsource, Vf = forward voltage of LED, Vce = voltage drop across transistor collector to emitter, similar to a diode drop
Example (12V -2.5V - 0.7V) / .02A = 440 ohm

Base resistor: (Vs - Vbe)/.02A = resistor, Vs = Arduino voltage. Vbe = voltage across base to emitter, similar to a diode drop
Example (5V - 0.7V)/.02A = 215 ohm 20mA base current will turn it on pretty well.
N-Channel MOSFT would be better, will run much cooler than an NPN.
AOI514 from Digikey.com will work well. Logic level so Arduino can drive directly, very low Rds so it will have very little voltage drop across and stay cool, vs NPN where the 0.7V is fixed and power dissipated can rise a lot with current flow.
http://www.digikey.com/product-search/en?keywords=aoi514

12000V, would be hard to find a transistor that can switch that.

I got it, thanks!!!!!

:smiley:

So Vbe and Vce is the dropped (dissipated) voltage and in the case of NPN transistors it is kind of a "constant" valuing 0.7 right?

Unfortunately I browsed the online stores where I am used to buy parts and they don't have the AOI514 so I will have to stay with the 2N2222.

I don't think it will be a problem though because probably the circuit won't stay on for time enough to get hot. It is going to be used for light a spaceship miniature so I will turn it on for only a few minutes while I show up for friends or for my own enjoyment. I think I will be safe!

Thanks again!

:grin:

EDIT: I saw that you used .02A as for divisor of the formula for the base transistor. Should I increase this value depending on how many LEDs I am going to use? For instances, if are 10 LEDs so it would be 0.2 intead 0.02A?

NCC1966:
So Vbe and Vce is the dropped (dissipated) voltage and in the case of NPN transistors it is kind of a "constant" valuing 0.7 right?

In your circuit, with the diode/resistor pairs on the collector side, Vbe will be approximately 0.6 Volt (or could assume 0.7 Volt too). Reason...... Ve is grounded at 0 V. The 0.6 V is Vbe(saturation) from manufacturing specs guide for the 2N2222. It's just minimum value assumption for Vbe..... assuming 0.7 V is fine too. It is linked to the 'diode' drop of the transistor's own 'pn junction'.

Vce is the voltage (Vc - Ve).

Southpark:
In your circuit, with the diode/resistor pairs on the collector side, Vbe will be approximately 0.6 Volt (or could assume 0.7 Volt too). Reason...... Ve is grounded at 0 V. The 0.6 V is Vbe(saturation) from manufacturing specs guide for the 2N2222. It's just minimum value assumption for Vbe..... assuming 0.7 V is fine too. It is linked to the 'diode' drop of the transistor's own 'pn junction'.

Vce is the voltage (Vc - Ve).

What is Vc and Ve? Voltage-collector and Voltage-emitter?

NCC1966:
What is Vc and Ve? Voltage-collector and Voltage-emitter?

Absolutely correct. If you have chosen current limiting resistors Rd for the diodes, then Vc can be found from the sum of voltages in the collector to emitter branch section......needs to sum to 12V.

12V = Ve + Vce + V_Rd + Vdiode

Vce is (Vc-Ve)

12 = Ve + (Vc-Ve) + V_Rd + Vdiode

Ve is grounded (0V) in this case. But the Ve in the above equation cancels with the -Ve anyway.

So 12 = Vc + V_Rd + Vdiode

So Vc = 12 - V_Rd - Vdiode

We usually know Vdiode. And we also usually know (by design) V_Rd, since we design the current through the diode (which also goes through Rd); V_Rd = I_diode * Rd.

Could also start from the collector..... with voltage Vc.

Vc + V_Rd + Vdiode must sum to 12 Volt.

So again, we get Vc = 12 - V_Rd - Vdiode

Actually, the 2N2222 datasheet specifies that Ib = Ic/10 when used as a switch.

polymorph:
Actually, the 2N2222 datasheet specifies that Ib = Ic/10 when used as a switch.

That condition is just part of their own testing condition right? Ib doesn't have to be around Ic/10 when used as a switch.

Hfe is not used for switching.
For switching applications it is important to get the lowest possible Vce.
That could be less than 0.1volt for this transistor.
1:10 is used if you want to switch close to the transistor's maximum collector current.
For lower currents, 1:20 should be enough.
Look at the P2N222A datasheet from On Semiconductors.
Figure 4 shows a saturation graph with a range of base/collector currents.
Leo..

OK, I got the idea now!

There is so many different parameters in the datasheets and so many different formulas to be used that the solution is to make a bunch of calculations (that will result in a bunch of different resistor values) and then try with each one of them to see what is the correct. The good choice will be one that will work and causing less heat. Of course a couple transistors will burn in the process. I got it now!

LoL!

:stuck_out_tongue_closed_eyes:

My hope was to avoid such empiricism.

:stuck_out_tongue:

The empiricism with "switching" exists because some fail to make it obvious that a "full on" saturated transistor is not going to be "more on" than "full on". You can certainly TRY to drive a transistor MORE ON... but after a point... you will gain nothing but more current onto the base pin than is needed.

Much of the information in the data sheet is far more useful when operating the transistor in analog/linear mode as a controlled amplifier.