Author Topic: How to choose the base resistor value for the BJT in a LED on/off circuit?  (Read 7031 times)

0 Members and 3 Guests are viewing this topic.

Offline AakashTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Can anybody explain, how do I set the value of resistor R1 here? why 1k is chosen specifically?
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #1 on: December 03, 2021, 08:26:36 pm »
The transistor needs sufficient base drive to saturate, i.e. turn hard on. A general rule of thumb is the base current should be about 1/10 of the collector current, hence why the base resistor is around ten times the value, of the LED's current limiting resistor.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #2 on: December 03, 2021, 08:46:34 pm »
Compute the collector current as Vcc - VceSat - 2V (assumed LED forward voltage) / 100 Ohms = (5 - 0.2 - 2) / 100 = 28 mA
Using the 1/10 current idea, calculate the base resistor as (Vcc - 0.7) / 0.0028 = 1536 Ohms so a 1K resistor will easily pump enough current into the base.

Now it's your turn:  build the circuit on a breadboard and measure the currents/voltages and see if my math comes close.
« Last Edit: December 03, 2021, 08:49:39 pm by rstofer »
 
The following users thanked this post: sairfan1, Aakash

Offline AakashTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #3 on: December 03, 2021, 09:56:20 pm »
Appreciate your response, but may I know why does the base current need to be 1/10th of the collector current. what if it's different?
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #4 on: December 03, 2021, 10:27:41 pm »
Appreciate your response, but may I know why does the base current need to be 1/10th of the collector current. what if it's different?
It's a general rule of thumb. The base current required to saturate a transistor varies greatly. It varies with the temperature and from one part to another, even if they have the same part number. Here's a link to an explanation I gave in another thread, to save me repeating it.
https://www.eevblog.com/forum/beginners/please-look-at-schematic-to-drive-24v-relay-with-arduino/msg3728989/#msg3728989
 

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1091
  • Country: nz
  • Retired Electronics Design Engineer
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #5 on: December 04, 2021, 06:44:04 am »
Appreciate your response, but may I know why does the base current need to be 1/10th of the collector current. what if it's different?
The base current is set to that value to ensure that the transistor is saturated i.e. the transistor is fully turned on and there is minimal voltage drop (Vcesat) across the collector to emitter. If the base current is lower than the 1/10 ratio the Vcesat voltage will be a little higher and there will be more power dissipated in the transistor when switched on.

Having the base current at 1/10th of the collector current is the industry standard (usually denoted as Ic/Ib = 10) and ensures saturated operation even if a transistor is at the low end of its current gain (HFE) range. In datasheets manufacturers generally specify the performance of their BJTs when operating in the saturated state using this Ic/Ib = 10 ratio. However, there are some exceptions, particularly for higher current or higher voltage devices, where the Ic/Ib ratio may be specified as low as 5.
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5022
  • Country: ro
  • .
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #6 on: December 04, 2021, 07:37:10 am »
I've found this video tutorial to explain well how to choose a base resistor and why you should use one
You can replace the solenoid with your led or any other device that consumes power.
Just keep in mind that you also need to limit the current going through the led using a resistor or a led driver, if your transistor is gonna be fully on it will pretty much not limit the current going through it, so your led could break without a resistor or something limiting the current.

 
The following users thanked this post: Aakash

Online Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3358
  • Country: nl
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #7 on: December 04, 2021, 10:15:18 am »
That the base current should be 10% of the collector current is a very brainless assumption. There is no "industry standard" for this.

Small signal transistors can have a **guaranteed** Hfe (current amplification factor) greater then 500 while it can be around 10 (or even lower for some very old) power transistors.

Hfe is also dependent on current and temperature, but for a lot of small transistors it's safe to work with a minimum Hfe of 100 in your calculations. But a better answer is that if you have to ask, then you would be better off learning more about BJT's. Start by reading some tutorials (video's) and ammend that with some real experimentation and verification on a breadboard and real parts.
 
The following users thanked this post: Aakash

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 1740
  • Country: is
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #8 on: December 04, 2021, 02:24:49 pm »
Maybe you should buy a book, even an online book and Learn about transistors and transistor circuits? Have you ever heard of HFE? The measurement of current gain? You would if you take the time to read about transistor circuits. That transistor may have an HFE of 100 which means the collector current under certain conditions will be 100 times the base current. This is important when designing linear amplifiers and class A and B amplifiers. In your case they choose 10% of expected collector current and any transistor with an HFE of 20 to 100 or more will 'Plug and play' in the circuit. Why was 1k chosen? Suppose the 'drive voltage' was different? Asking one question about one resistor is only scratching the surface. Read about the hows and whys of transistor circuits and start designing your own circuits.
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 
The following users thanked this post: Aakash

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #9 on: December 04, 2021, 04:43:46 pm »
Look at the datasheet for the 2N2222A and under "On Characteristics" "DC Current Gain" look at the range of hFE (current gain).  At very light loads it can be as low as 35 and at high loads it could be as high as 300.  Even at 10 mA (and we're talking about 20 mA), the gain could be as low as 35 (at a very cold -55 degrees C) up to 75.

ETA:  I guess I should mention that collector current is equal to hFE * base current.  The whole discussion is meaningless without this definition.

Gain is all over the map and while 1/10 base current is overkill, it is used fairly often.  Remember, we assumed the driving voltage was 5V but what if the driving device can't quite reach 5V?  There are logic families where the output voltage is somewhat less than Vcc.  Our circuit still has to work regardless of what the driving device is doing and regardless of which gain 'bin' our transistor came from.

While you're at it, look at VCE(sat)  I assumed 0.2V and the datasheet says a max of 0.3V but they don't specify a 'typical' value.

Then look at VBE(sat) - I assumed 0.7V but the real value could go as high as 1.2V and that changes the calculation substantially.

Don't like 10% base current?  No problem!  Pick a different number.  But what you can't do is design a circuit that is dependent on selecting transistors on the basis of gain from a box of parts.  What if you happened to grab a 2N3904 - no, I haven't looked at the difference, I just assumed a 2N2222A for this discussion.
 
https://www.onsemi.com/pdf/datasheet/p2n2222a-d.pdf

Since we're only talking about 20 mA of collector current and 2 mA of base current (maybe), the 1/10 thing works pretty well.  Even if all the parameters stack against the design, the base current will probably be adequate.

The only thing that really matters is how the circuit performs with real numbers.  I used 2V for Vf of the LED - it could be as high as 3V at 20 mA according to this typical LED datasheet.  Look under "Forward Voltage".

https://www.vishay.com/docs/83171/tlur640.pdf

Understand that every single number I used was a guess.  But there's a reason that datasheets have a lot of numbers.  Oddly, under different circumstances, every single number on the datasheet is important.

As I said earlier, build the circuit on a breadboard.  Measure Vbe, Ib (measure drop across the base resistor and calculate - measure the resistor first so you have the real number), measure Ic (measure drop across the collector resistor and calculate) and, most important, measure Vce(sat) by probing between collector and emitter.  Is the transistor saturated?

Measure Vin so you can see what the driving circuit is doing.  If this is coming from a uC, use an output pin to drive the base resistor.

Having completed this experiment, you will understand why we commonly guess at 1/10.  It's a guess that is known to work more often than not and when you're talking about 2 mA, it probably doesn't matter unless you are using really wimpy batteries.  Then you are probably wasting energy but think about it:  you are wasting 10 times as much lighting up the LED.  Pulse it slowly 1/10 on and 9/10 off - this will reduce the energy consumption dramatically.
« Last Edit: December 04, 2021, 05:11:18 pm by rstofer »
 
The following users thanked this post: Kim Christensen

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #10 on: December 04, 2021, 05:07:30 pm »
While you are experimenting, change the collector resistor (increase it) to reduce the LED current from around 20 mA to 10 mA and 5 mA.  You may find a collector current that provides adequate indication without wasting a lot of energy.  The idea that every LED MUST have 20 mA is nonsense.

Experiment!  That's how you learn this stuff.

Numbers are great fun but the only thing that matters is how the circuit performs.
 
The following users thanked this post: Aakash

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1091
  • Country: nz
  • Retired Electronics Design Engineer
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #11 on: December 04, 2021, 10:36:26 pm »
That the base current should be 10% of the collector current is a very brainless assumption. There is no "industry standard" for this.
It is a de facto industry standard in that a great many datasheets specify saturated switching operation at Ic/Ib= 10. A professional design engineer will design a circuit to use the device under conditions as close as possible to the device's specified, and guaranteed, operating conditions to ensure that the highest manufacturing yield is obtained for the product and that it continues to operate reliably under adverse field conditions. A design substantially deviating from the device's datasheet specifications is likely to earn the design engineer enormous scrutiny during the design review process and potentially scathing criticism from senior reviewing engineers.
Quote
Small signal transistors can have a **guaranteed** Hfe (current amplification factor) greater then 500 while it can be around 10 (or even lower for some very old) power transistors.
Small signal transistors may well have a guaranteed Hfe of greater than 500 but this is the small signal incremental (AC) gain not the DC gain. Also, that guaranteed Hfe of 500 would definitely not have been measured with the transistor in saturation so is completely meaningless for this discussion.

In this case the correct parameter to consider is the DC current gain HFE which will differ from the Hfe. It should be noted that for the typical BJT the HFE drops off sharply when the transistor goes into saturation so it is necessary to supply extra base current to maintain the transistor in the saturated state. The common design procedure for ensuring that there is always sufficient base current is to adopt a specified Ic/Ib ratio, typically 10 but maybe up to 20 for smaller transistors or as low as 5 for very large transistors.
Quote
Hfe is also dependent on current and temperature, but for a lot of small transistors it's safe to work with a minimum Hfe of 100 in your calculations.
This is bad advice.

Assuming a minimum HFE (not Hfe) of 100 will not provide sufficient base current to ensure saturation in many transistors. I have never seen a transistor datasheet that specifies saturated operation at an Ic/Ib ratio of 100 so you can be pretty sure that most transistor manufacturers also don't think that saturated operation at an Ic/Ib ratio of 100 is a good idea.

For example, a popular medium current driver transistor is the BC637. This has a typical HFE that peaks at around 97 at  Vce=2V and Tj=25C. Using this transistor in a circuit at Ic/Ib=100 would ensure that a typical device wouldn't even achieve saturated operation and the situation could be even worse when production spreads of HFE and temperature variations are taken into account.

Quote
But a better answer is that if you have to ask, then you would be better off learning more about BJT's. Start by reading some tutorials (video's) and ammend that with some real experimentation and verification on a breadboard and real parts.
This is the only piece of good advice in this post. I would add to it that once you have gained a basic understanding of transistor theory you should read transistor datasheets and understand how real transistors perform and how semiconductor manufacturers specify, test and guarantee those devices.

Simulating basic transistor circuits in something like LTCSpice is also very useful for understanding how transistors behave under various conditions. You can very quickly plot the performance of the transistor under numerous operating conditions much easier than trying to hook multiple meters and power supplies to a transistor on a breadboard. However, it is important to remember that the SPICE simulation is based on a mathematical model that approximates a typical transistor and usually doesn't incorporate the production spread of parameters seen in real transistors. Ultimately, you are going to have to build your circuit and test its performance with real devices with all their built-in limitations.


 
The following users thanked this post: WattsThat

Offline richard.cs

  • Super Contributor
  • ***
  • Posts: 1191
  • Country: gb
  • Electronics engineer from Southampton, UK.
    • Random stuff I've built (mostly non-electronic and fairly dated).
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #12 on: December 05, 2021, 12:29:18 am »
There are of course other ways to arrange this basic circuit. For instance you could use the transistor as an emitter follower (supply to collector, load to emitter) with no base resistor, and a slightly lower LED resistor, or if you had a lower logic voltage or higher LED supply it might make sense to put the resistor at the emitter and LED at the collector, the transistor then acts as a constant-current sink.

The circuit as drawn is normally used with the transistor saturated, minimising the power dissipated in the transistor, but for a low current signal LED the other circuits can  also be useful.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #13 on: December 05, 2021, 12:47:50 am »
I sometimes use a forced beta of 10, but often 20 or 50 with common small signal transistors.  Low noise high gain parts can use a forced beta of 200 or higher, like with a 2N5089 from 0.1 to 10 milliamps, but that is beyond the point of diminishing returns.

One advantage of using a part like the 800 milliamp 2N4401 instead of the 200 milliamp 2N3904 is that it has higher gain above 10 milliamps.
 

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1417
  • Country: ua
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #14 on: December 05, 2021, 05:34:46 am »
Also we may use small MOSFET like 2N7000 and forget about all those calculations at all.
 
The following users thanked this post: Aakash

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #15 on: December 06, 2021, 12:23:50 am »
Also we may use small MOSFET like 2N7000 and forget about all those calculations at all.

Many designers prefer MOSFETs for exactly that reason, although they are more expensive.  I see 2N3904s for $5.5/100 while 2N7002s are $8.1/100.  In the past the price difference was much greater.

Amazingly, pre-biased bipolar transistors are available even cheaper at $3.5/100 if you do not want to calculate and pay for an external resistor.
 
The following users thanked this post: Aakash

Offline jfiresto

  • Frequent Contributor
  • **
  • Posts: 818
  • Country: de
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #16 on: December 06, 2021, 05:04:51 am »
Also we may use small MOSFET like 2N7000 and forget about all those calculations at all.

Or perhaps use an emitter follower: transistor, LED resistor and LED?
« Last Edit: December 06, 2021, 05:06:32 am by jfiresto »
-John
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19519
  • Country: gb
  • 0999
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #17 on: December 06, 2021, 09:39:17 am »
I sometimes use a forced beta of 10, but often 20 or 50 with common small signal transistors.  Low noise high gain parts can use a forced beta of 200 or higher, like with a 2N5089 from 0.1 to 10 milliamps, but that is beyond the point of diminishing returns.

One advantage of using a part like the 800 milliamp 2N4401 instead of the 200 milliamp 2N3904 is that it has higher gain above 10 milliamps.
At higher currents, the ZTX1149, ZTX689 are good.
https://www.diodes.com/assets/Datasheets/ZTX689B.pdf
https://www.diodes.com/assets/Datasheets/ZTX1149A.pdf

Also we may use small MOSFET like 2N7000 and forget about all those calculations at all.

Or perhaps use an emitter follower: transistor, LED resistor and LED?
The emitter follower is a good idea, when it's just driving an LED with a series resistor, but you don't get any voltage gain. There's around 0.8V to 1.5V of voltage drop, depending on the current.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14195
  • Country: de
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #18 on: December 06, 2021, 09:55:47 am »
For LED switching there is no need to drive the transistor deep into saturation. Nothing really bad happens if the transisotr is not fully saturated. This is somewhat different when driving a larger load, where the transistor may overheat if not saturated, or a relay not reliably switching.

For the higher currents MOSFETs got more popular.

If power consumption does not matter than a firced beta of 10 is OK, especially at relatively low currents. Modern small transistors can usually get away with less base current. If power consumption matters, one would normally not send 25 mA to a LED unless absolutely needed for really high brightness.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #19 on: December 06, 2021, 10:18:28 am »
That the base current should be 10% of the collector current is a very brainless assumption. There is no "industry standard" for this.
It is a de facto industry standard in that a great many datasheets specify saturated switching operation at Ic/Ib= 10. A professional design engineer will design a circuit to use the device under conditions as close as possible to the device's specified, and guaranteed, operating conditions to ensure that the highest manufacturing yield is obtained for the product and that it continues to operate reliably under adverse field conditions. A design substantially deviating from the device's datasheet specifications is likely to earn the design engineer enormous scrutiny during the design review process and potentially scathing criticism from senior reviewing engineers.

I'll bet that "specification" is merely the ratio at which they test production devices or measure other properties such as VCEsat. There is absolutely no reason why it must be operated at that ratio.

Overdriving the base current can lead to other effects that affect the operation of some circuits, although almost certainly not this one.

There is no substitute for understanding the device physics. Doctorandus_P is right.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #20 on: December 06, 2021, 09:14:12 pm »
I sometimes use a forced beta of 10, but often 20 or 50 with common small signal transistors.  Low noise high gain parts can use a forced beta of 200 or higher, like with a 2N5089 from 0.1 to 10 milliamps, but that is beyond the point of diminishing returns.

One advantage of using a part like the 800 milliamp 2N4401 instead of the 200 milliamp 2N3904 is that it has higher gain above 10 milliamps.

At higher currents, the ZTX1149, ZTX689 are good.
https://www.diodes.com/assets/Datasheets/ZTX689B.pdf
https://www.diodes.com/assets/Datasheets/ZTX1149A.pdf

Those high gain low saturation bipolar transistors are really neat, but more expensive.  I think Zetex invented them, lookup "super e-line", but many companies make them now including On and Fairchild.  I wish they were clearly identified.

Quote
Also we may use small MOSFET like 2N7000 and forget about all those calculations at all.

Or perhaps use an emitter follower: transistor, LED resistor and LED?

The emitter follower is a good idea, when it's just driving an LED with a series resistor, but you don't get any voltage gain. There's around 0.8V to 1.5V of voltage drop, depending on the current.

Or put the resistor in series with the emitter, and drive the emitter or base, so the transistor becomes a constant current sink/source to drive the LED directly and only one resistor is needed.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #21 on: December 07, 2021, 01:23:51 am »
I decided to play with the constant current source in LTspice using generic components (LED and Transistor are default values) and the result is 22.7 mA flowing through the LED with a 150 Ohm emitter resistor and 5V on the base and collector.

Substituting a 390 Ohm resistor yields 8.8 mA flowing through the LED

.asc file attached

It's a heck of a lot faster to model these circuits than it is to build and instrument them when you just want to test an idea.

Code: [Select]
       --- Operating Point ---

V(p001): 0.735911 voltage
V(n001): 5 voltage
V(p002): 4.14523 voltage
Ic(Q1): 0.0225038 device_current
Ib(Q1): 0.000225038 device_current
Ie(Q1): -0.0227288 device_current
I(D1): 0.0227288 device_current  <======
I(R1): 0.0227288 device_current
I(V1): -0.0227288 device_current
[/font]
« Last Edit: December 07, 2021, 01:31:31 am by rstofer »
 

Offline not1xor1

  • Frequent Contributor
  • **
  • Posts: 716
  • Country: it
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #22 on: December 07, 2021, 09:09:34 am »
the base resistor value in this case is not critical. In the simulated circuit an Ib variation of 0.1-2mA produces a quite small change in Ic and a bit more in Vce-sat.

BTW Since most small LEDs do not withstand currents above 20mA it would be better to increase the collector resistor to 330 or even 1000 ohm.

« Last Edit: December 07, 2021, 09:11:10 am by not1xor1 »
 
The following users thanked this post: Aakash

Offline AakashTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #23 on: December 07, 2021, 07:36:44 pm »
the base resistor value in this case is not critical. In the simulated circuit an Ib variation of 0.1-2mA produces a quite small change in Ic and a bit more in Vce-sat.

BTW Since most small LEDs do not withstand currents above 20mA it would be better to increase the collector resistor to 330 or even 1000 ohm.



Thank you so much for your response. May I know what simulation software did you use?
 

Offline sairfan1

  • Frequent Contributor
  • **
  • Posts: 348
  • Country: ca
Re: How to choose the base resistor value for the BJT in a LED on/off circuit?
« Reply #24 on: December 07, 2021, 10:19:49 pm »
@Aakash which simulator did you use? is it some free online?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf