Electronics

Semiconductors — diodes, transistors, and MOSFETs

Everything in Passive Components only resists, stores, or releases energy. Semiconductors are where electronics gets interesting — a material that can be switched between conducting and not conducting is what makes diodes, transistors, and ultimately every digital chip possible.

Quick reference
What it is
Materials (and devices built from them) whose conductivity can be controlled — a diode conducts one way only, a transistor uses a small signal to control a much larger one.
Mental model
A diode is a one-way valve. A transistor is a valve controlled by a second, smaller input — current for a BJT, voltage for a MOSFET.
Key numbers
Silicon diode forward drop ≈ 0.7 V; MOSFET is voltage-controlled (near-zero static gate current), BJT is current-controlled.
Reach for it when
Anything that needs to switch or amplify — driving a motor/LED/relay from a microcontroller pin almost always means a transistor.

Conductors, insulators, and semiconductors

Material classBehaviorExample
ConductorElectrons move freely — low resistanceCopper, aluminum
InsulatorElectrons are tightly bound — very high resistanceGlass, rubber, plastic
SemiconductorIn between — and its conductivity can be deliberately controlledSilicon, germanium

The trick that makes semiconductors useful isn't the raw material — pure silicon is a mediocre insulator — it's doping: adding trace impurities that create either a surplus of free electrons (N-type) or a surplus of "holes" where an electron is missing (P-type). Every diode and transistor below is built from junctions between N-type and P-type silicon.

Diode

A diode is a single P-N junction: current flows easily one way (forward biased) and is blocked the other way (reverse biased), up to some breakdown voltage where it fails or (for a Zener diode, deliberately) conducts in reverse at a controlled voltage.

A diode conducts freely when forward biased and blocks current entirely when reverse biased Forward biased conducts — about a 0.7 V drop Reverse biased blocks — until breakdown voltage
The bar end is the cathode; current only flows in the direction the triangle points.

An LED (light-emitting diode) is a diode engineered to emit light when forward biased — exactly the LED wired up in Fundamentals. A regular diode is also what makes the flyback protection on an inductive load work: wired backward across the load, it blocks current in normal operation and only conducts to absorb the collapsing field's reverse spike.

Diode types: why pick one over another

"Diode" isn't one part — different junction designs trade forward drop, speed, and behavior for different jobs:

TypeForward dropWhy you'd choose it
Standard rectifier~0.7 VCheap, general-purpose — AC-to-DC rectification, flyback protection, reverse-polarity protection.
Schottky~0.2–0.3 VLower forward drop (less wasted power/heat) and much faster switching — the default choice in switching power supplies and anywhere efficiency matters.
ZenerReverse breakdown at a precise, chosen voltageDeliberately operated in reverse breakdown to hold a node at a known voltage — the classic simple (if inefficient) voltage reference or crude regulator.
LED~1.8–3.3 V (varies by color)Engineered to emit light when forward biased — the higher, color-dependent forward drop is a side effect of the semiconductor band gap that produces that specific wavelength.

The "why" behind Schottky's speed and lower drop is the same underlying idea as everything else here: a Schottky diode uses a metal-semiconductor junction instead of a P-N junction, which stores far less charge at the junction and can therefore switch off almost instantly — exactly why it's preferred over a standard rectifier anywhere switching speed or efficiency actually matters, at the cost of a lower reverse voltage rating and more reverse leakage current.

Transistor — a controlled valve

A transistor is a three-terminal device where a small signal on one terminal controls a much larger current between the other two — either as a switch (fully on or fully off) or an amplifier (a small varying input becomes a larger varying output). Two families dominate: BJTs (Bipolar Junction Transistors, controlled by current) and FETs (Field-Effect Transistors, controlled by voltage) — MOSFETs are by far the most common FET.

BJT: current-controlled

A BJT has three terminals — Base, Collector, and Emitter. A small current flowing into the base allows a much larger current to flow from collector to emitter (NPN) — the ratio between them is the transistor's current gain, often called β or hFE, commonly in the range of tens to a few hundred. Because it's current-controlled, driving a BJT means supplying real base current, which a microcontroller pin can usually do directly for small transistors, but the base current still has to be sized correctly with a resistor.

NPN is by far the more common polarity for switching — the collector current flows into the collector and out the emitter toward ground, matching the low-side switching pattern used throughout this page. PNP is the mirror image (current flows out of the emitter), used for high-side switching — turning a load on by connecting it to the positive supply rail rather than ground — a real but less common pattern.

Worked example: sizing a base resistor

Say a 3.3 V GPIO pin needs to switch an NPN BJT hard on to sink 100 mA through a load, and the transistor's datasheet guarantees hFE ≥ 100 at that collector current. Sizing the base resistor is a direct application of the ratio above:

  1. Minimum base current for full saturation: IB = IC / hFE = 100 mA / 100 = 1 mA.
  2. Add margin — real designs drive well past the bare minimum to guarantee saturation across temperature and part variation; a common rule of thumb is 5–10× the calculated minimum, so target IB ≈ 5 mA.
  3. Solve for the resistor: Rbase = (VGPIO − VBE) / IB = (3.3 V − 0.7 V) / 5 mA = 520 Ω → the nearest standard value, 470 Ω, is the practical choice.

Every number in that calculation is doing real work: too little base current and the transistor sits in its linear region instead of fully saturated, wasting power as heat inside the transistor itself instead of delivering it to the load; too little resistance and excess base current does nothing useful beyond what saturation already achieved, just wasting power in the resistor and stressing the GPIO pin's output current rating for no benefit.

MOSFET: voltage-controlled

A MOSFET (Metal-Oxide-Semiconductor Field-Effect Transistor) has three terminals — Gate, Drain, and Source. The gate is electrically insulated from the rest of the device by a thin oxide layer (literally what "metal-oxide" describes) — so a MOSFET is controlled by voltage, not current, and draws essentially zero static current into its gate. Enough gate-to-source voltage (above a threshold, VGS(th)) opens a conductive channel between drain and source; below it, the channel is closed.

N-channel
Turns on with a positive gate voltage — by far the more common type for switching a load to ground (low-side switching).
RDS(on)
The channel's resistance once fully on — directly sets how much power the MOSFET itself dissipates as heat at a given current (P = I² × RDS(on)).
Logic-level MOSFET
Specifically rated to fully turn on from 3.3 V or 5 V logic — a "standard" MOSFET may need 10 V+ on the gate to reach its rated RDS(on), which a microcontroller pin can't supply on its own.

Wiring a MOSFET as a switch

This is the single most common way an embedded engineer touches a MOSFET: using it to let a low-power microcontroller pin switch a higher-current or higher-voltage load it could never drive directly.

An MCU GPIO pin driving a MOSFET's gate through a resistor, low-side switching a motor to ground, with a flyback diode across the motor +12 V motor supply Motor flyback diode MOSFET D S G GND MCU GPIO pin R gate
"Low-side" switching — the load sits between the supply and the MOSFET's drain, and the MOSFET's source goes straight to ground. A gate resistor (~100 Ω–1 kΩ) limits inrush current into the gate's capacitance; the flyback diode gives the motor's collapsing field somewhere safe to go when the MOSFET switches off.

With the GPIO pin high, gate voltage exceeds VGS(th), the channel opens, and current flows from the +12 V rail through the motor, through the MOSFET, to ground. Drive the pin low and the channel closes — the motor stops.

BJT vs. MOSFET

BJTMOSFET
Controlled byBase currentGate voltage
Static control-input currentReal, must be sized with a resistor~Zero once at steady state
Switching speedModerateGenerally faster — good for PWM
Typical embedded useSimple low-current switching, some analog/audioMotor/LED/relay driving, switching power supplies
Choosing between them

Reach for a MOSFET by default for anything a microcontroller switches — the near-zero static gate current means no ongoing power cost to hold it on, and it handles higher currents and faster PWM more gracefully. Reach for a BJT when the load is genuinely small, when a design already has a base-current budget worked out, or in analog/audio applications where a BJT's more predictable linear-region behavior is actually the point rather than something to avoid.

Real-world applications

Gotchas

Field notes