<!--order=14-->


<h1>Transistors</h1>
<p>Transistors are the fundamental active component in electronics. Every logic gate, amplifier stage, and 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 unlocks most of practical electronics design. The two major families you'll encounter are BJTs and MOSFETs — different physics, different strengths.</p>

<h2>BJTs — Bipolar Junction Transistors</h2>
<p>A BJT has three terminals: <strong>Base</strong>, <strong>Collector</strong>, <strong>Emitter</strong>. A small current into the base controls a larger current between collector and emitter. The ratio of collector current to base current is the current gain β (beta or hFE), typically 50–300.</p>

<table>
  <thead><tr><th>Polarity</th><th>How it turns on</th><th>Current direction</th><th>Common parts</th></tr></thead>
  <tbody>
    <tr><td>NPN</td><td>Positive voltage at Base (relative to Emitter)</td><td>Collector → Emitter</td><td>2N2222, 2N3904, BC547, TIP31</td></tr>
    <tr><td>PNP</td><td>Base pulled low (relative to Emitter)</td><td>Emitter → Collector</td><td>2N2907, 2N3906, BC557, TIP32</td></tr>
  </tbody>
</table>

<h3>BJT Operating Regions</h3>

<table>
  <thead><tr><th>Region</th><th>Condition</th><th>Behaviour</th><th>Use</th></tr></thead>
  <tbody>
    <tr><td>Cutoff</td><td>Vbe &lt; 0.6V, no base current</td><td>Transistor fully off — acts like open circuit</td><td>Switch in OFF state</td></tr>
    <tr><td>Active (linear)</td><td>Vbe ≈ 0.7V, base current controlled</td><td>Ic = β × Ib — linear amplification</td><td>Amplifier stages</td></tr>
    <tr><td>Saturation</td><td>Vbe &gt; 0.7V, base driven hard</td><td>Vce ≈ 0.2V, transistor fully on</td><td>Switch in ON state</td></tr>
  </tbody>
</table>

<h3>NPN as a Switch</h3>
<pre>
         VCC
          |
         [Load]  ← motor, relay, LED string, etc.
          |
       Collector
NPN:   Base ←── [R_base] ←── Control signal (microcontroller GPIO, etc.)
       Emitter
          |
         GND

To turn ON:  drive Base HIGH → transistor saturates → current flows through load
To turn OFF: drive Base LOW  → transistor cuts off → load disconnected
</pre>
<p>Calculating the base resistor — you need enough base current to guarantee saturation. A good rule is 10× the minimum required:</p>
<pre>
Example: switching 100mA load, β = 100
Minimum Ib = Ic / β = 100mA / 100 = 1mA
Target Ib = 10mA (overdrive for reliable saturation)

Control voltage = 5V, Vbe = 0.7V
R_base = (5V - 0.7V) / 10mA = 430Ω → use 470Ω or 560Ω
</pre>

<h2>MOSFETs — Metal-Oxide-Semiconductor FETs</h2>
<p>MOSFETs have <strong>Gate</strong>, <strong>Drain</strong>, <strong>Source</strong> terminals. They're voltage-controlled — a voltage on the Gate controls current between Drain and Source with essentially zero gate current. This makes them more efficient as switches than BJTs.</p>

<table>
  <thead><tr><th>Type</th><th>Turns on when</th><th>Use case</th><th>Common parts</th></tr></thead>
  <tbody>
    <tr><td>N-channel enhancement</td><td>Vgs &gt; Vth (gate above source)</td><td>Low-side switching (load between VCC and drain)</td><td>2N7000, IRF540N, IRLZ44N</td></tr>
    <tr><td>P-channel enhancement</td><td>Vgs &lt; Vth (gate below source)</td><td>High-side switching (load between drain and GND)</td><td>IRF9540N, SI2307</td></tr>
  </tbody>
</table>

<h3>N-Channel MOSFET as a Switch</h3>
<pre>
        VCC
         |
        [Load]
         |
        Drain
MOSFET: Gate ←── Control signal (must be above Vth relative to Source)
        Source
         |
        GND
</pre>
<p>For logic-level control from a 3.3V or 5V microcontroller, use a <strong>logic-level MOSFET</strong> with Vth below 2V. Standard power MOSFETs often need 8–10V on the gate to fully turn on — they won't work reliably from a GPIO pin.</p>

<h2>BJT vs MOSFET — Comparison</h2>

<table>
  <thead><tr><th>Property</th><th>BJT</th><th>MOSFET</th></tr></thead>
  <tbody>
    <tr><td>Control type</td><td>Current (base current required)</td><td>Voltage (no gate current in DC steady state)</td></tr>
    <tr><td>Input impedance</td><td>Low (base-emitter junction ~0.7V drop)</td><td>Very high (gate is insulated)</td></tr>
    <tr><td>On-resistance</td><td>Vce_sat ≈ 0.2V (moderate loss)</td><td>RDS_on can be milliohms (very low loss)</td></tr>
    <tr><td>Switching speed</td><td>Slower (charge storage in base)</td><td>Faster, especially at high frequencies</td></tr>
    <tr><td>Parallel operation</td><td>Difficult (thermal runaway risk)</td><td>Easy (positive temperature coefficient for RDS_on)</td></tr>
    <tr><td>Best for</td><td>Linear amplifiers, audio, precision analog</td><td>Power switching, motor control, digital logic</td></tr>
    <tr><td>Drive complexity</td><td>Simple — just enough base current</td><td>Gate capacitance matters at high frequency; needs gate driver for fast switching</td></tr>
  </tbody>
</table>

<h2>Common Part Numbers and Specs</h2>

<table>
  <thead><tr><th>Part</th><th>Type</th><th>Ic / Id max</th><th>Vce / Vds max</th><th>Notes</th></tr></thead>
  <tbody>
    <tr><td>2N3904</td><td>NPN BJT</td><td>200 mA</td><td>40 V</td><td>Classic small-signal NPN. Everywhere.</td></tr>
    <tr><td>2N3906</td><td>PNP BJT</td><td>200 mA</td><td>40 V</td><td>Complement to 2N3904</td></tr>
    <tr><td>2N2222A</td><td>NPN BJT</td><td>600 mA</td><td>40 V</td><td>Slightly higher current than 2N3904</td></tr>
    <tr><td>TIP31C</td><td>NPN BJT</td><td>3 A</td><td>100 V</td><td>Power transistor, TO-220 package</td></tr>
    <tr><td>2N7000</td><td>N-ch MOSFET</td><td>200 mA</td><td>60 V</td><td>Small signal, logic-level gate</td></tr>
    <tr><td>IRLZ44N</td><td>N-ch MOSFET</td><td>47 A</td><td>55 V</td><td>Logic-level, low RDS_on — good for 5V Arduino projects</td></tr>
    <tr><td>IRF540N</td><td>N-ch MOSFET</td><td>33 A</td><td>100 V</td><td>Power switching, requires 10V+ gate drive</td></tr>
  </tbody>
</table>

<h2>Darlington Pairs</h2>
<p>Two BJTs cascaded so the first drives the second — the combined gain is β₁ × β₂, which can reach several thousand. Useful when driving a high-current load from a very small signal (e.g., a microcontroller output driving a large relay):</p>
<pre>
         VCC
          |
         [Load]  (high-current)
          |
       Collector (Q2)
Q2 Emitter ── Q1 Collector
             Q1 Emitter
                |
               GND
Q1 Base ←── small control signal

Combined β ≈ β1 × β2 (e.g., 100 × 100 = 10,000)
</pre>
<p>The ULN2003 and ULN2803 ICs are arrays of 7–8 Darlington drivers in a single package, each capable of 500 mA. The downside: higher saturation voltage (~1.2–1.5V instead of 0.2V), which means more power loss.</p>

<h2>Safe Operating Area and Heat</h2>
<p>Both BJTs and MOSFETs have a Safe Operating Area (SOA) — a region of voltage and current they can handle simultaneously without damage. At high current AND high voltage, even a brief spike can destroy the transistor. For power applications:</p>
<ul>
  <li>Attach a heatsink when the case temperature will rise more than 20–30°C above ambient</li>
  <li>Use thermal paste between the transistor and heatsink</li>
  <li>Add a flyback diode across any inductive load (relay, motor) to suppress voltage spikes when switching off</li>
</ul>

<h2>References</h2>
<ul>
  <li>Horowitz &amp; Hill — <em>The Art of Electronics</em>, 3rd ed. Chapter 2</li>
  <li>Sedra &amp; Smith — <em>Microelectronic Circuits</em></li>
  <li><a href="https://www.electronics-tutorials.ws/transistor/tran_1.html" target="_blank" rel="noopener">Electronics-Tutorials — BJT ↗</a></li>
  <li><a href="https://www.electronics-tutorials.ws/transistor/tran_6.html" target="_blank" rel="noopener">Electronics-Tutorials — MOSFET ↗</a></li>
</ul>
