# BJT transistor as a switch

cyeokpeng
Hi,

I know how to drive a transistor as a switch, but I am not very sure how to perform voltage and current calculation and analysis at the collector to emitter side. Basically what I know is that if the base is biased at 0.7 V, the transistor will be switched ON and current will flow through from the collector to the emitter. However, if I m not wrong, the current is not a constant here and is controlled by the choice of the resistor used. But does that mean that the collector-emitter junction effectively act as a short circuit here now?

The document I have uploaded is a simple circuit of a switch. My question is, how do we determine the collector current through the LED?
How does the LED light output performance going to be affected by the current flowing through it?

Thanks

#### Attachments

• Transistor as switch.doc
24.5 KB · Views: 492

## Answers and Replies

Staff Emeritus
Gold Member
cyeokpeng said:
My question is, how do we determine the collector current through the LED?
The collector current, i.e. the current flowing into the collector, is equal to a constant, β, times the base current, i.e. the current flowing into the base.

$$I_C = \beta I_B$$

This constant is about 100 for typical BJTs.

How does the LED light output performance going to be affected by the current flowing through it?

The larger the current through the LED, the more light it will produce. Normal LEDs need about 15 mA or so to be fully lit.

- Warren

Last edited:
cyeokpeng
chroot said:
The collector current, i.e. the current flowing into the collector, is equal to a constant, β, times the base current, i.e. the current flowing into the base.

$$I_C = \beta I_B$$

This constant is about 100 for typical BJTs.

- Warren

Actually, I know this relationship, BUT does this current relationship apply when transistor is biased in the ON/OFF mode instead of the usual saturation region which is normally used to design amplifier circuits of small signals?

Gold Member
You are using a current limiting resistor in the collector circuit. Why are you worried about it past that? If you know how to use a transistor as a switch then you should have figured base current for worst case beta of a transistor. You then size the collector resistor for the current you want in the LED. So if you want a collector current of 15 mA and figure a worst case beta of 50 you would want a base current of .3 mA. Size the base resistor for this. Then size the collector resistor to permit your max LED current of 15 mA at full supply voltage. As long as the beta is 50 or above your LED current will be a constant 15 mA when the transistor is switched on.

Staff Emeritus
cyeokpeng said:
Actually, I know this relationship, BUT does this current relationship apply when transistor is biased in the ON/OFF mode instead of the usual saturation region which is normally used to design amplifier circuits of small signals?

If you really want a detailed analysis, you need to use something like the Ebers-moll model. It's too hard to describe in detail in text, google finds

http://people.deas.harvard.edu/~jones/es154/lectures/lecture_3/bjt_models/ebers_moll/ebers_moll.html [Broken]

There may be better sites out there - this sort of model is commonly used in transistor capable cricuit simulators like "Spice" - I know that there is a set of public domain documents about the transistor modelling in this simulator, you can probably find a lot more information if you hunt for it.

Basically, every transistor works "upside down" as well as "rightside-up" - if you interchange the collector and emitter, you will still have a transistor, and you will find that it works more or less like usual, except that beta is usually a lot lower, and the breakdown voltages are considerably different too (the base-emitter junction breaks down a lot easier under reverse bias than the base-collector junction, there are reasons for this but I don't want to bore you).

On a practical level, when you saturate a transistor, you forward bias the collector base junction, and this stores a lot of charge in the base. Using the Ebers-Moll model you can find out just how much charge you store, as well as all the voltages and currents. This is important when you want to analyze the switching speed of a saturated bipolar circuit, for instance.

I hope this helps.

Last edited by a moderator:
cyeokpeng
Hi,

Thanks for all the help, but still I cannot figure out why my circuit lights up very dim when the LDR sensor circuit is activated.

For the Q2 transistor, the emitter current I need to fully light up the 3 LEDs is 15mA*3 = 45mA. I have measured the beta value of the transistor using a multimeter, it is 180. So I need a base current of 45mA/180 = 0.25mA. How do I size my base resistor for this case? Anyway, I have used 100 ohm for the Q2 transistor base.

#### Attachments

• Indicator Light Design.doc
31.5 KB · Views: 325
Gold Member
What exactly is the goal here? What is the purpose of the various transistors? What sort of signal is driving the base of Q1 and Q3? Are the 5 volt signals coming from the IC in or out of phase? What is the base resistor sizes for Q1 and Q3? Why do you have the LEDs in parallel? This is a poor design move.

cyeokpeng
Sorry I do not explsin my design more clearly.

The 74138 acts as a demux to transmit the 1Hz clock signal across. When the Masterswitch is HIGH and the switch is LOW, the transistor Q1's base is activated, and current flows through the emitter of Q1 to drive the LDR sensor circuit. When the lighting is dim, the LDR sensor circuit will light the LEDs in a on/off manner (1Hz) because of the on/off signal at the emitter of Q1.

When the Masterswitch is HIGH and the switch is also HIGH, the transistor Q3's base is activated, and current flows directly to the LEDs, making them switch on and off at 1Hz, due to the on/off signal at the emitter of Q3.

The resistance used for the base of Q1 and Q3 are 1k ohms, and I change to 100 ohms to see any difference in performance, but still the same.

The 5V line is a DC power source, while the 1Hz clock signal is 5V, 0V square pulse at 1Hz.

As for you last question, is it better if LEDs are connected in series? I am afraid of the voltage insufficient for each LEDs.

Staff Emeritus
Unfortunately I don't have MS word, so I can't really see the circuit that's being talked about.

To understand the steady-state terminal currents in a saturated transistor, you don't really need to understand anything more than that bese-eimtter voltage, vbe is .5-.7 volts, and the collector-emitter voltage, vec is about .2-.3 volts. (The figures are approximate, but good rule-of-thumb engineering estimates for discrete transistors).

For more advanced modelling, the Ebers-moll model is invaluable, but it's a lot more work.

Last edited:
Gold Member
Ok. I'll explain my comment on parallel LEDs. LEDs are non-linear devices. Differences from one to the next can mean that while one is passing 15 mA it produces a voltage drop of 2 volts while the next one may produce 2.1 volts. This means that when you parallel the 2, one will 'hog' all of the current. The LED with the lowest drop will take more current than the other. This means one LED will be brighter than the other and will most likely fail prematurely.

I realize you cannot put them in series because you don't have enough supply voltage. So, simply put a series resistor with each one. Then wire each LED-resistor pair in parallel.

The way you have the circuit drawn you do not need base resistors on Q1 or Q3. The bases of those transistors will not draw any more current than the emitter current divided by beta. The resistor connected directly to Q2s base can also be omitted. The cadmium sulfide cell you have drawn along with the blue resistor form a light dependent voltage divider. The base current will be limited by the blue resistor. As the CDS cell is illuminated its resistance drops to a low value and shunts current away from the transistor. In fact, if the voltage on the base gets less than about 3 volts the LEDs will not light. Knowing the illuminated resistance and the off resistance of the CDS cell, figure the size of the blue resistor to keep the base current high enough to fully power up the LEDs when the cell is dark and get the base voltage low enough to completely shut them off when the CDS cell is illuminated. I think you know how to do all of this. I suspect you have a grasp for what you are doing, but need a bit of direction?

cyeokpeng
OK,

First thing first, step by step:

In the normal simple LDR sensor circuit using BJT transistor as a switch, how do we go about finding the base current into the base?

I tell you what I know, hope I am correct, correct me if I am wrong.

We can model the the system looking into the base as a Thevenin equivalent voltage source and equivalent resistance. Then the circuit system connecting to the base of the transistor can be fully represented by the Thevenin voltage source and a base resistance Rb in series. We can model the pn junction of the base-emitter using a diode model (i.e. using the simplest model of an ideal diode and a 0.7V voltage source)

Then to find the base current, we just apply the Kirchoff voltage law in a loop going from the base terminal to the emitter terminal, taking care that the current at the emitter side is equal to the collector current in the evaluation.

Anything wrong I have described? I am going to analyzed my circuit in this manner.
Thanks for your help.

#### Attachments

• Indicator Light Design.doc
26.5 KB · Views: 276
Gold Member
You are unnecessarily including the series resistor on the base of the transistor. You need to find out what the current requirement for you LEDs are when turned on (emitter current). Then you need to determine what your worst case transistor beta would be. Using the worst case beta, figure the base current required. From this and the CDS cell specs you now can figure the what the upper resistor needs to be. Keep the voltage on the emitter as close to the power supply voltage as possible when the LEDs are turned on. This way variation in transistor beta will not cause a variation of emitter voltage because the base voltage will always be pulled very close to the supply voltage.

I would say that a better approach would be to put the LED and series resistor in the collector circuit and ground the emitter. Resistance in the emitter always introduces negative feedback and this is not desirable in a switch type operation as you are trying to do. This approach also requires you to determine a worst case transistor beta. As long as the base voltage is above about .7 and the upper resistor is low enough in resistance to get enough base current (figured from worst case beta) the collector will go to virtually to zero volts and the LEDs will light. The higher you set your worst case beta the larger the window will be for the value of the upper resistor. Also, CDS cell specs will determine how large this window is.

cyeokpeng
Hi,

Thanks for all the help, I appreciated it very much.

I have found an improvement in the light output by using the collector terminal instead of the base terminal of the transistor. (Refer to the indicator light design attachment, should be attachment 2)

However, I feel that the light output can still be improved. I realize that the problem is that the base resistance is still very high, decreasing the base current Ib, hence decreasing the collector current by Ib/beta.

To give an idea of my design, I will give the resistances involved in the potential divider branch.
R LDR = 65 K ohms (when sufficeiently dim)
R1 = 270 k ohms
This will give an average base resistance of around 52.4 k ohms, which will give a base current of 0.0401mA, which will give a max collector current of 6.13mA using beta=153 measured using my multimeter.
Still not enough current to fully lit up one LED, let alone 3 LEDs I have.

So the only solution to the problem is to increase the base current Ib to increase the collector current Ic to my desired value, and therefore, I have to find a way to reduce the base resistance looking into the base of the transistor.

This problem cannot be solved by decreasing the biasing resistors' resistance in the potential divider branch since the LDR's characteristics is fixed. I think the only way is to introduce a voltage follower buffer implemented by op amp circuit, so as to produce a small output resistance into the base of the transistor.

Do you think it will work?

Assuming this plan works, how do I power up the op amp? I remember that Op amp needs a +ve and -ve dc power supply, so how can I supply these using 2 sets of batteries. I am dumbfounded.

Thanks

Last edited:
cyeokpeng
I have actually thought of a less complex method, which will reduce hardware cluttering of the PCB.
Please comment whether it is a good method or not.

Besides increasing the base current Ib, I can actually increase the beta value of the transistor by cascading two transistors to form "supertransistors", with Beta = B0(B0 + 2).
In this way, the collector current Ic = Beta*Ib can be increased at will, improving the light output of the LEDs.

egsmith
I was just going to suggest using the collector node to take the diode out of the loop that includes Vbe but you already figured that out. The "super" transistor method you mentioned will work and is pretty common (do a google for Darlington Transistor Configuration). Doing this will seriously slow down the turn on time of the transistor pair but you can improve it somewhat by placing a resistor across the Vbe of the second transistor (the one whose emitter is wired to ground). However you will want to refer to the datasheet of your parts to insure you don't overdrive anything.

I am not sure what LED you are trying to drive but usually they don't get any brighter past ~50mA, in fact they may just burn up. The current-source biasing technique (what you are doing) should be able to drive that just fine with a single NPN and the correct resistor values.

Now if you really have a high power LED you are much better off using DC to DC conversion techniques. This appnote explains it pretty well.

Again, look at the datasheet for your LED to be certain.

Gold Member
cyeokpeng, I don't think you have a grasp for what I'm talking about. You haven't admitted to removing the series resistor connected directly to the base. You also haven't mentioned the illuminated resistance of the CDS cell. Your base current seems extremely low. Why are you setting the base resistance so large? Most CDS cells have an illuminated resistance of several hundred ohms. You can then select the the upper resistors value in order to get a base voltage of about a half a volt when the cell is illuminated. This is not enough to turn the transistor on so the LEDs would definitely be off. I did a quick calculation assuming an illuminated resistance of 200 ohms (you haven't specified what it actually is). Do a voltage divider with a voltage of .5 volts across the CDS cell and you get a divider current of 2.5 mA. The upper resistor would have a resistance of about 1800 ohms to get the voltage to come out like this. When the cell goes dark its resistance goes to 65K (according to your earlier posting). This is so high relative to the 1800 ohm resistor you can almost assume it isn't there in this case. This gives you a base current of 4.3 / 1800 = 2.3 mA. A worst case beta of 75 will get you WELL over the required current needed to light the LEDs. Assume the collector voltage will be 0 when the transistor is on. Use current limit resistors with the LEDs in the collector circuit to get the current you want through the LEDs.

I would understand by your posting that you have decided against using an op-amp. But if you choose to do so, why not just use it as a comparator and drive a transistor in emitter-follower configuration to drive the LEDs?

This may sound like an old discreet analog device designer grinding his axe, but using an op-amp in this case is a cop-out. ONE transistor should be plenty.

Last edited:
cyeokpeng
Actually, I have already removed the series resistor into the base excep I did not mentioned it explicitly.

I have understood that the potential divider branch would provide the necessary base resistance so that is no need to add a series resistor which will just reduce the base current even more.

cyeokpeng
The illuminated resistance of the CDS cell I have measured is about 4.0 K ohms, using the flourescent lights in my home.

cyeokpeng
Thanks AverageSupernova, you demonstrated a lot of patience explaining to me the practical concepts which are so enriching and precious.

After I have changed the bias resistor to a smaller value 39 K ohms, (I just found out that there is no need to let the circuit wait for total darkness for it to light, or else very hard to present and demonstrate during my project presentation) together with the implementation of the Darlinton transistor by cascading two transistors, the collector current signal has become more sensitive to the changes with the base current signal, and the collector current signal is finally sufficient to light up three or more LEDs fully.

My mistake is the wrong biasing resistances used in the potential divider, causing the base current and thus the collector current to be very small even though the transistor is ON.

The only thing in my design analysis is that now, I need at least 1.3-1.4 V to bias the two base emitter terminals instead of the usual 0.7 V biasing point.

Thanks again very much!

NB: I have never learned the Eber model or what they call, I only know that Ic = Beta*Ib. I have found that model to be extremely not user friendly when I need fast analysis of the transistor design.

egsmith
This does a good job of showing the typical method of using the transistor as a switch.
http://www.rason.org/Projects/transwit/transwit.htm

This 15 page doc will explain the Ebers-Moll model, why it is useful, and how it relates to your current biasing problem.
http://www-personal.engin.umd.umich.edu/~fmeral/CIRCUITS/05*Unit%205/BJT%20.pdf

Staff Emeritus
The Ebers-moll model is very handy for more advanced work, but it's overkill for finding the terminal currents of a saturated transistor.

The Ebers-moll model is however not quite as intimidating as it looks. Rather than write IC= beta*Ib, the Ebers-Moll model is based around the idea that Ic = alpha*Ie. The two are mathematically equivalent. If you look at the diagram of the Ebers-moll model with its' controlled current source, you should be able to "see" that it embeds the above equation (Ic = alpha*Ie).

Because of Kirchoff's current law, one can immediately write Ib = (1-alpha)*Ie, so Ic/Ib = alpha/(1-alpha) = beta.

The Ebers-moll model makes certain model parmeters, such as the Iss of the semiconductor diodes, more "physical" than the "beta" model.