# How to calculate resistors for transistor driver circuit [duplicate]

This is related to https://arduino.stackexchange.com/a/36761/13642, I want to find the values for the two resistors so that the led will get 100mA.

Vcc will be 5V and I have either 2N2222 or 2N3904 transistors. Let's say I use the 2N3904.

They mention the equation: hFE(VCC-VBE)/RB. (Is the full equation hFE(VCC-VBE)/RB = ICC?)

I tried to plug in the values: Vcc = 5, Hfe = 30 (from the sheet), VBE = 40*10^-3R since the arduino's pwm output is 40mA and from ohm's law, ICC = 100mA (the desired current for the led).

so we get: 30*(5-40*10^-3R)/R = 100*10^-3 => R = 3.3/(100*10^-3/30 + 80*10^-3) = 39.6.

This is not even close to 1000 like in the answer, so I'm doing something wrong here.

So how are you supposed to find the B line resistor value? Also, how do you find the C line resistor value?

This is the led I will use btw: https://www.vishay.com/docs/81009/tsal6100.pdf

"Arduino" is Arduino UNO for now (Wemos D1 mini later).

I don't think it's a duplicate since my circuit is a little different and what I ask for is different. I also have no idea what is that on their C line...

• arduino's pwm maximum output is 40mA. Its actual output depends on R1 (and Vbe). Vbe is the voltage across the transistor's base-emitter - where did you get "VBE = 40*10^-3R"? Commented Oct 3, 2017 at 20:46
• From V=IR, I'm probably wrong, hence this question. Isn't Vbe without a resistor 5V? @brhans Commented Oct 3, 2017 at 20:48

R2, in series with the LED, is (Vcc - Vled)/I = (5 - 1.4)/0.1 = 36 Ohms. However, since the Absolute Maximum current for the LED is 100 mA, I'd probably use 42 or 47 Ohms to reduce the current a bit.

The base current should be collector current/Hfe = 0.1/30 = 3.3 mA. The required base resistor is then (3.3 - 0.7)/.0033 = 788 Ohms. The resistor value should be a little less to ensure sufficinet base current to keep the transistor in saturation, so 510 or 620 Ohms should be fine.

• How did you get the values 1.4 and 0.7? And how did you find that collector current = 0.1? Is there a name for this equation: (3.3 - 0.7)/.0033? Commented Oct 3, 2017 at 21:07
• Peter, oddly enough the OP shows a 3.3 V rail for the LED despite the fact that the Arduino Uno uses 5 V I/O pins. Just to complicate things further, the "Wemos D1 mini" is going to have 3.2 V I/O, I think.
– jonk
Commented Oct 3, 2017 at 21:20
• The picture is from another answer I linked. I get that part of the equation so it's not important, I want to get the other parts of the equation so I'll be able to calculate it on my own. @jonk Commented Oct 3, 2017 at 21:22
• @shinzou If you read the very first part of my answer here, electronics.stackexchange.com/questions/332175/… , I think you will see how to estimate the IR LED. Plus, the datasheet calls it out. The 0.7 comes from the usual (but inappropriate for 100 mA) "silicon" base-emitter voltage, if that's the problem.
– jonk
Commented Oct 3, 2017 at 21:24
• My electronics background is minimal, so I'm sorry but your answer isn't very clear to me. Is there a "for dummies" explanation for this? @jonk Commented Oct 3, 2017 at 21:41