Transistor
A small-signal bipolar transistor, NPN and PNP, 2N2222 and BC547 style: a little current into the base lets a much larger one through from collector to emitter.
It is the part every class meets the moment a board pin has to run something a board pin cannot run on its own (a motor, a relay coil, a filament lamp, a string of LEDs), and it is the reason those things are never wired straight to a pin.
Pins
| Pin | What it does |
|---|---|
C |
Collector. |
B |
Base. A little current here controls a lot more at C. |
E |
Emitter. |
Properties
model: 2N2222 (NPN, beta 100, the classic 800 mA metal-can switch), BC547 and
BC548 (NPN, beta 200, the European 100 mA small-signal part; the same die on
the same card, separated on a real datasheet only by a collector-emitter
voltage rating this model does not have), 2N3904 (NPN, beta 150, the American
200 mA equivalent), TIP120 (an NPN Darlington in TO-220, a 5 A switch with a gain
near 2000), 2N3906 (PNP, beta 150), 2N2907 (PNP, beta 200, the 2N2222's
complement) or BC557 (PNP, beta 200). beta overrides the model's gain. On the
TIP120 it is the gain of the pair. vbe and vce_sat are off at zero and
are read as measurements when they are set: vbe is the base-emitter drop at
10 mA, which sets the saturation current, and vce_sat is the
collector-emitter voltage at a forced beta of 10, which sets the reverse gain.
What the model gets right
Ebers-Moll in its transport form, with an Early voltage, solved by Newton-Raphson along with everything the transistor is wired to:
If = Is (exp(Vbe / Vt) - 1) Ir = Is (exp(Vbc / Vt) - 1)
Ic = (If - Ir)(1 - Vbc / Vaf) - Ir / Br
Ib = If / Bf + Ir / Br
There is no base-emitter drop in the part, and no saturation floor. Vbe is
whatever the base current makes it (about 0.63 V at a milliamp and 0.70 V at
ten), and the transistor bottoms out because the collector junction goes forward
and its reverse transport current eats the forward one, which is what saturation
is. A 2N2222 switching 22 mA with four milliamps of base current sits at about
25 mV, which is what a real one does and a good deal lower than the 0.2 V a
datasheet quotes at 150 mA.
Because the Early voltage is finite the active region tilts with Vce the way a
curve tracer draws it, so a common-emitter stage has a real output resistance
and a real gain: with the base driven directly, Av = -gm Rc with gm = Ic / Vt,
to within a percent. A divider-biased stage's operating point agrees with
ngspice 42 on the same model card to better than a tenth of a percent.
A PNP is the same three pins with every voltage and every current the other way round. The probe reports the size of the collector current either way.
The TIP120 is two transistors, not one big one
A Darlington is a driver transistor whose emitter feeds a second transistor's
base, on one die, with two bleed resistors and a reverse diode the package really
has. It is modeled as exactly that: two Ebers-Moll transistors, R1 = 8 kΩ from
the base to the node between them and R2 = 120 Ω from there to the emitter, with
that node solved inside the part rather than given to the matrix, because the
three things that make a Darlington different are all things one transistor cannot
do:
- Its base-emitter drop is two junctions, about 1.46 V rather than 0.7, so the base resistor from a 5 V pin passes a good deal less than you would work out for a single transistor.
- It cannot saturate. The collector bottoms out at about 0.74 V and no lower,
because the output transistor's collector is tied to the driver's and cannot go
below the driver's own
Vbe. At an amp that is three quarters of a watt of heat in the part, and it is why a Darlington driving a motor needs a heatsink where a logic-level MOSFET does not. - Its gain collapses at low current, to tens at a milliamp, because
R1takes the base current instead of the driver. That is why a Darlington datasheet does not quote hFE below half an amp.
All three are checked against ngspice 42 running the same two transistors and two resistors.
What it does not model
No high-level injection, so beta does not fall off at high current and a saturation voltage at hundreds of milliamps comes out lower than the datasheet's. Beta is one constant per model (100, 200 or 150) rather than a spread: it does not rise with temperature and does not vary between two parts out of the same bag, where a real 2N2222's datasheet quotes 100 to 300 at one operating point alone. No base-collector capacitance, so no Miller effect and no switching time. No saturation charge storage, so turn-off is instant. No temperature: the junctions are at 27 C and stay there. No thermal limit at all: this part will pass ten amps and report it honestly, where a real 2N2222 would let the smoke out at one.
Common mistakes
Leaving out the base resistor. Without one, the base-emitter junction is a bare diode across whatever is driving it, which either draws far more current than a GPIO pin can source or clamps the drive voltage to 0.7 V and does nothing useful.
See it in action
Motor on a transistor is built entirely around this one part doing its one job. Open it at /templates.
The NPN transistor as a switch page works through sizing the base resistor on a live 2N2222 driving a motor, and MOSFET vs BJT switches the same half-amp load with a 2N2222 and an IRLZ44N side by side.
How many LEDs can one Arduino pin drive? shows the point where a pin should hand the current to a 2N2222 or a 2N7000 instead.