Calculating Base Resistor for a BJT

Thread Starter


Joined Apr 15, 2008
I want to control a "matrix" of LEDs with a BJT, from a microcontroller.

I have attached the schematic as a pdf.

I know that I need 114.7mA to go to the LED matrix, and I know that:

Ic = B*Ib

So if I want 115mA at Ic, and assuming a Beta of 100 (should I assume B=100???) then Ib = 1.15ma, and I would need a resitor value = V/I = 3.3V/1.15ma = 2.87K.

Is this correct?

Is 1.15Ma going to be enough to turn a BJT on?

Thanks in advance!



Joined Apr 15, 2008
Don't assume a B=100. What you want to do is turn the transistor on really hard (ie. into saturation). Saturation has a much lower effective B (~10-20). So you need to put about 6mA - 12mA into it. You also need to make sure that the particular bjt you use can handle it.

Now when you calculate the resistor don't forget the 0.7V drop across Vbe. So if you are driving 3.3V, then the resistor only has about 2.6V across it.

Thread Starter


Joined Apr 15, 2008
So since I still need 115mA for Ic, and assuming a Beta = 15, then we have Ib = Ic/B = 115mA/15 = 7.67 mA.

Then 3.3V - .7V = 2.6V across the resistor.

So 2.6V / 7.67mA = 339.

Does that sound more reasonable?

Thanks for reminding me about the .7V drop.. shouldn't ever forget about that.

When you say I should make sure that the BJT can "handle it"... are you talking about Ib, or Ic. I'm using a 2N2222A that has a Ic rated at .8A, so that should be ok.



Joined Feb 4, 2008
You have to take care if the transistor can handle the 115mA on Ic, if it can handle the 7.67mA on the base and if the microcontroller is able to supply the base of the transistor with 7.67mA.

You can use a BFY51 for the transistor.


Joined Dec 20, 2007
Every transistor has a spec in its datasheet: Max Collector-Emitter Saturation Voltage. The 2N222A has a saturation voltage loss of 0.3V at its collector when the collector current is 150mA and its base current is 15mA.

The base voltage of the 2N2222A is a max of maybe 0.9V when its collector current is 150mA and its base current is 15mA.

The microcontroller's output voltage is 3.3V without a load. It might be only 2.0V with a 15mA load.

So a base resistor with 15mA is (2.0V - 0.9V)/15mA= 73 ohms.
for 12mA it might be (2.2v -0.8V)/12mA= 117 ohms.


Joined Jul 17, 2007
Check your microcontroller's specification for maximum source current. For long life, you want to keep the high-level output current below that maximum. You could use a Darlington pair to decrease the current necessary.