Electrical – Resistors for transistor led circuit

ledohms-lawtransistors

Im new to electronics and have problems with calculating the resistors needed for driving an IR LED with an transistor.

My VDD is 3.3V, the LED needs 1.3V and I want to drive it close to 20mA, so I need a 100Ω resistor. But how can I calculate R2?

circuit

Best Answer

If you select R1 using ohm's law and get the correct voltage drop across the BJT (0.7+ volts, depending on transistor), then you will reach your current limit with a value of 0 for R2 long before the current gain matters. This is called using the BJT in 'saturation mode' and is most appropriate for applications where the BJT is a digital switch.

https://en.wikipedia.org/wiki/Bipolar_junction_transistor

If you use a n-chan MOSFET instead, you don't have to worry about current gain.

Also, I would use a pull down resistor between the right side of R2 and ground so that the input is not floating when you want to disable it.

The major concern, with your current circuit, is selecting too small of R1, so that the circuit is dependent on the current gain (and a precise R2 value) which is known as 'forward-active mode', where your microcontroller needs to source excessive current and could be damaged.

Unless this is for a homework assignment and it's critical, I would use a MOSFET. If it's for homework, you'll probably need to use your textbook's method for providing calculations based on your teacher's expectations.


Edit:

The BC547 has a current gain of 200 and an approximate Vce at saturation of 90~250mV at 10mA. So for 20mA you would have 180~500mV.

So your equation for Ic would be: 0 = 3.3V - 1.3V - Vce(sat) - Ic*R1 inputting best and worst case values for Vce you get... (2v - 0.18v)/(20mA) = R1(largest) = 91 (2v - 0.5v)/(20mA) = R1(smallest) = 75

For the gain (of 200) your equation for Ib would be: Ic = Ib*G Ib = 20mA/200

For the R2 value based on Vbe (PN junctions are 0.7v), you would have: V(input) - Ib*R2 - Vbe = 0 R2 = [V(input) - Vbe]/Ib inputting assumptions of 5v or 3.3v control input signals gives you... 5v – 0.7v = Ib * R2 => 43k 3.3v – 0.7v = Ib * R2 => 26k

All that said, if you pick a value of 100 for R1 and a 10k for R2, with a pulldown resistor of 100k you should be good to go. A large R1 makes R2 non-important and you want your pulldown large enough that it doesn't effect your Ib current (10x factor is safe).