Source: https://mokxi.com/parts/transistor
Updated: 2026-11-10

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.

Click to open it in the editor

This is the simulator itself, running here. Click anything to open it in the editor.

Open this project in the editor Read the full tutorial

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.

Lessons

## Where it turns up in a lesson

6 lessons place it in their own circuits.

### Learn articles

6 lessons

- PIR Motion Sensor: How It Works, With an Arduino
- NPN Transistor as a Switch: a 2N2222 and an Arduino
- MOSFET vs BJT: Which Transistor to Switch With
- Arduino DC Motor: Transistor Wiring and PWM Speed
- Arduino IR Obstacle Sensor (FC-51): Wiring, Code
- NPN Transistor Switch Simulator

Boards

## The boards it is shown on

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

- Arduino Uno R3

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

Filament lamp

A tungsten bulb in a holder: an inrush when it is switched on cold, tens of milliseconds to warm up, and dim on half its voltage.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio; real internet through the Cloud panel’s switch), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: the 40-pin header, driven by main.py with RPi.GPIO or gpiozero.

See every part

## 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.

Start building free Open the editor
