Oscillators
An amplifier with positive feedback and a network that picks a frequency. Nothing more than that, and yet from it come a microcontroller’s clock, a transmitter’s carrier and the tone of an electronic instrument. An oscillator is a circuit that is never satisfied.
01The oscillation condition
In an amplifier with negative feedback, the signal that returns is subtracted and the circuit settles. If the signal that returns adds and arrives with enough amplitude, the circuit sustains itself: it no longer needs an input. That is an oscillator.
Two conditions that must be met at the same time and at the same frequency. The phase condition determines at what frequency it oscillates; the magnitude condition, whether it oscillates.
How it starts, if there is no input
It starts from noise. Every circuit has thermal noise, which contains a little of every frequency. The selective network lets through only its own, the amplifier enlarges it, it comes back, it is enlarged again… For that process to take off, |βA| must be greater than 1 at the beginning.
If there is a lot of excess gain, the oscillator starts quickly and reliably, but the amplitude settles by saturation and the output is distorted. If the gain is just enough, the waveform is clean but the oscillator may fail to start when cold, with a low battery or with a different transistor. The elegant solutions are those of automatic amplitude control:
- A small incandescent lamp in the loop: as it heats up its resistance increases and the gain drops. It is the original trick of the Wien oscillator, and it produces an extraordinarily clean sine wave.
- Two antiparallel diodes across the feedback resistor: as the amplitude grows they conduct and lower the gain. It is the cheap solution and the most widely used.
- A FET as a variable resistor driven by an amplitude detector: this is automatic gain control proper.
02LC oscillators: the resonant tank
The heart is a tank circuit: an inductor and a capacitor in parallel exchanging energy. The capacitor stores energy in its electric field and discharges into the inductor, which stores it in its magnetic field and returns it, and so on. If there were no losses, it would go on forever.
| Oscillator | How it divides the feedback | Advantage |
|---|---|---|
| Hartley | Inductor with a tap: two inductances and one capacitor | Easy to tune by varying the capacitor. A classic in receivers. |
| Colpitts | Two capacitors in series and one inductor | More stable at high frequency: the transistor’s parasitic capacitances are absorbed into the divider. |
| Clapp | Colpitts with one more capacitor in series with the inductor | The small capacitor dominates the frequency and isolates the circuit from the transistor’s drift. Very stable. |
| Armstrong | Feedback through a coupled second winding | Historical. Easy to understand, not very practical at high frequency. |
The first three are the same circuit with the divider built in different ways. The mnemonic that works: in Hartley the inductor is split, in Colpitts the capacitor is split. In an unfamiliar schematic, look at which of the two elements has three connections instead of two.
An oscillator at 7.1 MHz is wanted, with a 4.7 µH inductor. What capacitor is needed?
- From f = 1/(2π√(LC)) → C = 1/(4π²f²L)
- 4π² = 39.48; f² = (7.1×106)² = 5.04×1013
- C = 1 / (39.48 × 5.04×1013 × 4.7×10−6) = 106.8 pF
Choose a fixed 82 pF capacitor with a 5 to 50 pF trimmer in parallel, and use the trimmer to adjust to the exact frequency. The practical reason: the real inductance of a homemade coil is never the calculated one.
03RC oscillators
Below about 100 kHz an inductor would be huge and of poor quality. There, RC networks are used, which in exchange for giving up some selectivity are cheap, small and highly repeatable. This is the family of audio generators.
A series RC network and a parallel one form a divider that at a single frequency has zero phase shift and attenuates by exactly one third.
Since the network attenuates by a factor of 3, the amplifier must have a gain of exactly 3: with a non-inverting op amp, Rf = 2·Rg. With R = 10 kΩ and C = 10 nF the result is 1592 Hz. It is the audio oscillator with the best waveform.
Three RC sections, each contributing 60°, add up to the 180° that an inverting amplifier needs to close the loop in phase.
The network attenuates by a factor of 29, so the gain must be 29 or more. With R = 10 kΩ and C = 10 nF it gives 650 Hz. It can be built with a single transistor, which is why it appears often in simple circuits.
Relaxation oscillators
There is no sine wave and no resonance: a capacitor charges up to a threshold, discharges and starts over. The output is square or triangular and the frequency depends on an RC and two thresholds. This is what the 555 does, as does a Schmitt trigger with RC feedback (40106) or an op amp in an astable configuration.
A relaxation oscillator is simple and flexible, but its frequency depends directly on R, on C and on the threshold voltages, which drift with temperature and supply voltage. Typical stability: 1 %. An LC tank reaches 0.1 % and a crystal 0.001 %. For a timer or a sequencer it is more than enough; for a timebase or a carrier, it is not.
04The crystal oscillator
A quartz crystal is piezoelectric: when it is deformed, a voltage appears across its faces, and when a voltage is applied it deforms. Cut to a certain thickness, it vibrates mechanically at a natural frequency with a precision that no LC circuit can match.
It is modeled as a series RLC (the mechanical resonance) in parallel with the capacitance of its electrodes. The numbers are extraordinary: an equivalent L of henries, a C of femtofarads and a Q of 10,000 to 100,000, versus the 100 or 300 of an inductor.
That extremely high Q is the physical reason for its stability: the loop can only close in an extremely narrow band of frequencies.
- 32,768 Hz (215) in clocks: fifteen divisions and you get 1 Hz.
- 4, 8, 16, 20 MHz in microcontrollers.
- Pierce is the usual configuration: the crystal, two capacitors to ground and the inverter that is already built into the microcontroller.
- The load capacitors (typically 22 pF) are not optional: the crystal is specified to work with a certain capacitance, and if it is missing, the frequency shifts.
| Type | Stability | Error at 10 MHz | Where it is used |
|---|---|---|---|
| RC / relaxation | 1 % | 100 kHz | Timers, blinkers, simple PWM |
| LC | 0.1 % | 10 kHz | Radio local oscillators, tuned RF |
| Standard crystal | 10 to 50 ppm | 100 to 500 Hz | Microcontrollers, clocks, serial communications |
| TCXO (temperature-compensated) | 0.5 to 2 ppm | 5 to 20 Hz | Instruments, GPS, commercial radios |
| OCXO (oven-controlled) | 0.001 to 0.01 ppm | 0.01 to 0.1 Hz | Laboratory standards, base stations |
One part per million is one second every eleven and a half days. A wristwatch with a 20 ppm crystal gains or loses about 52 seconds per month, and that is exactly what is observed. When a piece of equipment demands more precision than that, a standard crystal is no longer enough: you need temperature compensation or external synchronization.
05What is asked of an oscillator
That the frequency not change with temperature, supply voltage, aging or load. The typical enemy is load pulling: connecting something to the output shifts the frequency. It is solved with a buffer stage.
That the output be the desired frequency and nothing else. Harmonics appear from saturation of the amplifier; phase noise, from the transistor’s noise. In a transmitter, harmonics are radiated and interfere with other bands.
That it always oscillates, with any individual transistor, at −10 °C and with the battery about to run out. That is the reason excess gain is left in and the amplitude is controlled by other means.
In a microcontroller all of this appears under another name: clock jitter. A clock with jitter doesn’t ruin a blinking LED, but it does ruin fast serial communication or a high-resolution A/D conversion, because the sampling instant shifts.
06In the lab
Build the Wien oscillator with a TL081, R = 10 kΩ and C = 10 nF. With Rf/Rg adjustable by a trimmer, look for the point where it starts. Observe on the oscilloscope: just above the threshold the waveform is clean; raising it further, it flattens at the peaks. Measure the frequency and compare it with 1592 Hz. Then add two 1N4148 diodes in antiparallel across Rf and check that the waveform stays clean even with excess gain.
Build a Colpitts with a 2N2222, L = 100 µH and two 470 pF capacitors. Calculate the expected frequency (series C = 235 pF → f = 1.04 MHz) and measure it. Then bring your hand close to the inductor: the frequency shifts. It is the direct demonstration of why RF oscillators are shielded.
Using the frequency counter, measure every minute for fifteen minutes the frequency of three oscillators: a 555, the Colpitts from before and the crystal oscillator of a microcontroller board. Calculate the relative variation of each. Then gently warm each circuit with a hair dryer and repeat. The resulting table is section 4 verified on the bench.
With a 100 µH inductor and a 100 nF capacitor in parallel, excite the tank with a short pulse from the generator through a large resistor and observe the damped oscillation on the oscilloscope. Measure its frequency (about 50 kHz) and count how many cycles it takes to fall to half: from that you get an estimate of the Q of the assembly.
07Common mistakes
| Symptom | Usual cause |
|---|---|
| It doesn’t oscillate | Insufficient gain, or the feedback arrives in antiphase: reverse the winding direction of the inductor or the phase of the network. |
| It oscillates but the waveform is clipped | Excessive gain with no amplitude control. Add diodes, a lamp or AGC. |
| The frequency shifts when the load is connected | Load pulling. A buffer stage is missing between the oscillator and what follows. |
| It starts sometimes and sometimes not | Gain right at the limit, or poorly chosen crystal load capacitors. |
| The crystal oscillates at a frequency other than the marked one | It is running on an overtone, or the load capacitors do not match the specification. |
| Two frequencies appear mixed together | Parasitic oscillation elsewhere in the circuit, typically due to the wiring or a lack of supply decoupling. |
| The frequency drifts as the equipment warms up | Components with a high temperature coefficient. Use NP0/C0G capacitors in the tank, not ordinary ceramics. |
| An audio amplifier whistles on its own | It has turned into an oscillator unintentionally: positive feedback through the shared supply or through input wiring running close to the output. |
08Self-assessment
State the Barkhausen criterion and say what each condition determines.
|βA| = 1 and total phase 0° (or 360°). The phase condition determines at what frequency it oscillates; the magnitude condition, whether the oscillation is sustained. To start up you need |βA| > 1.
If there is no input signal, where does the first oscillation come from?
From the circuit’s own noise, which contains all frequencies. The selective network lets its own through and the loop amplifies it cycle by cycle until amplitude limiting stabilizes it.
Tank with L = 47 µH and C = 220 pF: what is the frequency?
LC = 47×10−6 × 220×10−12 = 1.034×10−14; √ = 1.017×10−7. f = 1/(2π × 1.017×10−7) = 1.565 MHz.
How do you tell a Hartley from a Colpitts by looking at the schematic?
By where the tap is: in the Hartley the inductor is split (it has three connections); in the Colpitts what is split is the capacitor, which is two in series.
Why does the Wien oscillator need a gain of exactly 3?
Because at its frequency the RC network attenuates the signal to one third with zero phase. For |βA| = 1 the amplifier must multiply by 3: with a non-inverting stage, Rf = 2·Rg.
Wien with R = 4.7 kΩ and C = 22 nF: what is the frequency?
f = 1/(2πRC) = 1/(6.283 × 4700 × 22×10−9) = 1539 Hz.
Why is a crystal so much more stable than an LC tank?
Because its Q is in the tens of thousands versus a couple of hundred: the window of frequencies in which the loop can close is far narrower. Moreover, quartz is mechanically stable with temperature, much more so than an inductor and a capacitor.
A 20 ppm crystal in a clock: how much does it drift per month?
20×10−6 × 2,592,000 s (30 days) = 52 seconds. It is the typical error of an ordinary digital clock.
What is the difference between a relaxation oscillator and a resonant one?
The resonant one keeps energy oscillating between two elements (L and C) and produces a sine wave of stable frequency. The relaxation one charges and discharges a capacitor between two thresholds: it delivers a square or triangle wave, and is much simpler and much less stable.
An audio amplifier starts whistling on its own. What is happening?
It has turned into an oscillator: some part of the output returns to the input in phase. Typical causes: an input cable running alongside the output one, a poorly distributed common ground or a lack of supply decoupling. It is Barkhausen being satisfied without anyone having asked for it.