# Is this a usable circuit?

#### Geir

Joined Jul 28, 2008
6
I'm trying to teach myself electronics, and thus trying to wrap my head around the basics. After a lot of searching and having fun, I'm currently fiddling with a "dark-detector".

I found a simple phototransistor circuit online(top-left): I've combined this with a simple NPN transistor switch and I've got a working circuit. What I'm struggling with is the math and components.

Here's my circuit: The phototransistor is a general purpose thing I bought and have no data on. It works as is, but I'd like it to be correct and optimal. The led it's lighting is a 3V 20mA ultrabright white led.

AFAIK:
180Ω is about correct to light this LED (please correct me if I'm wrong).
Shouldn't there be a base resistor on the switch? How do you calculate that value?
I've been trying to find results online, but can't seem to convince myself I've got it right. Here goes:

Min. hFE: 420
Ic = 20mA
Typ. Vbe: 660mV
Vs = 3.2V (Single 3V button cell)

My calculation (probably incorrect, but still):
[SIZE=+1]Ib = Ic / hFE = 20/420= 0.05mA
[/SIZE][SIZE=+1]Rb = (Vs-Vbe)/Ib = (3.2-0.6) / 0.05 = 52K?

[/SIZE]Is this calculation correct, or should I be put to pastures?

PS! R1 = 10K because that's what it said in the first schematic I found. The one I posted here says 4.7K

Hope someone might find a minute to guide me on the correct path.

Sincerely,
Geir Andersen

#### SgtWookie

Joined Jul 17, 2007
22,220
The phototransistor is a general purpose thing I bought and have no data on. It works as is, but I'd like it to be correct and optimal. The led it's lighting is a 3V 20mA ultrabright white led.

AFAIK:
180Ω is about correct to light this LED (please correct me if I'm wrong).
To correctly calculate the value of a current limiting resistor, the supply voltage must be higher than the forward voltage of the LED + the voltage drop across the transistor.

Looking at Fairchild's datasheet for the BC546 through BC550, the hFE (gain) of the transistors remains pretty constant until Ic (collector current) gets up around 80mA. Motorola's datasheet for the BC549B/C and BC550B/C gives a somewhat different picture. Your typical hFE for the BC550C would be around 500; but that changes depending on Ic. But roughly, Ic will be base current x hFE, until you get to higher current levels. See the plots in the datasheets for your particular transistor's manufacturer. Be aware though, that no two transistors are exactly alike.

To figure the resistor for limiting the LED's current:
Rlimit = (Vsupply - VfLED) / desiredLEDcurrent
You also need to subtract the collector-emitter voltage from Vsupply.

Shouldn't there be a base resistor on the switch? How do you calculate that value?
You mean on the phototransistor? R1 serves as the current limiting resistor for the base of Q1, as well as providing a basis for where the phototransistor kicks in.
I've been trying to find results online, but can't seem to convince myself I've got it right. Here goes:

Min. hFE: 420
Ic = 20mA
Typ. Vbe: 660mV
Vs = 3.2V (Single 3V button cell)

My calculation (probably incorrect, but still):
Ib = Ic / hFE = 20/420= 0.05mA
Rb = (Vs-Vbe)/Ib = (3.2-0.6) / 0.05 = 52K?

Is this calculation correct, or should I be put to pastures?
You're trying to use both the gain of the transistor and a current limiting resistor to regulate the current to the LED.

If you want the transition sharper, use a lower resistance on the base of the transistor to leverage the gain, and a proper current limiting resistor. If you want it more linear, then omit the current limiting resistor and use a higher value base resistor.

#### Audioguru

Joined Dec 20, 2007
11,249
A transitor's current gain (HFE) is mesured when it has plenbty of collector to emitter voltage. The current gain is much less if you want the transistor to saturate so it is turned on hard.

Most transistors have their saturation voltage loss spec'd when the base current is 1/10th to 1/20th the collector current even when the hFE is 500.
The lousy old 2N3055 transistor (15A max) has a very poor max saturation voltage loss of 3V when its collector current is only 10A and its base current is a whopping 3.3A.

#### Geir

Joined Jul 28, 2008
6
To figure the resistor for limiting the LED's current:
Rlimit = (Vsupply - VfLED) / desiredLEDcurrent
You also need to subtract the collector-emitter voltage from Vsupply.
So:
(3.2 - 1.9 - 0.6)/0.020 = 35 (kiloohm / ohm??? or just plain wrong )

You mean on the phototransistor? R1 serves as the current limiting resistor for the base of Q1, as well as providing a basis for where the phototransistor kicks in.

You're trying to use both the gain of the transistor and a current limiting resistor to regulate the current to the LED.

If you want the transition sharper, use a lower resistance on the base of the transistor to leverage the gain, and a proper current limiting resistor. If you want it more linear, then omit the current limiting resistor and use a higher value base resistor.
Better of just dropping R2 then.
But then the question: How do I properly calculate R1? It shouldn't turn on the LED to early, but also provide the correct base resistance on Q1..

Sorry if this has allready been answered here, but I'm still struggling with this one.

#### bertus

Joined Apr 5, 2008
20,749
Hello,

The voltage over the led + resistor is dependend on the voltage over de C-E of the transistor as you say.
The voltage C-E of the transistor is dependend on the base current.
See diagram.
For the resistor I should take 39 or 47 Ohms.

Greetings,
Bertus

#### Ron H

Joined Apr 14, 2005
7,014
Hello,

The voltage over the led + resistor is dependend on the voltage over de C-E of the transistor as you say.
The voltage C-E of the transistor is dependend on the base current.
See diagram.
For the resistor I should take 39 or 47 Ohms.

Greetings,
Bertus
Where did you find a transistor that is spec'ed to 300 Amps? I suspect there is a typo. The horizontal axis scale should probably be in mA, not Amps.
Here is the same graph for the BC550C, which our OP says he is using.

#### SgtWookie

Joined Jul 17, 2007
22,220
Without specs on the phototransistor, it's hard to say what the "correct" values should be.

Q1 will start conducting when Vbe gets near 0.6v (ballpark). Since your Vcc is 3.2v (button cell) and R1=10k, the threshold will be when Q2 is passing less than about 270uA.

If Q2 decreased the current being passed to near-zero (it won't go to zero, there will always be SOME leakage current) then the maximum voltage across R1 could be Vcc-Vbe, or (perhaps) 3.2-0.6=2.6v.
Since I=E/R, the base current could be as much as 2.6/10k, or 260uA. Multiplied by the typical hFE of 500 results in a maximum of 130mA being passed; but that would have to be adjusted due to the beginning of the saturation of the transistor, and resulting roll-off of gain. A more realistic figure would be around 90mA.

Vce @20mA is given in the Motorola datasheet is given as 0.1v.
You will need to determine your actual Vf (forward voltage) of your LED by passing 20mA current through it, and measuring the voltage drop across it.

An easy way to make a constant current source is by using an LM317 or LM317L voltage regulator, with a resistor across the output and adjust pins, supply current to your input pin, and take the current output from the adj pin. Expect about a 3v drop across the regulator. See National Semiconductor's datasheet on the LM117/LM317. These are very handy regulators to have around.

Button cells have limited current source capability. 20mA is a pretty heavy load. Don't expect such a cell to last very long in your application. The heavier the load, the more the battery's internal resistance comes into play, and the more power is wasted as heat inside the battery itself.

Last edited: