Skip to content
LumenaryAcademy
Electronics 65 min

Transistors: BJTs and MOSFETs

The controlled valve at the heart of every amplifier and every chip, used as a switch and as a preview of digital logic.

Code tested · 6AI-draftedAwaiting review by an electrical engineer

Your guides: Chloe · The Physicist, Margaret · The Bench Engineer, Gideon · The Design Reviewer

MotivationH

A valve you can turn with a fingertip

A diode is a valve that the circuit opens and closes by itself, according to which way the voltage points. A transistor is a valve with a handle: a third terminal through which a small current or voltage controls a large current between the other two. That one idea does two very different jobs.

  • Amplifying. If a microphone's few millivolts move the handle, the large current follows those millivolts faithfully, only bigger. Every radio, phone and audio system amplifies this way.
  • Switching. If a 3.3 V logic pin moves the handle all the way, the transistor turns a motor, a heater or a light fully on or fully off. And if one transistor's output works the handle of the next, transistors can compute: a modern processor contains tens of billions of them switching billions of times a second.

This lesson explains the two great families, the bipolar junction transistor (BJT) and the metal–oxide–semiconductor field-effect transistor (MOSFET), builds the models engineers calculate with, and then uses transistors as switches: first for an LED, a relay and a motor, and then for each other, in the CMOS inverter that begins the Digital level. The next lesson uses the same devices as amplifiers.

Analogy, not a formal construction

Think of a garden tap. Turning the handle takes a tiny effort, yet it controls a flow of water driven by the whole pressure of the mains. The tap does not create water or pressure; it only controls how much passes. A transistor likewise creates no energy: the power supply provides the current, and the transistor decides how much flows.

DefinitionsH

The bipolar junction transistor

A BJT is a sandwich of three doped layers: for an npn transistor, an n-type emitter, a very thin p-type base, and an n-type collector. (A pnp transistor reverses every doping and every polarity.) It is two p–n junctions back to back, but it is not two diodes, because the base is so thin, typically well under a micrometre, that the junctions interact.

Forward-bias the base–emitter junction, as in Semiconductors and diodes, and the heavily doped emitter injects electrons into the base. In a diode they would recombine with holes there. But the base is thin and lightly doped, so almost all of them diffuse across it before recombining, reach the reverse-biased base–collector junction, and are swept into the collector by its field. A small base current, mostly holes supplying the few electrons that do recombine, controls a much larger collector current.

Definition— BJT equations in the forward-active region

With the base–emitter junction forward-biased and the base–collector junction reverse-biased, an npn transistor obeys IC=IS eVBE/VT,IB=ICβ,IE=IC+IB,I_C = I_S\, e^{V_{BE}/V_T}, \qquad I_B = \frac{I_C}{\beta}, \qquad I_E = I_C + I_B, where ISI_S is a saturation current (around 10−1510^{-15} to 10−1410^{-14} A for a small transistor), VT=kT/q≈25.9V_T = kT/q \approx 25.9 mV, and β\beta (also written hFEh_{FE}) is the current gain, typically 100 to 400 for a small-signal transistor.

The collector current is set by VBEV_{BE} through the same exponential as a diode: about 60 mV more on the base multiplies ICI_C by ten. It is equally true, and more useful for hand design, to say that IC=βIBI_C = \beta I_B. But β\beta is a poorly controlled number: it varies by a factor of two or three between transistors of the same type, and with temperature and current. A good design works for any β\beta above some minimum.

The two junctions can each be on or off, giving four regions of operation:

RegionBase–emitterBase–collectorBehaviour
Cutoffoffreverse-biasedalmost no current: an open switch
Forward activeforward-biasedreverse-biasedIC=βIBI_C = \beta I_B: an amplifier
Saturationforward-biasedforward-biasedVCE≈0.1V_{CE} \approx 0.1–0.20.2 V: a closed switch
Reverse activereverse-biasedforward-biaseda poor transistor, rarely used

In saturation the base is driven harder than the collector circuit can follow: the collector current is limited by the external load, so IC<βIBI_C \lt \beta I_B, and the transistor sits fully on with only VCE(sat)V_{CE(\text{sat})} across it. The collector current in the active region also rises slightly with VCEV_{CE}, the Early effect, which the next lesson uses to find the transistor's output resistance.

BCEGDSnpn BJTn-channel MOSFET
Circuit symbols. Left: an npn bipolar transistor, with base (B), collector (C) and emitter (E); the arrow on the emitter points the way conventional current flows out. Right: an n-channel MOSFET, with gate (G), drain (D) and source (S); the gap between the gate and the channel is the insulating oxide.
DefinitionsH

The MOSFET

A MOSFET controls current with a voltage and draws essentially no steady current at its control terminal. An n-channel MOSFET starts with a p-type body. Two heavily doped n-type regions, the source and the drain, sit a short distance apart, and between them, separated from the silicon by a very thin insulating layer of oxide, lies the gate. With no gate voltage, the source and drain are two back-to-back p–n junctions and no current flows.

Raise the gate above the source and the gate's positive charge repels holes from the surface beneath it and attracts electrons. Above a threshold voltage VthV_{th} the surface holds so many electrons that it inverts into a thin n-type channel joining source to drain. The more the gate exceeds the threshold, by the overdrive Vov=VGS−VthV_{ov} = V_{GS} - V_{th}, the more electrons the channel holds, and the more easily current flows. The gate, oxide and channel form a capacitor, which is why the gate draws current only while that capacitor charges or discharges.

Definition— Square-law MOSFET model

For an n-channel MOSFET with gate–source voltage VGSV_{GS}, drain–source voltage VDS≥0V_{DS} \ge 0 and overdrive Vov=VGS−VthV_{ov} = V_{GS} - V_{th}:

  • Cutoff (Vov≤0V_{ov} \le 0): ID=0I_D = 0.
  • Triode (Vov>0V_{ov} \gt 0 and VDS<VovV_{DS} \lt V_{ov}): ID=k(VovVDS−12VDS2)I_D = k\left(V_{ov}V_{DS} - \tfrac12 V_{DS}^2\right).
  • Saturation (Vov>0V_{ov} \gt 0 and VDS≥VovV_{DS} \ge V_{ov}): ID=12k Vov2 (1+λVDS)I_D = \tfrac12 k\, V_{ov}^2\,(1 + \lambda V_{DS}).

Here k=μnCoxW/Lk = \mu_n C_{ox} W/L depends on the electron mobility μn\mu_n, the oxide capacitance per area CoxC_{ox} and the channel's width WW and length LL; λ\lambda models channel-length modulation, the slight rise of the saturation current with VDSV_{DS}.

Two warnings about names. A MOSFET's saturation region (current nearly independent of VDSV_{DS}) corresponds to a BJT's active region, not to BJT saturation; the MOSFET's switch-like region is triode. And a p-channel MOSFET (pMOS) is the mirror image, with holes in the channel, conducting when its gate is below its source by more than ∣Vth∣|V_{th}|.

python
VTH = 1.0      # threshold voltage, V
K = 2e-3       # k' W/L, the device's current factor, A/V^2
LAM = 0.02     # channel-length modulation, 1/V

def drain_current(vgs, vds):
    """Square-law (level 1) model of an n-channel MOSFET; returns (current in A, region)."""
    vov = vgs - VTH                                 # overdrive: how far the gate is above threshold
    if vov <= 0:
        return 0.0, "cutoff"
    if vds < vov:                                   # channel continuous from source to drain
        return K * (vov * vds - vds ** 2 / 2) * (1 + LAM * vds), "triode"
    return K / 2 * vov ** 2 * (1 + LAM * vds), "saturation"   # channel pinched off at the drain

vds_list = [0.25, 0.5, 1.0, 1.5, 2.0, 3.0, 5.0]
print("drain current in mA (t = triode, s = saturation, c = cutoff)")
print("V_GS \\ V_DS " + "".join(f"{v:>9.2f}" for v in vds_list))
for vgs in [0.8, 1.5, 2.0, 2.5, 3.0]:
    cells = []
    for vds in vds_list:
        i, region = drain_current(vgs, vds)
        cells.append(f"{i * 1e3:8.3f}{region[0]}")
    print(f"{vgs:8.1f} V  " + "".join(cells))

print("\nAs a switch: on-resistance near V_DS = 0 is 1 / (K (V_GS - V_TH))")
for vgs in [1.5, 2.0, 3.0, 5.0]:
    print(f"  V_GS = {vgs:.1f} V: R_on = {1 / (K * (vgs - VTH)):6.1f} ohm")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

(The program multiplies the triode current by 1+λVDS1 + \lambda V_{DS} too, as SPICE's level-1 model does, so that the two formulas meet at the boundary.) Read across a row and you see the two regions: in triode the current rises roughly in proportion to VDSV_{DS}, as in a resistor, and in saturation it barely changes. Read down the 2 V column, where both are in saturation, and doubling the overdrive from 1 V to 2 V quadruples the current, from 1.040 to 4.160 mA: the square law. Near VDS=0V_{DS} = 0 the transistor is a resistor whose value the gate sets, from 1 kΩ at 1.5 V down to 125 Ω at 5 V, which is why a switch's gate should be driven well above threshold.

012345drain–source voltage V_DS (volts)1234I_D (mA)V_GS = 1.5 V2.0 V2.5 V3.0 Vtriodesaturation
Output characteristics of the square-law MOSFET in the program (V_th = 1 V, k = 2 mA/V², λ = 0.02 per volt), for four gate voltages. Left of the dashed curve, V_DS = V_ov, the device is in triode and behaves like a gate-controlled resistor; to the right it is in saturation and behaves like a current source.

Where the square law stops being true

The square law is a long-channel model, derived for transistors whose channels are many micrometres long. It is excellent for intuition and acceptable for hand design of discrete and older devices, but in the short channels of modern chips several effects take over:

  • Velocity saturation. In very high fields, electrons stop speeding up and travel at a limiting velocity of about 10710^7 cm/s. The saturation current then grows roughly in proportion to VovV_{ov}, not its square.
  • Short-channel effects. When source and drain are only tens of nanometres apart, the drain's field reaches under the gate and helps turn the channel on: the threshold falls as VDSV_{DS} rises (drain-induced barrier lowering) and as LL shrinks (threshold roll-off), and the gate loses control.
  • Subthreshold conduction. Below threshold the current does not drop to zero but falls exponentially, by at best a factor of ten for every 60 mV at room temperature, the same VTln⁡10V_T \ln 10 as a diode. With billions of transistors, this leakage costs real power.
  • Gate leakage and mobility degradation. Oxides a few atoms thick leak by quantum tunnelling, which is why chips moved to thicker high-permittivity ("high-k") gate dielectrics, and strong vertical fields slow the electrons.

Industry simulates transistors with compact models such as BSIM, developed at Berkeley, with hundreds of parameters fitted to measurements by each chip factory. And it changed the transistor's shape: since the 2010s leading-edge chips have used FinFETs, whose gate wraps a thin fin of silicon on three sides, and as of 2026 the most advanced processes have moved to gate-all-around nanosheet transistors, whose gate surrounds the channel entirely. Transistor scaling tells that story.

Worked examplesH

The transistor as a switch

A switch should be either fully off (no current, so no power lost) or fully on (little voltage across it, so little power lost). In between, with both current and voltage, a transistor gets hot. So switching design is about driving the transistor firmly into cutoff or firmly into saturation (BJT) or triode (MOSFET).

Example— An LED from a 3.3 V logic pin, through an npn transistor

A microcontroller pin can supply only a few milliamperes, and its 3.3 V may be too low for the load. Put an npn transistor's emitter to ground, the LED and a resistor from the 5 V rail to its collector, and drive its base from the pin through a resistor RBR_B.

  • Collector side. For 20 mA through a red LED (2.0 V) with VCE(sat)=0.2V_{CE(\text{sat})} = 0.2 V: RC=(5−2.0−0.2)/0.020=140 ΩR_C = (5 - 2.0 - 0.2)/0.020 = 140\ \Omega; round up to the standard 150 Ω, giving 18.7 mA.
  • Base side. With a minimum β\beta of 100 the base needs at least 18.7/100=0.18718.7/100 = 0.187 mA. Designers overdrive the base, here by a factor of 5, to stay in saturation whatever the actual β\beta: IB≈0.93I_B \approx 0.93 mA and RB=(3.3−0.75)/0.93 mA≈2.7 kΩR_B = (3.3 - 0.75)/0.93\ \text{mA} \approx 2.7\ \text{k}\Omega.

The transistor then dissipates only 18.7 mA×0.2 V≈3.718.7\ \text{mA} \times 0.2\ \text{V} \approx 3.7 mW.

For a bigger load the BJT's base current becomes a problem. A 12 V motor drawing 2 A through a BJT in saturation, where designers assume a "forced" β\beta of about 10, needs 200 mA of base current, far beyond any logic pin. A MOSFET needs essentially no steady gate current, only brief pulses to charge and discharge its gate capacitance, and a power MOSFET's on-resistance RDS(on)R_{DS(\text{on})} can be a few milliohms. That is why MOSFETs switch almost every load above a few hundred milliamperes. Choose one specified as logic-level, meaning its RDS(on)R_{DS(\text{on})} is guaranteed at the gate voltage you actually have (say 2.5 V or 4.5 V); a part whose threshold is "2 V" may still be only half on at 3.3 V.

python
import math

E24 = [1.0, 1.1, 1.2, 1.3, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.7, 3.0,
       3.3, 3.6, 3.9, 4.3, 4.7, 5.1, 5.6, 6.2, 6.8, 7.5, 8.2, 9.1]

def e24(r, up):
    """The standard E24 resistor value nearest r, rounding up (up=True) or down."""
    values = [v * 10 ** d for d in range(0, 7) for v in E24]
    return min(v for v in values if v >= r) if up else max(v for v in values if v <= r)

# 1. An NPN transistor lets a 3.3 V logic pin switch a red LED from a 5 V rail.
V_RAIL, V_LED, I_LED, V_CESAT = 5.0, 2.0, 0.020, 0.2
R_C = e24((V_RAIL - V_LED - V_CESAT) / I_LED, up=True)     # round up: never exceed 20 mA
I_C = (V_RAIL - V_LED - V_CESAT) / R_C
BETA_MIN, OVERDRIVE, V_PIN, V_BE = 100, 5, 3.3, 0.75
I_B = OVERDRIVE * I_C / BETA_MIN            # base current: five times the bare minimum
R_B = e24((V_PIN - V_BE) / I_B, up=False)                # round down: a little more drive
print(f"LED resistor {R_C:.0f} ohm -> {I_C * 1e3:.1f} mA; base resistor {R_B:.0f} ohm "
      f"-> {(V_PIN - V_BE) / R_B * 1e3:.2f} mA from the pin")
print(f"transistor dissipation {I_C * V_CESAT * 1e3:.1f} mW")

# 2. A 12 V motor drawing 2 A: compare a BJT with a MOSFET as the switch.
I_M = 2.0
print(f"\nBJT, forced beta 10, V_CE(sat) 0.3 V: base current {I_M / 10 * 1e3:.0f} mA, "
      f"dissipation {I_M * 0.3:.2f} W")
for r_on in (0.050, 0.020, 0.005):
    print(f"MOSFET with R_DS(on) = {r_on * 1e3:.0f} milliohm: gate current ~0 when steady, "
          f"dissipation {I_M ** 2 * r_on:.3f} W")

# 3. A relay coil: what the flyback diode has to deal with.
L, R_COIL, V_COIL, C_STRAY = 20e-3, 70.0, 5.0, 100e-12
i0 = V_COIL / R_COIL
print(f"\ncoil current {i0 * 1e3:.1f} mA, stored energy {0.5 * L * i0 ** 2 * 1e6:.0f} uJ")
print(f"no diode: the current charges the stray capacitance to about "
      f"{i0 * math.sqrt(L / C_STRAY):.0f} V")
print(f"with a diode: the current decays with time constant L/R = {L / R_COIL * 1e6:.0f} us")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Inductive loads and the flyback diode

Relays, solenoids and motors are coils: inductors, as in Capacitors and inductors. An inductor's current cannot change instantly, because v=L di/dtv = L\,di/dt would need an infinite voltage. When the transistor turns off, the coil's current keeps flowing and drives the drain voltage up until something conducts. With nothing provided, that something is the transistor itself breaking down, or the energy rings in the stray capacitance. The program estimates that the 71 mA in a 20 mH coil would charge 100 pF of stray capacitance to about iL/C≈1010i\sqrt{L/C} \approx 1010 V, from a 5 V supply.

The cure is a flyback diode (also called a freewheeling or snubber diode) across the coil, reverse-biased in normal operation. At turn-off the coil's current simply transfers into the diode and circulates through it, the drain rises only one diode drop above the supply, and the stored energy, 12Li2≈51\tfrac12 L i^2 \approx 51 µJ here, is dissipated in the coil's own resistance.

+5 Vrelay coilflybackdiodeDGS100 Ω100 kΩlogic pin0 or 3.3 V
A low-side MOSFET switch for a relay coil. The logic pin drives the gate through a small resistor; the pull-down keeps the MOSFET off while the pin is undefined at power-up. The flyback diode, cathode to the supply, carries the coil's current when the MOSFET turns off.

This is a place to simulate. The netlist below runs two copies of the circuit side by side, one with the diode and one without (with 100 pF standing in for the stray capacitance), switching each coil on at 1 ms and off at 3 ms. The MOSFET and diode use SPICE's built-in models with plausible textbook parameters of our own choosing, not a manufacturer's model.

spice
* A MOSFET switching a relay coil, with and without a flyback diode
VDD vdd 0 DC 5
* gate drive from a 3.3 V logic pin: on at 1 ms, off at 3 ms
VG gate 0 PULSE(0 3.3 1m 1u 1u 2m 10m)
* circuit A: coil (20 mH, 70 ohm) with a flyback diode across it
LA vdd xa 20m
RA xa da 70
DA da vdd DFLY
MA da gate 0 0 NSW
* circuit B: the same coil with no diode; 100 pF stands for the stray capacitance
LB vdd xb 20m
RB xb db 70
CB db 0 100p
MB db gate 0 0 NSW
* textbook level-1 models with plausible parameters (not vendor models)
.model NSW NMOS(LEVEL=1 VTO=1.5 KP=5)
.model DFLY D(IS=1e-12 N=1.5)
.control
tran 50n 5m
meas tran ion  AVG i(VDD) from=2.5m to=2.9m
meas tran va_peak MAX v(da) from=2.9m to=5m
meas tran vb_peak MAX v(db) from=2.9m to=5m
meas tran ia_end FIND i(LA) AT=3.3m
let coil_ma = -1000 * ion / 2
echo "on: each coil carries $&coil_ma mA"
echo "turn-off peak drain voltage with diode: $&va_peak V, without: $&vb_peak V"
echo "coil current 0.3 ms after turn-off, with diode: $&ia_end A"
.endc
.end

ngspice reports 71.1 mA in each coil while on. At turn-off, the drain with the diode peaks at 5.97 V, one diode drop above the rail; the drain without it rings up to 1008 V, as the hand estimate predicted. With the diode, 0.3 ms after turn-off the coil current has fallen to 16.4 mA, a little faster than the time constant L/R=286L/R = 286 µs alone would give, because the diode's drop adds to the voltage opposing the current.

Three habits complete a robust switch: a gate resistor of tens of ohms to tame ringing in the gate wiring, a pull-down resistor so the transistor stays off while the controlling pin is still undefined at power-up, and a check of the transistor's dissipation and temperature at the largest load. Keep experiments to small loads from batteries or a current-limited bench supply: a stalled motor can draw several times its running current.

ComputationC

Transistors switching transistors: the CMOS inverter

Put a pMOS transistor between the supply VDDV_{DD} and the output, and an nMOS between the output and ground, with their gates joined as the input. When the input is low, the nMOS is off and the pMOS is on, so the output is pulled up to VDDV_{DD}. When the input is high, the nMOS is on and the pMOS off, so the output is pulled down to ground. The output is the logical NOT of the input: an inverter, the simplest gate of complementary MOS (CMOS) logic.

V_DDinoutpMOSnMOS
A CMOS inverter. The pMOS (bubble on its gate) connects the output to the supply when the input is low; the nMOS connects it to ground when the input is high. In either steady state one of them is off, so no current flows from supply to ground.

In either steady state one transistor is off, so no current flows from the supply to ground. That is CMOS's great virtue: a gate consumes power essentially only while it switches, charging and discharging the capacitance it drives. Between the two states there is a narrow region where both transistors conduct. The input voltage at which the output equals the input is the switching threshold VMV_M. Setting the two saturation currents equal (and ignoring λ\lambda) gives VM=VDD−∣Vtp∣+Vtnkn/kp1+kn/kp,V_M = \frac{V_{DD} - |V_{tp}| + V_{tn}\sqrt{k_n/k_p}}{1 + \sqrt{k_n/k_p}}, so equal transistors make VMV_M low, because electrons are about twice as mobile as holes and the nMOS wins the tug of war. The program below finds the transfer curve by bisection on the output voltage, using the same level-1 equations as SPICE, for VDD=1.8V_{DD} = 1.8 V, thresholds of 0.45 V, and transistors of equal size.

python
VDD = 1.8
VTN, VTP = 0.45, 0.45          # threshold magnitudes, V
KN, KP = 200e-6, 100e-6        # k' W/L for the nMOS and the (same-sized) pMOS, A/V^2
LAM = 0.05                     # channel-length modulation, 1/V

def square_law(vov, vds, k):
    """Level-1 drain current for overdrive vov and drain-source voltage vds (both >= 0)."""
    if vov <= 0:
        return 0.0
    if vds < vov:
        return k * (vov * vds - vds ** 2 / 2) * (1 + LAM * vds)
    return k / 2 * vov ** 2 * (1 + LAM * vds)

def vout(vin):
    """Output where the pMOS current (pulling up) equals the nMOS current (pulling down)."""
    lo, hi = 0.0, VDD
    for _ in range(60):                      # bisection: the mismatch falls as vout rises
        mid = (lo + hi) / 2
        i_n = square_law(vin - VTN, mid, KN)
        i_p = square_law(VDD - vin - VTP, VDD - mid, KP)
        if i_p > i_n:
            lo = mid                          # pull-up wins: the output must be higher
        else:
            hi = mid
    return (lo + hi) / 2

print(" V_in   V_out   (equal-sized transistors)")
for vin in [0.0, 0.3, 0.5, 0.7, 0.8, 0.85, 0.9, 1.1, 1.3, 1.5, 1.8]:
    print(f"{vin:5.2f}  {vout(vin):6.3f}")

lo, hi = 0.0, VDD                             # switching threshold: where vout(vin) = vin
for _ in range(50):
    mid = (lo + hi) / 2
    if vout(mid) > mid:
        lo = mid
    else:
        hi = mid
print(f"switching threshold V_M = {lo:.4f} V")
gain = (vout(lo + 1e-4) - vout(lo - 1e-4)) / 2e-4
print(f"slope of the transfer curve at V_M = {gain:.1f}")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

The output stays within 3 mV of 1.8 V up to an input of 0.5 V, then falls from 1.46 V to 0.24 V as the input moves just 50 mV, from 0.80 to 0.85 V. The slope at the threshold is about −96: a gate is a high-gain amplifier operated at its extremes, which is why logic levels are restored at every stage instead of degrading. The threshold, 0.8236 V, is below VDD/2V_{DD}/2, as the formula predicted. SPICE agrees, and shows the remedy of making the pMOS twice as wide:

spice
* Two CMOS inverters, input swept from 0 to 1.8 V
VDD1 vdd1 0 DC 1.8
VDD2 vdd2 0 DC 1.8
VIN in 0 DC 0
* inverter 1: nMOS and pMOS the same size
MP1 out1 in vdd1 vdd1 PMOD W=1u L=1u
MN1 out1 in 0 0 NMOD W=1u L=1u
* inverter 2: pMOS twice as wide, to make up for the holes' lower mobility
MP2 out2 in vdd2 vdd2 PMOD W=2u L=1u
MN2 out2 in 0 0 NMOD W=1u L=1u
* textbook level-1 (square-law) models, not a real process
.model NMOD NMOS(LEVEL=1 VTO=0.45 KP=200u LAMBDA=0.05)
.model PMOD PMOS(LEVEL=1 VTO=-0.45 KP=100u LAMBDA=0.05)
.control
dc VIN 0 1.8 0.001
meas dc vm1 WHEN v(out1)=v(in)
meas dc vm2 WHEN v(out2)=v(in)
let idd2 = -i(VDD2)
meas dc ipeak MAX idd2
meas dc ilow FIND idd2 AT=0.1
meas dc ihigh FIND idd2 AT=1.7
echo "switching threshold: equal sizes $&vm1 V, wider pMOS $&vm2 V"
echo "inverter 2 supply current: $&ilow A (input low), $&ihigh A (input high), peak $&ipeak A"
.endc
.end

ngspice finds VMV_M = 0.823591 V for equal sizes, matching the Python, and exactly 0.9 V, half the supply, with the pMOS twice as wide. The second inverter draws 1.81 pA from the supply with its input low or high (the simulator's tiny built-in leakage conductances) and 21.2 µA at the peak, when the input sits at 0.9 V and both transistors conduct.

The Digital level builds NAND, NOR and every other gate from these complementary pairs.

History & global context

From a crystal on a bench to billions on a chip

The idea of controlling a semiconductor's current with an electric field is older than the transistor: Julius Lilienfeld filed patents on field-effect devices in 1925 and 1926, and Oskar Heil did so in 1934, but nobody could make the surfaces clean enough for them to work. In December 1947, at Bell Labs in New Jersey, John Bardeen and Walter Brattain pressed two gold contacts onto a germanium crystal and saw a signal amplified: the point-contact transistor. Within weeks William Shockley, their group's leader, had worked out the more robust junction transistor, which was first made in 1950–51. The three shared the 1956 Nobel Prize in Physics. Transistor radios followed in 1954, the Regency TR-1 in the United States, and in 1955 the TR-55 from a young Japanese company, Tokyo Tsushin Kogyo, soon renamed Sony.

Wiring discrete transistors together became the bottleneck, the "tyranny of numbers". In September 1958 Jack Kilby at Texas Instruments built a working circuit on a single piece of germanium, and in 1959 Robert Noyce at Fairchild Semiconductor described a monolithic silicon integrated circuit with its wiring deposited on top, made possible by Jean Hoerni's planar process, which protected the junctions under a layer of oxide. Kilby received the 2000 Nobel Prize in Physics; Noyce had died in 1990.

In 1959, also at Bell Labs, Mohamed Atalla and Dawon Kahng made the first working MOSFET, using a thermally grown oxide to tame silicon's surface. It was slower than the BJTs of the day, but it was simpler to make and could be packed far more densely. In 1963 Frank Wanlass and Chih-Tang Sah at Fairchild described CMOS, with its near-zero idle power. Those two properties, density and frugality, are why the MOSFET became the most manufactured device in history and the subject of Transistor scaling.

ExplanationH

Transistors in professional practice

Discrete transistors are still everywhere on circuit boards, chosen from datasheets published by makers such as Infineon, onsemi, Nexperia, STMicroelectronics, Toshiba, ROHM, Vishay and Diodes Incorporated. For a switching MOSFET an engineer reads first: the maximum drain–source voltage (with margin above any spike), RDS(on)R_{DS(\text{on})} at the gate voltage actually available, the gate charge (how much charge the driver must move, which sets switching speed and losses), the thermal resistance from junction to ambient, and the safe operating area, the combinations of voltage, current and time the part survives.

Beyond silicon MOSFETs, power engineers use IGBTs (a MOS gate controlling a bipolar structure, for hundreds of amperes at kilovolts) and silicon carbide and gallium nitride transistors, which switch faster with lower losses, now common in electric-vehicle inverters and compact chargers (Power electronics). BJTs remain the choice where their exponential law is an asset: precise analog circuits, low-noise amplifiers, and the radio-frequency silicon–germanium transistors of high-speed links. Inside chips, nearly everything is CMOS.

Common misconceptionsH

Common misconceptions

Misconception

"A transistor amplifies by creating extra current." It creates nothing. The power supply provides every joule; the transistor only controls how much current the supply delivers through the load, the way a tap controls water.

Misconception

"MOSFET saturation and BJT saturation are the same thing." They are opposites. A BJT in saturation is a closed switch with about 0.2 V across it. A MOSFET in saturation is a current source, the region used for amplifiers; a MOSFET used as a closed switch is in triode.

Misconception

"If the gate voltage is above the threshold, the MOSFET is fully on." At threshold the channel is barely formed and conducts microamperes. RDS(on)R_{DS(\text{on})} is specified at a much higher gate voltage, often 4.5 V or 10 V; a datasheet's "threshold 2 V" part may be poorly on at 3.3 V.

Misconception

"The flyback diode is optional on a small relay." Even a small coil stores enough energy to drive a switch's voltage far beyond its rating, as the simulation showed. Without the diode the transistor avalanches on every turn-off and eventually fails.

Exercises

Exercises

1. Transistors: BJTs and MOSFETs

Warm-upHuman

An npn transistor has VBE=0.72V_{BE} = 0.72 V and VCE=0.12V_{CE} = 0.12 V. Its base current is 1 mA, its collector current is 20 mA, and its β\beta in the active region is about 200. In which region is it operating?

Choose one

2. Transistors: BJTs and MOSFETs

CoreHuman

An n-channel MOSFET has k=μnCoxW/L=4k = \mu_n C_{ox} W/L = 4 mA/V², Vth=0.8V_{th} = 0.8 V and negligible channel-length modulation. With VGS=2.3V_{GS} = 2.3 V and VDS=5V_{DS} = 5 V, what is the drain current in microamperes?

3. Transistors: BJTs and MOSFETs

CoreHuman

A 3.3 V logic pin drives an npn transistor that switches a 100 mA load. The transistor's minimum β\beta is 50, you want to overdrive the base by a factor of 2, and VBE=0.7V_{BE} = 0.7 V. What base resistor, in ohms, should you calculate (before rounding to a standard value)?

4. Transistors: BJTs and MOSFETs

Warm-upHuman

A MOSFET switch carries a steady 3 A with RDS(on)=25R_{DS(\text{on})} = 25 mΩ. How much power, in milliwatts, does it dissipate while on?

5. Transistors: BJTs and MOSFETs

CoreHuman

A low-side n-channel MOSFET switches a 12 V solenoid: the solenoid runs from +12 V to the drain, and the source is grounded. Where should the flyback diode go?

Choose one

6. Transistors: BJTs and MOSFETs

CoreHuman

Which statements about a CMOS inverter are true? Select all that apply.

Choose all that apply

7. Transistors: BJTs and MOSFETs

CoreHuman

You need a MOSFET to switch 4 A from a 3.3 V microcontroller pin, with no gate driver. Part X's datasheet says: threshold 1.0–2.5 V; RDS(on)R_{DS(\text{on})} = 8 mΩ at VGSV_{GS} = 10 V. Part Y's says: threshold 0.5–1.0 V; RDS(on)R_{DS(\text{on})} = 20 mΩ at VGSV_{GS} = 2.5 V. Which is the safer choice, and why?

Choose one

8. Transistors: BJTs and MOSFETs

CoreComputational

Write mosfet(vgs, vds, vth, k, lam=0.0) for an n-channel MOSFET with VDS≥0V_{DS} \ge 0, returning (current, region) where region is "cutoff", "triode" or "saturation":

  • cutoff when Vov=VGS−Vth≤0V_{ov} = V_{GS} - V_{th} \le 0 (current 0);
  • triode when VDS<VovV_{DS} \lt V_{ov}: ID=k (VovVDS−VDS2/2)(1+λVDS)I_D = k\,(V_{ov}V_{DS} - V_{DS}^2/2)(1 + \lambda V_{DS});
  • saturation when VDS≥VovV_{DS} \ge V_{ov}: ID=12kVov2(1+λVDS)I_D = \tfrac12 k V_{ov}^2 (1 + \lambda V_{DS}).

The tests check values from the lesson's table and that the two formulas meet at VDS=VovV_{DS} = V_{ov}.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Further reading and resources