<!--order=23-->


<h1>Analog Circuit Design</h1>
<p>Analog design is where the precision work lives. Digital circuits deal in ones and zeros; analog circuits must get a signal to behave exactly right across temperature, supply voltage, component aging, and manufacturing tolerance. The goal is usually to amplify, filter, or measure something to a specified accuracy — and then verify it actually achieves that in the worst case. Small systematic errors compound through gain stages and become large errors at the output.</p>

<h2>Transistor Amplifier Configurations</h2>
<p>Beyond op-amps, discrete transistor stages are still essential for high-frequency work, driving large currents or voltages, or situations needing specific impedance characteristics:</p>

<table>
  <thead><tr><th>Configuration</th><th>Voltage gain</th><th>Input impedance</th><th>Output impedance</th><th>Phase shift</th><th>Primary use</th></tr></thead>
  <tbody>
    <tr><td>Common Emitter (BJT)</td><td>High (−RC/RE)</td><td>Moderate (β×RE)</td><td>Moderate (RC)</td><td>180° (inverting)</td><td>Voltage amplification, general purpose</td></tr>
    <tr><td>Common Collector (Emitter Follower)</td><td>~1</td><td>High (β×RE)</td><td>Low (RE/β)</td><td>0° (non-inverting)</td><td>Impedance buffer, current driving</td></tr>
    <tr><td>Common Base (BJT)</td><td>High (RC/RE)</td><td>Very low (~26mV/Ic)</td><td>High</td><td>0° (non-inverting)</td><td>RF amplifiers, current buffer</td></tr>
    <tr><td>Common Source (FET)</td><td>High (−gm×RD)</td><td>Very high (GΩ)</td><td>Moderate (RD)</td><td>180° (inverting)</td><td>FET voltage amplification</td></tr>
    <tr><td>Common Drain (Source Follower)</td><td>~1</td><td>Very high</td><td>Low (1/gm)</td><td>0°</td><td>Impedance buffer with FET input</td></tr>
  </tbody>
</table>

<h3>Common Emitter with Emitter Degeneration</h3>
<pre>
         VCC
          │
         [RC] ← collector resistor sets gain
          │
          C──── Vout
          │
     B────┤ NPN
          │
          E
          │
         [RE] ← emitter degeneration resistor
          │
         GND

Voltage gain Av ≈ −RC / RE   (with degeneration, approximate)
Input impedance ≈ β × RE     (at low frequencies)
Quiescent collector current: Ic ≈ (VCC × R2/(R1+R2) − 0.7V) / RE
</pre>
<p>The emitter resistor RE provides local negative feedback that stabilises the operating point against β variation and temperature drift. Without it (bypassed with a capacitor), Av = −gm×RC = −RC×Ic/26mV — much higher gain but very sensitive to temperature and transistor β.</p>

<h2>Instrumentation Amplifiers</h2>
<p>When amplifying small differential signals in the presence of large common-mode noise — thermocouple outputs, Wheatstone bridge measurements, biosignals — an instrumentation amplifier is the correct tool. A simple difference amplifier has limited CMRR because resistor mismatch degrades rejection; the INA topology uses three op-amps with laser-trimmed resistors to achieve very high CMRR:</p>
<pre>
Three-op-amp INA:

V1 ──(+)─U1─────┐
          (−)──┤RG├── gain-setting resistor (user-selectable)
V2 ──(+)─U2─────┘
          outputs feed a difference amplifier U3

Gain = 1 + 2R/RG   (R is internal, RG is external)

INA128 with RG=10kΩ: Gain = 1 + 100k/10k = 11
INA128 with RG=1kΩ:  Gain = 1 + 100k/1k = 101

CMRR: 80–120dB (rejects common-mode, amplifies only difference)
</pre>

<table>
  <thead><tr><th>Part</th><th>Gain range</th><th>Vin (cm) range</th><th>Vos (max)</th><th>CMRR (min)</th><th>Notes</th></tr></thead>
  <tbody>
    <tr><td>INA128 / INA129</td><td>1–10,000</td><td>±10V</td><td>25 µV</td><td>90 dB</td><td>Classic precision INA. ±15V supply.</td></tr>
    <tr><td>INA333</td><td>1–1,000</td><td>−0.1 to VCC+0.1V</td><td>25 µV</td><td>100 dB</td><td>Single supply, low power — good for battery applications</td></tr>
    <tr><td>AD8221</td><td>1–1,000</td><td>−Vs+2.1V to +Vs−1.1V</td><td>25 µV</td><td>80 dB</td><td>Low noise, rail-to-rail output. High-performance medical/industrial.</td></tr>
    <tr><td>INA826</td><td>1–1,000</td><td>−0.1 to VCC+0.1V</td><td>100 µV</td><td>80 dB</td><td>Tiny, cheap. Good for data acquisition.</td></tr>
  </tbody>
</table>

<h2>Noise in Analog Circuits</h2>
<p>Every resistor and active component adds noise. Understanding noise sources lets you design for a required signal-to-noise ratio:</p>

<table>
  <thead><tr><th>Noise type</th><th>Source</th><th>Formula</th><th>Spectrum</th></tr></thead>
  <tbody>
    <tr><td>Thermal (Johnson) noise</td><td>Any resistance</td><td>V_n = √(4kTRB)</td><td>White (flat)</td></tr>
    <tr><td>Shot noise</td><td>DC current through junction</td><td>I_n = √(2qI_DC×B)</td><td>White</td></tr>
    <tr><td>Flicker (1/f) noise</td><td>Semiconductor surfaces, contacts</td><td>Increases as 1/f</td><td>Pink (rises at low freq)</td></tr>
    <tr><td>Popcorn (burst) noise</td><td>Defects in ICs</td><td>Random step changes</td><td>Irregular</td></tr>
  </tbody>
</table>

<pre>
Thermal noise example: R=10kΩ, T=300K, B=20kHz (audio bandwidth)
V_n = √(4 × 1.38×10⁻²³ × 300 × 10,000 × 20,000)
V_n = √(3.31×10⁻¹²) ≈ 1.82 µV RMS

Op-amp noise: input-referred voltage noise density en (nV/√Hz)
Total input noise in bandwidth B:
  V_noise = en × √B

TL071: en = 18 nV/√Hz → in 20kHz audio BW: V_noise = 18 × √20000 = 2.55 µV
NE5532: en = 5 nV/√Hz → V_noise = 5 × √20000 = 0.71 µV
</pre>

<h3>Noise Budget Strategy</h3>
<pre>
Total system SNR requirement → input-referred noise budget → op-amp selection

Example: 12-bit ADC, 3.3V reference, required SNR = 72dB (12-bit ideal)
LSB = 3.3V / 4096 ≈ 806 µV
Required noise < LSB/2 ≈ 400 µV RMS at the ADC input

With gain of 10 before the ADC:
Required input-referred noise < 40 µV RMS

Available bandwidth = 1kHz:
Required en < 40µV / √1000 Hz ≈ 1.26 µV/√Hz = 1260 nV/√Hz
Any op-amp with en << 1260 nV/√Hz is adequate → even LM358 (en ≈ 40nV/√Hz) is fine here
</pre>

<h2>Transimpedance Amplifier (TIA)</h2>
<p>Converts current to voltage. Essential for photodiode circuits, current-mode sensors, and output of charge-based sensors like accelerometers:</p>
<pre>
         Rf (1MΩ for high sensitivity)
    ┌───[    ]───┐
    │            │
PD ─┤(−)  (+)──GND──── Vout = I_diode × Rf
    └────────────┘ (op-amp)

Bandwidth: f_-3dB ≈ 1/(2π × Rf × Cf)   (Cf in parallel with Rf to prevent oscillation)
Stability: Cf ≥ √(Cd / (2π × Rf × GBW))  (Cd = photodiode capacitance)

Example: Rf=1MΩ, Cd=20pF, GBW=10MHz (op-amp):
Cf ≥ √(20×10⁻¹² / (2π×10⁶×10⁷)) ≈ 0.56pF → use 1pF
f_-3dB ≈ 1/(2π×10⁶×10⁻¹²) ≈ 160kHz
</pre>

<h2>ADC Input Conditioning</h2>
<p>A complete ADC input chain must address multiple issues:</p>

<table>
  <thead><tr><th>Problem</th><th>Solution</th></tr></thead>
  <tbody>
    <tr><td>Signal range doesn't match ADC input range</td><td>Scaling amplifier — gain or attenuation to fill 0 to Vref</td></tr>
    <tr><td>Signal has DC offset</td><td>Differential input or subtraction of offset before scaling</td></tr>
    <tr><td>Frequencies above Nyquist present</td><td>Anti-aliasing low-pass filter before ADC</td></tr>
    <tr><td>Source impedance too high</td><td>Voltage follower or low-impedance buffer before filter</td></tr>
    <tr><td>Impedance mismatch causes RC error</td><td>Source impedance must be ≪ ADC sample-and-hold input impedance</td></tr>
    <tr><td>Ground loops / common-mode interference</td><td>Differential sensing + instrumentation amplifier</td></tr>
  </tbody>
</table>

<h2>PCB Layout for Analog</h2>
<p>Analog circuits are much more sensitive to layout than digital. These rules matter:</p>

<table>
  <thead><tr><th>Rule</th><th>Reasoning</th></tr></thead>
  <tbody>
    <tr><td>Solid ground plane on one layer</td><td>Low-impedance return path; reduces ground bounce and electromagnetic pickup</td></tr>
    <tr><td>Decoupling caps within 2mm of each IC VCC pin</td><td>Inductance in series with a cap renders it ineffective at high frequencies</td></tr>
    <tr><td>Keep high-gain signal traces short and direct</td><td>Long traces act as antennas — pick up interference from adjacent signals</td></tr>
    <tr><td>Guard ring around high-impedance nodes</td><td>Driven ground ring around op-amp + input, TIA input prevents leakage from adjacent net biasing the node</td></tr>
    <tr><td>Route digital clock signals away from analog paths</td><td>Switching edges radiate EMI that couples into sensitive nodes</td></tr>
    <tr><td>Separate analog and digital sections of the PCB</td><td>Common return current flows under traces — keep digital return currents from passing through analog section</td></tr>
    <tr><td>Place filter caps at output, not input of amplifier</td><td>Filtering at the output removes noise; filtering at the input sources are already at the op-amp input — mismatch biases can worsen noise</td></tr>
  </tbody>
</table>

<h2>Precision Voltage References</h2>
<p>A good ADC is only as accurate as its reference. Zener-based shunt references and bandgap references are the two families:</p>

<table>
  <thead><tr><th>Part</th><th>Voltage</th><th>Initial accuracy</th><th>Tempco</th><th>Notes</th></tr></thead>
  <tbody>
    <tr><td>LM385-2.5</td><td>2.5V</td><td>±1.5%</td><td>20 ppm/°C</td><td>Micropower shunt reference. Good enough for 8-bit work.</td></tr>
    <tr><td>TL431</td><td>2.5–36V adj.</td><td>±0.5%</td><td>25 ppm/°C</td><td>Programmable with two resistors. Ubiquitous in power supply feedback.</td></tr>
    <tr><td>LM4040-5.0</td><td>5V</td><td>±0.1%</td><td>50 ppm/°C</td><td>Precision shunt. Good for 10-bit ADC reference.</td></tr>
    <tr><td>REF3325</td><td>2.5V</td><td>±0.2%</td><td>10 ppm/°C</td><td>TI series reference. Good 12-bit performance.</td></tr>
    <tr><td>MAX6350</td><td>5V</td><td>±0.02%</td><td>1 ppm/°C</td><td>Precision for 16-bit ADC. Low noise, laser-trimmed.</td></tr>
  </tbody>
</table>

<h2>References</h2>
<ul>
  <li>Horowitz &amp; Hill — <em>The Art of Electronics</em>, 3rd ed. Chapters 3–8</li>
  <li>Motchenbacher &amp; Connelly — <em>Low-Noise Electronic System Design</em></li>
  <li>Franco — <em>Design with Operational Amplifiers</em>, 4th ed.</li>
  <li><a href="https://www.analog.com/en/education/education-library/seminars/linear-circuit-design-handbook.html" target="_blank" rel="noopener">Analog Devices — Linear Circuit Design Handbook ↗</a></li>
  <li><a href="https://www.ti.com/lit/an/sloa011b/sloa011b.pdf" target="_blank" rel="noopener">TI — Op Amp Applications (PDF) ↗</a></li>
</ul>
