Transistors

Transistors are the fundamental active component in electronics. Everything in modern computing — every logic gate, every amplifier stage, every memory cell — is built from transistors. They do two things: switch and amplify. Understanding the basic types and how to use them in simple circuits opens up most of practical electronics.

BJTs — Bipolar Junction Transistors

A BJT has three terminals: Base, Collector, Emitter. A small current into the base controls a larger current between collector and emitter — that's the amplification. The ratio of collector current to base current is the current gain, called hFE or β (beta), typically 50–300 depending on the part.

Two polarities:

  • NPN — current flows from collector to emitter when a positive voltage is applied to the base (relative to emitter). Most common. Example: 2N2222, BC547, 2N3904.
  • PNP — complementary to NPN. Current flows from emitter to collector when the base is pulled low. Example: 2N2907, BC557.

For an NPN in saturation (fully on), the base-emitter voltage is about 0.7V and the collector-emitter voltage drops to nearly 0V. That's the switch state. For cutoff (fully off), base current is zero and the transistor blocks.

NPN as a Switch

         VCC
          |
         [Load]
          |
       Collector
NPN:   Base ←── [R_base] ←── Control signal
       Emitter
          |
         GND

To turn on: V_control high, base current flows, transistor saturates, load gets current
To turn off: V_control low, transistor cuts off, load disconnected from GND

Calculate the base resistor: you need enough base current to saturate the transistor (I_collector / β), with some extra margin (typically 10× the minimum base current needed). If switching 100mA with β=100, minimum I_base = 1mA. Use enough to guarantee saturation in practice: 5–10mA. With 5V control signal and 0.7V Vbe:

R_base = (5V - 0.7V) / 5mA = 860Ω → use 820Ω or 1kΩ

MOSFETs — Metal-Oxide-Semiconductor FETs

MOSFETs have Gate, Drain, Source terminals. Unlike BJTs, they're voltage-controlled — a voltage on the Gate controls current between Drain and Source, with essentially no gate current. This makes them more efficient as switches (no base current loss).

  • N-channel enhancement MOSFET — turns on when Gate voltage exceeds the Source by the threshold voltage (Vth). Typically 2–4V for standard logic-level MOSFETs. The common choice for switching from a microcontroller. Example: 2N7000 (small signal), IRF540N (power).
  • P-channel enhancement MOSFET — turns on when Gate is pulled below Source voltage. Used for high-side switching.

When fully on (in the linear/triode region), MOSFETs have a very low on-resistance (RDS_on), sometimes milliohms for power devices — much lower than a saturated BJT's Vce_sat. This means less power dissipation in high-current switching applications.

N-Channel MOSFET as a Switch

        VCC
         |
        [Load]
         |
        Drain
MOSFET: Gate ←── Control signal (must exceed Vth above Source)
        Source
         |
        GND

For logic-level control (3.3V or 5V), make sure you use a logic-level MOSFET with Vth below 2V. Standard power MOSFETs often require 8–10V on the gate to fully turn on, which won't work directly from a microcontroller.

BJT vs MOSFET — When to Use Which

  • BJT — good for linear amplifier stages, audio applications, situations where you need precise current gain control. Still common in analog design.
  • MOSFET — better for switching, especially high-current loads. More efficient (no gate current), lower on-resistance when fully on, easier to drive in parallel. The default choice for power switching.

Darlington Pairs

Two BJTs cascaded so the first drives the second — the combined current gain is β₁ × β₂, which can be thousands. Useful when you need to drive a high-current load from a very small signal current. The ULN2003 and similar ICs are arrays of Darlington drivers. Downside: higher saturation voltage (about 1.2V instead of 0.2V).