# Driving an NPN with a phototransistor - base resistor?

I’m working on a simple circuit to detect the proximity of an object, but my lack of basic knowledge about BJT transistors is holding me up.

The goal is just to light a LED when both of two conditions are satisfied: (1) an object is sensed by an infrared proximity sensor (QRB1114), and (2) a 5V line is high. I have power available from an 18V bus.

I've sketched out the attached circuit, where the phototransistor is driving a 2N3904.

My main question is, do I need a base resistor for the 2N3904? I have found similar diagrams on the internet, some of which have a base resistor, and some of which do not. If no base resistor is necessary , what limits the current through the base of the 2N3904?

Otherwise, is this circuit reasonable? The circuit is for human eyes, so response time is not a concern.

Thanks for your thoughts!

“ My main question is, do I need a base resistor for the 2N3904?”

YES !

LarryD, thanks for your reply. How would one calculate the base resistor in a case like this?

My confusion comes from seeing diagrams of similar circuits that don't include a base resistor. For example, here is one from "Practical Electronics for Inventors", page 520:

And how is this configuration different from a Darlington, where it doesn't seem like the second transistor uses a base resistor?

Thanks much

The resistance of the coil is a huge difference.

Your OP had no emitter or base resistor therefore there was no current limiting hence the transistors would get wiped out.
There is no current limiting in the opto thru the base of the 2nd Transistor emitter to GND.

Let’s say the coil in the second image was 100Ω, the collector current flowing would be 9V - .1Vcesat(Q1) - .6Vbe(Q2) / 100R
8.3V / 100R = 83ma.

You need to understand the differences between high-side and low-side switching, and the three transistor
configurations, common-emitter, common-base and emitter-follower.

Basically for switching common-emitter is almost always used and requires a base-resistor.

Common-emitter, NPN = low-side switch, base resistor
Common-emitter, PNP = high-side switch, base resistor
Emitter-follower, NPN = high-side switch, no base resistor, inefficient.
Emitter-follower, PNP = low-side switch, no base resistor, inefficient.

Common-base is rarely seen outside RF amplifiers or the cascode.

Thanks guys, that makes it somewhat clearer!

Do you realize that the QRB1114 is expecting a reflective surface very close (~ 3mm)?

Yes, the state to be sensed here is just whether a metal clip is installed on a piece of toy train equipment. I can put the QRB114 right under where the clip will be and put reflective tape on the underside of the clip.

The datasheet shows decent detection out to at least 1/4", and with the amplified circuit it looks like I can get the indictor LED to tun on fully at about 1/2" or more.

The QRB has the advantage of being in my parts box; is there something of comparable size and simplicity that would be good for detection in the 1/2" range?

Your circuit looks fine as is. Some quick calculations:

IRLED current = 17mA
QRB1114 collector current = 1mA (see fig 2)
2n3904 base current = 1mA
2n3904 peak base current = 100mA <— only at 1% of this = 0% chance of failure.

I see what you mean - from figures 2 and 5, in the QRB1114 datasheet, it looks like current through the phototransistor cannot exceed about 10 ma with a 5v supply.

I just built the circuit running the phototransistor LED at 40 mA, and a 1K base resistor for the 2n3904. Detection range and sensitivity are excellent, and the base current for 2n3904 peaks at about 5mA.