# BJT Switch Design question

Ok so I am revising some transistors and I came across using BJT as a switch, so I decided to design a simple circuit to control an LED. I want someone to kindly check the steps that I followed and offer any suggestion, corrections or improvements that can be made.

The LED needs 20mA for full brightness and at that current has a forward voltage drop of 2.0V. The transistor I am using, 2N3904 has a saturation voltage of 0.2V. Also, I am using a 5V supply. So the collector resistor comes out to be Rc=(5-2-0.2)/(20*10^-3) = 140Ohm.

Now the minimum Hfe specified on the datasheet of the 2N3904 is 30, so I used that to find the base current as Ib = 20/30 = 666uA. Assuming Vbe of 0.7 volt, the base resistor can be found to be Rb = 6456Ohm. I can use the closest 6.2k.

Below is a schematic of the circuit I made in proteus, along with the simulated values of collector current and voltage.

• $I_B= \frac{I_{LED}=20\:\textrm{mA}}{\beta=10}\approx 2\:\textrm{mA}$ and therefore $R_2=\frac{5\:\textrm{V}-800\:\textrm{mV}}{2\:\textrm{mA}}=2.1\:\textrm{k} \Omega$. So I'd use the next upward standard value of $2.2\:\textrm{k}\Omega$. Or perhaps $2.7\:\textrm{k}\Omega$. Look at the datasheet's curves for saturation operation. – jonk Aug 21 '17 at 6:18

The LED needs 20mA for full brightness and at that current has a forward voltage drop of 2.0V. The transistor I am using, 2N3904 has a saturation voltage of 0.2V. Also, I am using a 5V supply. So the collector resistor comes out to be Rc=(5-2-0.2)/(20*10^-3) = 140Ohm.

Now the minimum Hfe specified on the datasheet of the 2N3904 is 30, so I used that to find the base current as Ib = 20/30 = 666uA. Assuming Vbe of 0.7 volt, the base resistor can be found to be Rb = 6456Ohm. I can use the closest 6.2k.

Yes, that all looks OK, very thorough.

A few wrinkles you may want to consider.

hFE=30 is quite conservative for a small signal transistor. hFE varies a bit with collector current, you may find that it's more at the particular current you're running at. However, there's no harm to running a high base current, as long as it doesn't exceed base current and transistor dissipation limitations. Looking at the (ON semi) data sheet, hFE is 100min for Ic=10mA, and 60min for Ic=50mA.

Though you're using a switch to provide the base current, if you were to use a logic or uC output pin, there would be an additional drop which ought to be negligible at that current for CMOS families, but might be significant with old fashioned TTL, or an op-amp with non-R2R output.

Check the maximum current permitted for the LED. All things have a tolerance, your 5v supply could be higher, your 140ohm resistor could be lower, and you might find that with VCEsat lower than max as well, the LED current is higher than you expect. LEDs are very easy to see, not like a filament lamp whose brightness changes strongly with temperature, and you might see very little perceptual difference between 10mA and 20mA drive. 220 and 330ohm are common choices for the dropper from 5v to a red LED, and give currents comfortably below 20mA.

• So its fine if the base current is higher than the minimum, as long as its within limits. Some other places people said that as a rule of thumb, I should set Hfe=10 so that Ib = 0.1*Ic. How much of this is true? – hacker804 Aug 21 '17 at 7:34
• @hacker804 assume hFE of 10? Usually necessary if it's a high power transistor, usually fairly safe on max Ib (but check), but if you're trying to save power (and even when I'm not on batteries, I'm still trying to avoid burning it needlessly) then it's overkill for most small signal transistors like 3094, especially when the data sheet has specified a minimum hFE over the range of your target Ic. When in doubt, use more Ib to fully saturate the transistor than less. But with that data sheet, you're not in doubt. – Neil_UK Aug 21 '17 at 8:53