# PLL Control

# PLL-Based Frequency Control

Phase-Locked Loop (PLL) circuits can automatically track and maintain resonance in VIC systems, compensating for drift due to temperature changes, water level variations, and other factors. This page covers PLL fundamentals and their application to VIC circuits.

## Why PLL Control?

VIC resonant frequency can drift during operation due to:

<table id="bkmrk-factor-effect-on-f%E2%82%80-" style="width: 100%; border-collapse: collapse; margin: 20px 0;"><thead><tr style="background: #dc3545; color: white;"><th style="padding: 10px; border: 1px solid #ddd;">Factor</th><th style="padding: 10px; border: 1px solid #ddd;">Effect on f₀</th><th style="padding: 10px; border: 1px solid #ddd;">Typical Drift</th></tr></thead><tbody><tr><td style="padding: 10px; border: 1px solid #ddd;">Water temperature rise</td><td style="padding: 10px; border: 1px solid #ddd;">f₀ increases (ε<sub>r</sub> drops)</td><td style="padding: 10px; border: 1px solid #ddd;">+0.2%/°C</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Gas bubble formation</td><td style="padding: 10px; border: 1px solid #ddd;">f₀ increases (C drops)</td><td style="padding: 10px; border: 1px solid #ddd;">+2-10%</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Water level change</td><td style="padding: 10px; border: 1px solid #ddd;">f₀ changes (C changes)</td><td style="padding: 10px; border: 1px solid #ddd;">Variable</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Core temperature rise</td><td style="padding: 10px; border: 1px solid #ddd;">f₀ may shift (μ changes)</td><td style="padding: 10px; border: 1px solid #ddd;">±1%</td></tr></tbody></table>

A PLL can continuously adjust the drive frequency to maintain optimal resonance despite these variations.

## PLL Fundamentals

#### Basic PLL Components:

```
Reference ──→ [Phase      ] ──→ [Loop    ] ──→ [VCO     ] ──→ Output
Signal        [Detector   ]     [Filter  ]     [        ]     Frequency
                   ↑                                │
                   └────────────────────────────────┘
                            Feedback
    
```

#### Components Explained:

<div id="bkmrk-phase-detector%3A-comp" style="background: #f8f9fa; padding: 20px; border-radius: 5px; margin: 20px 0;">- **Phase Detector:** Compares phase of two signals, outputs error voltage
- **Loop Filter:** Averages error signal, sets response speed
- **VCO:** Voltage-Controlled Oscillator, frequency varies with input voltage

</div>## PLL for VIC Resonance Tracking

For VIC applications, the PLL tracks the resonant frequency by sensing the phase relationship between drive signal and cell response:

```
           ┌──────────────────────────────────────┐
           │                                      │
Drive ──→ [VIC Circuit] ──→ V<sub>wfc</sub> ──→ [Phase    ] ──→ [Loop   ] ──→ [VCO]
Signal                              [Detector ]     [Filter ]         │
  ↑                                      ↑                           │
  └──────────────────────────────────────┴───────────────────────────┘
                              Feedback Loop
```

### Phase Detection Methods

<table id="bkmrk-method-description-p" style="width: 100%; border-collapse: collapse; margin: 20px 0;"><thead><tr style="background: #007bff; color: white;"><th style="padding: 10px; border: 1px solid #ddd;">Method</th><th style="padding: 10px; border: 1px solid #ddd;">Description</th><th style="padding: 10px; border: 1px solid #ddd;">Pros/Cons</th></tr></thead><tbody><tr><td style="padding: 10px; border: 1px solid #ddd;">XOR Phase Detector</td><td style="padding: 10px; border: 1px solid #ddd;">Digital XOR of drive and response</td><td style="padding: 10px; border: 1px solid #ddd;">Simple, but needs square waves</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Analog Multiplier</td><td style="padding: 10px; border: 1px solid #ddd;">Multiply drive × response</td><td style="padding: 10px; border: 1px solid #ddd;">Works with sinusoids, more complex</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Zero-Crossing Detector</td><td style="padding: 10px; border: 1px solid #ddd;">Compare zero-crossing times</td><td style="padding: 10px; border: 1px solid #ddd;">Digital-friendly, noise sensitive</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">I/Q Demodulation</td><td style="padding: 10px; border: 1px solid #ddd;">Quadrature phase detection</td><td style="padding: 10px; border: 1px solid #ddd;">Most accurate, most complex</td></tr></tbody></table>

## Resonance Tracking Logic

At resonance, the phase relationship between drive current and WFC voltage is 0°:

#### Phase vs. Frequency:

<div class="formula-box" id="bkmrk-f-%3C-f%E2%82%80%3A-v-leads-i-%28c" style="background: #e7f3ff; padding: 20px; border-left: 4px solid #007bff; margin: 20px 0;"><div class="formula-box" style="background: #e7f3ff; padding: 20px; border-left: 4px solid #007bff; margin: 20px 0;">- **f &lt; f₀:** V leads I (capacitive), phase &gt; 0°
- **f = f₀:** V and I in phase, phase = 0°
- **f &gt; f₀:** V lags I (inductive), phase &lt; 0°

</div></div>#### Control Law:

<div class="formula-box" id="bkmrk-if-phase-%3E-0%C2%B0%3A-incre" style="background: #e7f3ff; padding: 20px; border-left: 4px solid #007bff; margin: 20px 0;">- If phase &gt; 0°: Increase frequency (move toward resonance)
- If phase &lt; 0°: Decrease frequency (move toward resonance)
- If phase ≈ 0°: Maintain frequency (at resonance)

</div>## Loop Filter Design

The loop filter determines how quickly the PLL responds to changes:

<table id="bkmrk-parameter-fast-respo" style="width: 100%; border-collapse: collapse; margin: 20px 0;"><thead><tr style="background: #28a745; color: white;"><th style="padding: 10px; border: 1px solid #ddd;">Parameter</th><th style="padding: 10px; border: 1px solid #ddd;">Fast Response</th><th style="padding: 10px; border: 1px solid #ddd;">Slow Response</th></tr></thead><tbody><tr><td style="padding: 10px; border: 1px solid #ddd;">Tracking speed</td><td style="padding: 10px; border: 1px solid #ddd;">Quick adaptation</td><td style="padding: 10px; border: 1px solid #ddd;">Slow adaptation</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Noise rejection</td><td style="padding: 10px; border: 1px solid #ddd;">Poor</td><td style="padding: 10px; border: 1px solid #ddd;">Good</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Stability</td><td style="padding: 10px; border: 1px solid #ddd;">May oscillate</td><td style="padding: 10px; border: 1px solid #ddd;">More stable</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Best for</td><td style="padding: 10px; border: 1px solid #ddd;">Rapid changes</td><td style="padding: 10px; border: 1px solid #ddd;">Gradual drift</td></tr></tbody></table>

**Design Tip:** For VIC applications, a medium-speed loop (bandwidth ~100-500 Hz) usually works well. Fast enough to track bubble-induced changes, slow enough to reject noise.

## VCO Implementation

The VCO generates the variable-frequency drive signal:

#### Common VCO Options:

<div id="bkmrk-555-timer-vco%3A-simpl" style="background: #f8f9fa; padding: 20px; border-radius: 5px; margin: 20px 0;"><div style="background: #f8f9fa; padding: 20px; border-radius: 5px; margin: 20px 0;">- **555 Timer VCO:** Simple, wide frequency range, moderate stability
- **74HC4046 PLL IC:** Integrated PLL with VCO, easy to use
- **DDS (Direct Digital Synthesis):** Precise frequency control, programmable
- **Microcontroller PWM:** Software-adjustable, flexible

</div></div>#### VCO Requirements:

<div id="bkmrk-frequency-range-cove" style="background: #f8f9fa; padding: 20px; border-radius: 5px; margin: 20px 0;">- Frequency range covering expected f₀ ± drift range
- Linear frequency vs. voltage response
- Low noise and jitter
- Fast frequency settling

</div>## Complete PLL-VIC System

```
                    PLL CONTROLLER
     ┌────────────────────────────────────────┐
     │                                        │
     │  [Phase Det] ──→ [Loop Filter] ──→ V<sub>ctrl</sub>
     │       ↑                           │    │
     │       │                           │    │
     └───────┼───────────────────────────┼────┘
             │                           │
             │                           ↓
     V<sub>sense</sub>  │                        [VCO]
       ↑     │                           │
       │     │                           ↓
       │     │                     [Driver Stage]
       │     │                           │
       │     │      ┌────────────────────┘
       │     │      ↓
       │     └── [L1] ──── [C1] ──────────┐
       │                                  │
       │         ┌────────────────────────┘
       │         │
       │         ↓
       └──── [L2] ──── [WFC]
                    ↑
              Resonating
               Circuit
```

## Practical Considerations

#### Startup Sequence:

<div id="bkmrk-initialize-vco-near-" style="background: #d4edda; padding: 20px; border-radius: 5px; margin: 20px 0;"><div style="background: #d4edda; padding: 20px; border-radius: 5px; margin: 20px 0;">1. Initialize VCO near expected f₀
2. Enable PLL with wide bandwidth initially
3. Wait for lock indication
4. Reduce bandwidth for stable operation

</div></div>#### Lock Detection:

Monitor loop filter output—stable voltage indicates lock. Large variations indicate searching or loss of lock.

#### Capture Range:

PLL can only lock if initial frequency is within "capture range." If f₀ drifts too far, may need frequency sweep to re-acquire.

## Alternatives to PLL

<table id="bkmrk-method-description-w" style="width: 100%; border-collapse: collapse; margin: 20px 0;"><thead><tr style="background: #17a2b8; color: white;"><th style="padding: 10px; border: 1px solid #ddd;">Method</th><th style="padding: 10px; border: 1px solid #ddd;">Description</th><th style="padding: 10px; border: 1px solid #ddd;">When to Use</th></tr></thead><tbody><tr><td style="padding: 10px; border: 1px solid #ddd;">Fixed Frequency</td><td style="padding: 10px; border: 1px solid #ddd;">No tracking, fixed drive</td><td style="padding: 10px; border: 1px solid #ddd;">Stable systems, low Q</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Frequency Sweep</td><td style="padding: 10px; border: 1px solid #ddd;">Periodically sweep through range</td><td style="padding: 10px; border: 1px solid #ddd;">Testing, characterization</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Peak Detector</td><td style="padding: 10px; border: 1px solid #ddd;">Track amplitude maximum</td><td style="padding: 10px; border: 1px solid #ddd;">Simpler than phase tracking</td></tr><tr><td style="padding: 10px; border: 1px solid #ddd;">Self-Oscillation</td><td style="padding: 10px; border: 1px solid #ddd;">Circuit sets own frequency</td><td style="padding: 10px; border: 1px solid #ddd;">Simple, but less control</td></tr></tbody></table>

**VIC Matrix Calculator Note:** The VIC5 PLL module provides calculations for PLL component selection, including VCO tuning range, loop filter values, and expected tracking bandwidth. Use these calculations when implementing automatic resonance tracking.

*Next: Harmonic Analysis →*