<!--date=20250212 -->


<h1>Oscillators</h1>
<p>An oscillator generates a periodic signal with no external input — it's a self-sustaining feedback loop. The same feedback that makes amplifiers unstable becomes useful when controlled deliberately. Clock signals, audio tones, RF carriers, PWM timing references — they all originate from oscillators. Choosing the right type is mostly about frequency stability requirements and how much circuitry you want to build.</p>

<h2>The Barkhausen Criterion</h2>
<p>An oscillator requires two conditions to be met simultaneously at the oscillation frequency:</p>
<pre>
1. Loop gain ≥ 1    (enough gain to sustain oscillation)
2. Loop phase = 0° (or 360°) exactly  (signal reinforces itself)

At exactly one frequency, both conditions are met → the circuit oscillates at that frequency.
In practice, loop gain starts slightly above 1 and a non-linearity (saturation, AGC) limits amplitude.
</pre>

<h2>Oscillator Types Overview</h2>

<table>
  <thead><tr><th>Type</th><th>Frequency range</th><th>Stability</th><th>Output waveform</th><th>Complexity</th></tr></thead>
  <tbody>
    <tr><td>555 (relaxation)</td><td>1 Hz – 1 MHz</td><td>Poor (±5–20%)</td><td>Square</td><td>Minimal — 2 resistors, 1 cap</td></tr>
    <tr><td>RC phase-shift</td><td>1 Hz – 100 kHz</td><td>Moderate</td><td>Sine</td><td>One op-amp, 3 RC sections</td></tr>
    <tr><td>Wien bridge</td><td>1 Hz – 1 MHz</td><td>Good (with AGC)</td><td>Sine (low distortion)</td><td>Op-amp + AGC circuit</td></tr>
    <tr><td>Colpitts (LC)</td><td>100 kHz – 500 MHz</td><td>Good</td><td>Sine</td><td>Transistor + LC tank + biasing</td></tr>
    <tr><td>Hartley (LC)</td><td>100 kHz – 30 MHz</td><td>Good</td><td>Sine</td><td>Transistor + tapped inductor</td></tr>
    <tr><td>Crystal</td><td>1 kHz – 300 MHz</td><td>Excellent (±20–1 ppm)</td><td>Sine/Square</td><td>Crystal + 2 caps + inverter</td></tr>
    <tr><td>TCXO</td><td>Various</td><td>Very high (±0.5 ppm)</td><td>Sine/Square</td><td>Packaged module</td></tr>
    <tr><td>OCXO</td><td>Various</td><td>Exceptional (±0.01 ppm)</td><td>Sine/Square</td><td>Packaged module with oven</td></tr>
    <tr><td>VCO</td><td>Wide range</td><td>Moderate (tuning-dependent)</td><td>Sine or Square</td><td>Varactor diode + LC or RC</td></tr>
  </tbody>
</table>

<h2>RC Oscillators</h2>

<h3>Phase Shift Oscillator</h3>
<p>Three RC stages each contributing 60° of phase shift at the oscillation frequency, plus 180° from an inverting amplifier. Total phase around the loop: 360°:</p>
<pre>
        R     R     R
Vout ──[  ]──[  ]──[  ]──┬── inverting amp input
        C     C     C    │
        │     │     │    │
       GND   GND   GND   │
                         └── Vout (feedback)

f = 1 / (2πRC√6)

Example: R=10kΩ, C=10nF
f = 1 / (2π × 10,000 × 0.00000001 × 2.449) ≈ 649 Hz

Minimum amplifier gain for oscillation: 29 (28 dB)
</pre>

<h3>Wien Bridge Oscillator</h3>
<p>Non-inverting amplifier with Wien network in feedback. Produces a low-distortion sine wave — used in audio test oscillators and function generators:</p>
<pre>
        Series RC        Parallel RC
Vin ──[R]──||──── (+)     Frequency-setting network
            [R]||[C]      to non-inverting input
              └── GND

f = 1 / (2πRC)

For unity phase at f: the Wien network has voltage ratio = 1/3
Amplifier gain must be exactly 3 for oscillation (R_f = 2×R_g)

AGC (automatic gain control) holds gain at 3:
  Classic: small incandescent lamp in gain network (resistance rises with heat)
  Modern: FET-based or dedicated IC amplitude control
</pre>

<h2>LC Oscillators</h2>
<p>An inductor-capacitor tank circuit oscillates at f₀ = 1/(2π√LC). The transistor amplifier compensates for the resistance (energy loss) to sustain the oscillation indefinitely:</p>

<h3>Colpitts Oscillator</h3>
<pre>
         VCC
          │
         [RC]  ← collector resistor
          │
    ┌── Collector
    │     Base ── [C_b] ── GND   (bypass)
    │     Emitter
    │         │
    │        [RE]
    │         │
    │        GND
    │
    │    [L]
    └────────────┬── Junction of C1 and C2
              [C1]      (feedback taken here)
                │
              [C2]
                │
               GND

Frequency: f₀ = 1 / (2π√(L × C_total))
C_total = C1 × C2 / (C1 + C2)  (series)

Feedback ratio: C1/C2 (determines loop gain)
Typical: C2 = 2–10× C1
</pre>
<p>The Colpitts is the workhorse for RF oscillators — stable, predictable, easily variable with a trimmer capacitor or varactor diode.</p>

<h2>Crystal Oscillators</h2>
<p>A quartz crystal resonates at a frequency determined by its physical dimensions. The Q factor is 10,000–100,000 (compared to 100–200 for a good LC tank), making the frequency extremely stable:</p>
<pre>
Simple Pierce crystal oscillator (common in MCU circuits):
         VCC
          │
         [R] ← (often internal to inverter)
          │
    ┌── Inverter input
    │           output ──┬── Vout
    │                    │
    │     [Crystal]      [C2] (15–22pF)
    └─────────────┤       │
                  │      GND
                [C1] (15–22pF)
                  │
                 GND

Load capacitance = (C1 × C2)/(C1 + C2) + stray
Crystal frequency is trimmed to be correct with the specified load capacitance.
</pre>

<table>
  <thead><tr><th>Frequency</th><th>Use</th><th>Notes</th></tr></thead>
  <tbody>
    <tr><td>32.768 kHz</td><td>Real-time clocks</td><td>2^15 = 32768 — 15 binary divisions = 1Hz exactly</td></tr>
    <tr><td>4 MHz</td><td>Microcontrollers</td><td>Classic PIC/AVR clock, often doubled internally</td></tr>
    <tr><td>8 MHz</td><td>Microcontrollers</td><td>ATmega328 (Arduino) external crystal option</td></tr>
    <tr><td>16 MHz</td><td>Microcontrollers</td><td>Standard Arduino clock frequency</td></tr>
    <tr><td>20 MHz</td><td>Microcontrollers</td><td>STM32 common HSE clock</td></tr>
    <tr><td>25 MHz</td><td>Ethernet PHY, AD9833</td><td>Standard reference for many network ICs</td></tr>
    <tr><td>10 MHz</td><td>Frequency standard</td><td>GPSDO / OCXO reference output standard</td></tr>
  </tbody>
</table>

<h2>Relaxation Oscillators — 555 Timer</h2>
<pre>
Astable 555 circuit:
        VCC
         │
        [RA]
         │
         ●── PIN 7 (discharge)
        [RB]
         │
         ●── PIN 2/6 (threshold/trigger)
        [C]
         │
        GND

f = 1.44 / ((RA + 2×RB) × C)
Duty cycle = (RA + RB) / (RA + 2×RB)

For 50% duty: use RA very small (100Ω) + steering diodes around RB
Or: use a CMOS 555 (TLC555) with equal charge/discharge paths
</pre>

<table>
  <thead><tr><th>RA</th><th>RB</th><th>C</th><th>Frequency</th><th>Application</th></tr></thead>
  <tbody>
    <tr><td>1kΩ</td><td>1kΩ</td><td>100nF</td><td>4.8 kHz</td><td>Audible tone, buzzer</td></tr>
    <tr><td>10kΩ</td><td>10kΩ</td><td>100nF</td><td>480 Hz</td><td>Mid-range audio tone</td></tr>
    <tr><td>100kΩ</td><td>100kΩ</td><td>10µF</td><td>0.48 Hz</td><td>LED blinker (~1s period)</td></tr>
    <tr><td>1kΩ</td><td>10kΩ</td><td>10nF</td><td>6.6 kHz</td><td>Motor drive PWM</td></tr>
  </tbody>
</table>

<h2>VCO — Voltage-Controlled Oscillator</h2>
<p>A VCO's frequency is controlled by a voltage. Increasing voltage increases (or decreases) frequency depending on the design. The critical component in PLLs (phase-locked loops):</p>
<pre>
Applications of VCO + PLL:
  FM radio demodulation
  Clock synthesis (CPU PLLs multiply a crystal reference)
  Motor speed control
  Frequency modulation (direct FM transmitter)
  Clock recovery from serial data streams

Simple VCO using 555: replace RA or RB with a transistor-based
variable resistance controlled by the input voltage.
Better VCO: CD4046 has a built-in VCO and phase comparators.
</pre>

<h2>References</h2>
<ul>
  <li>Horowitz &amp; Hill — <em>The Art of Electronics</em>, 3rd ed. Chapter 7</li>
  <li>Razavi — <em>Design of Analog CMOS Integrated Circuits</em></li>
  <li><a href="https://www.electronics-tutorials.ws/oscillator/oscillators.html" target="_blank" rel="noopener">Electronics-Tutorials — Oscillator Circuits ↗</a></li>
  <li><a href="https://www.ti.com/lit/an/snla226a/snla226a.pdf" target="_blank" rel="noopener">TI — Oscillator Design Guide (PDF) ↗</a></li>
</ul>
