<!--order=16-->


<h1>Power Supplies</h1>
<p>A power supply converts AC mains (or battery voltage) into the stable DC that electronics needs. Every circuit has one — whether it's the 5V regulator on an Arduino, a bench supply in a lab, or a multi-rail ATX supply in a PC. Understanding how they work explains why some supplies are heavy and some are tiny, why switching supplies are noisy, and why audio gear often sounds better on a linear supply.</p>

<h2>Linear vs. Switching — Overview</h2>

<table>
  <thead><tr><th>Property</th><th>Linear PSU</th><th>Switching PSU (SMPS)</th></tr></thead>
  <tbody>
    <tr><td>Efficiency</td><td>30–60% (worse with large step-down)</td><td>75–95%</td></tr>
    <tr><td>Size &amp; weight</td><td>Large and heavy (mains transformer)</td><td>Small and light</td></tr>
    <tr><td>Output noise</td><td>Very low (clean DC)</td><td>Higher — switching ripple and EMI</td></tr>
    <tr><td>Regulation speed</td><td>Fast transient response</td><td>Slower (loop bandwidth limited by filter)</td></tr>
    <tr><td>Heat</td><td>Excess voltage burned off as heat</td><td>Minimal — most energy transferred</td></tr>
    <tr><td>Complexity</td><td>Simple</td><td>Complex — controller IC, inductor, feedback loop</td></tr>
    <tr><td>Cost</td><td>Low for low currents, high for high currents</td><td>Higher fixed cost, scales well to high power</td></tr>
    <tr><td>Best use</td><td>Audio, RF, low-noise sensing, lab bench, low current</td><td>Battery charging, motor drives, computer PSUs, anything needing high efficiency</td></tr>
  </tbody>
</table>

<h2>Linear Power Supply — Block by Block</h2>
<pre>
AC in → Transformer → Bridge rectifier → Filter cap → Linear regulator → DC out

1. Transformer: steps 120/240VAC down to 12-18VAC
2. Bridge rectifier: converts AC to pulsating DC
3. Filter capacitor: smooths the ripple to rough DC
4. Linear regulator: removes remaining ripple, holds output constant
</pre>

<h3>Sizing the Filter Capacitor</h3>
<pre>
V_ripple ≈ I_load / (f_ripple × C)

  f_ripple = 2 × mains frequency (120Hz in NA, 100Hz in EU/UK — full-wave)
  I_load = maximum current draw
  C = filter capacitance

Example: I_load = 1A, f = 120Hz, target ripple = 1V
  C = I_load / (f × V_ripple) = 1 / (120 × 1) = 8,333 µF → use 10,000 µF

For 500mA draw and 1V ripple: C ≈ 4,167 µF → use 4,700 µF
</pre>

<h3>Choosing a Transformer</h3>
<pre>
V_transformer_RMS needed:
  V_DC = V_out + V_dropout + V_ripple_peak
  V_peak = V_DC (approximately — cap charges to peak)
  V_transformer = V_peak / 1.414

Example for 12V regulated output, 78xx regulator (2V dropout), 2V ripple margin:
  V_DC_min = 12 + 2 + 2 = 16V
  V_peak needed = 16V
  V_transformer = 16 / 1.414 ≈ 11.3V RMS → use 12V RMS transformer

VA rating = V_transformer × I_load × 1.5 (derating factor)
</pre>

<h2>The 78xx Regulator Family</h2>

<table>
  <thead><tr><th>Part</th><th>Output voltage</th><th>Max current</th><th>Dropout</th><th>Notes</th></tr></thead>
  <tbody>
    <tr><td>7803</td><td>+3.3V (approx)</td><td>1A</td><td>~2V</td><td>Less common — use LDO for 3.3V</td></tr>
    <tr><td>7805</td><td>+5V</td><td>1A</td><td>~2V</td><td>Most common. Powers 5V logic, microcontrollers.</td></tr>
    <tr><td>7809</td><td>+9V</td><td>1A</td><td>~2V</td><td>Less common; 12V with LM317 is more flexible</td></tr>
    <tr><td>7812</td><td>+12V</td><td>1A</td><td>~2V</td><td>Motors, fans, relay coils, op-amp dual rail with 7912</td></tr>
    <tr><td>7815</td><td>+15V</td><td>1A</td><td>~2V</td><td>Op-amp supply, Class AB audio output stages</td></tr>
    <tr><td>7905</td><td>−5V</td><td>1A</td><td>~2V</td><td>Negative rail for dual-supply op-amp circuits</td></tr>
    <tr><td>7912</td><td>−12V</td><td>1A</td><td>~2V</td><td>Most common negative rail</td></tr>
    <tr><td>LM317</td><td>1.25V – 37V (adj.)</td><td>1.5A</td><td>~3V</td><td>Adjustable with two resistors: Vout = 1.25 × (1 + R2/R1)</td></tr>
  </tbody>
</table>

<pre>
Basic 7805 circuit:
                 7805
V_in (7–35V) ──┤ IN  OUT ├── 5V out
                │           │
               100nF       100nF
                │           │
               GND         GND

Power dissipation: P = (V_in − 5V) × I_load
At 12V in, 500mA: P = 7 × 0.5 = 3.5W → needs heatsink
</pre>

<h2>Switching Power Supplies — Topologies</h2>

<table>
  <thead><tr><th>Topology</th><th>V_out vs V_in</th><th>Isolation</th><th>Efficiency</th><th>Typical use</th></tr></thead>
  <tbody>
    <tr><td>Buck (step-down)</td><td>V_out &lt; V_in</td><td>No</td><td>85–95%</td><td>Converting 12V to 5V, 3.3V, 1.8V on PCBs</td></tr>
    <tr><td>Boost (step-up)</td><td>V_out &gt; V_in</td><td>No</td><td>80–92%</td><td>Battery to USB 5V, white LED drivers</td></tr>
    <tr><td>Buck-boost</td><td>V_out can be &lt; or &gt; V_in</td><td>No</td><td>75–90%</td><td>Battery-powered devices where V_bat ranges above and below V_out</td></tr>
    <tr><td>Flyback</td><td>Either</td><td>Yes</td><td>75–85%</td><td>Wall warts, offline power supplies, multi-output supplies</td></tr>
    <tr><td>Forward</td><td>V_out &lt; V_in</td><td>Yes</td><td>80–90%</td><td>Medium-power regulated supplies, telecom</td></tr>
    <tr><td>LLC resonant</td><td>Varies</td><td>Yes</td><td>93–97%</td><td>High-efficiency PC PSUs, EV chargers, server PSUs</td></tr>
  </tbody>
</table>

<h3>Buck Converter Operation</h3>
<pre>
       FET switch     L (inductor)
V_in ──[  SW  ]──────[    ]──────── V_out
                 │              │
              Diode (or        [C]     (smoothing cap)
              sync FET)         │
                 │             GND
                GND

Duty cycle D = V_out / V_in   (ideally)
Switching frequency: 50kHz – 2MHz typical

Inductor value (approximate):
  L = (V_in − V_out) × D / (f_sw × ΔI_L)
  ΔI_L = ripple current, typically 20-40% of I_out

Output voltage ripple:
  ΔV_out = ΔI_L / (8 × f_sw × C_out)
</pre>

<h2>Bench Power Supply Selection</h2>

<table>
  <thead><tr><th>Use case</th><th>Recommendation</th></tr></thead>
  <tbody>
    <tr><td>General electronics lab, hobbyist</td><td>30V / 3A or 5A adjustable, with current limiting — RD6018, Rigol DP832</td></tr>
    <tr><td>Audio / RF sensitive work</td><td>Linear supply — Agilent E3630A or equivalent; avoid switching supplies in the lab</td></tr>
    <tr><td>Battery simulation</td><td>Bipolar supply or programmable supply with source/sink capability</td></tr>
    <tr><td>MCU / embedded work</td><td>3.3V and 5V fixed outputs + one adjustable; USB-PD supply also useful</td></tr>
  </tbody>
</table>

<h2>References</h2>
<ul>
  <li>Erickson &amp; Maksimovic — <em>Fundamentals of Power Electronics</em>, 3rd ed.</li>
  <li>Horowitz &amp; Hill — <em>The Art of Electronics</em>, 3rd ed. Chapter 9</li>
  <li><a href="https://www.ti.com/tool/WEBENCH-POWER-DESIGNER" target="_blank" rel="noopener">Texas Instruments WEBENCH Power Designer (online supply calculator) ↗</a></li>
  <li><a href="https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html" target="_blank" rel="noopener">LTspice — simulate switching supply topologies free ↗</a></li>
</ul>
