Part

Transistor (NPN or PNP)

The part that lets a board pin run something a board pin cannot run.

See every part
  • 3 pins
  • 5 settings
  • In 8 projects
  • In 6 lessons
Drawn live by the editor's own code, at the size you see it.
At a glance

The Transistor (NPN or PNP) in brief

What it is, and every setting the properties panel gives it.

A bipolar transistor lets a small current into its base control a much larger one from collector to emitter, which is how a board pin that gives twenty milliamps runs a motor, a relay coil or a string of LEDs. Mokxi’s part is the full Gummel-Poon SPICE model, with each model’s own vendor card: the 2N2222, BC547, 2N3904, the TIP120 Darlington, the PNP 2N3906 and BC557, and twenty more. Nothing is written in as a fixed drop. The base-emitter voltage is whatever the base current makes it, about 0.70 V at ten milliamps on a 2N2222, and a saturated switch bottoms out where the collector junction goes forward, about 44 mV for a 2N2222 switching 22 mA on four milliamps of base. The gain is not one number either: it falls at microamps and at hundreds of milliamps, as on the datasheet’s curves. The legs are drawn in each package’s real order, E B C for a PN2222A and C B E for a BC547, so a wrong guess shows up here as it would on the bench.

Family
Timers and analog
Pins
3
model
2N2222 (or BC547, BC548, 2N3904, TIP120, 2N3906, 2N2907, BC557, S8050, BC337, 2N4401, TIP31C, TIP41C, BD139, 2SC5200, 2N3055, TIP122, S8550, BC327, 2N4403, 2SA1015, TIP32C, TIP42C, BD140, 2SA1943, MJ2955, TIP125)
2N2222 (NPN, the classic 800 mA metal-can switch), BC547 and BC548 (NPN, 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, the American 200 mA equivalent), TIP120 (an NPN Darlington in TO-220, a 5 A switch with a gain in the thousands), 2N3906 (PNP), 2N2907 (PNP, the 2N2222's complement) or BC557 (PNP, the BC547's).
legs
package (or schematic)
beta
0
vbe
0
vce_sat
0
Pins

3 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
C
Collector.
B
Base. A little current here controls a lot more at C.
E
Emitter.
How to use it

How to switch a load with a transistor and an Arduino

An NPN transistor as a low-side switch: the emitter to GND, the load between the supply and the collector, and the base to a pin through a resistor, 1 k from a 5 V pin. digitalWrite(pin, HIGH) pushes about 4 mA into the base and the collector passes the load’s current to ground; LOW turns it off. On a PWM pin, analogWrite sets how much of the time it is on.

In the circuit here a 2N2222 runs a DC motor from pin 9, and at full speed its collector sits at about a quarter of a volt, so nearly all of the 5 V is across the motor. Check the legs: a PN2222A reads E B C with its flat face toward you, a BC547 C B E. A transistor in backwards still conducts a little, which makes it a hard fault to find.

Part pin
Board pin
Base, through 1 k
Pin 9
Emitter
GND
Collector
The load’s low side; its high side to 5 V

From a 3.3 V pin use a smaller base resistor, about 470 ohms, or a logic-level MOSFET, which needs no base current at all.

Arduino Uno: motor on a transistorlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
How it is modeled

What is true about the Transistor (NPN or PNP), here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

Gummel-Poon, the full SPICE transistor model, solved by Newton-Raphson along with everything the transistor is wired to. It is checked against ngspice 42 on the same cards: low-side switches at 10 mA, 100 mA and 500 mA, a PNP high-side switch, an emitter follower, a common-emitter stage's operating point and the TIP120, all to a fraction of a percent.

There is no base-emitter drop written into the part, and no saturation floor. Vbe is whatever the base current makes it (about 0.66 V at a milliamp of collector current and 0.70 V at ten on a 2N2222). The transistor bottoms out because the collector junction goes forward, plus the collector's own bulk resistance times the current. A 2N2222 switching 22 mA on four milliamps of base current sits at about 44 mV.

The gain is not one number. It is lower at microamps (recombination in the base), highest in the milliamps, and falls off at hundreds of milliamps (high level injection). That fall is why "beta times the base current" stops working for big loads. A 2N2222 with a 10 Ω load on 5 V (half an amp) and a 1 k base resistor from a 5 V pin gets 4.1 mA of base current; at that current the gain has fallen below 100, so the transistor never saturates: it passes 389 mA and drops 1.1 V, a third of a watt of heat. With 220 Ω on the base it saturates at 447 mA and 0.53 V, inside the datasheet's VCE(sat) of 1 V at 500 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. The junction capacitances and the charge stored in the base are in the card too, so a stage has a Miller capacitance, a transistor has an fT, and one driven hard into saturation takes a moment to turn off.

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.

Not modeled

Gain spread: each model is one card, so two parts out of the same bag are identical, where a real 2N2222's datasheet quotes 100 to 300 at one operating point alone. No breakdown: nothing avalanches at the datasheet's V(BR)CEO. No self-heating: the junctions sit at the simulation's temperature however much power the part dissipates. 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. Nor a safe operating area, which is what really limits a 2N3055 or a 2SC5200 in an amplifier: the datasheet's curve of how much current it may carry at each voltage is not checked here.

From Transistor, in full.

Projects

See the Transistor (NPN or PNP) in a project

8 built-in projects use it. Each opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Transistor (NPN or PNP) in it.

Wire up the Transistor (NPN or PNP)

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.