Skip to main content

Oscillators

Geoffrey Hunter
mbedded.ninja Author

Overview

This site uses the word oscillator to represent a component with an self-contained oscillating feature that has power, ground, and signal out pins. This site uses the word crystal to represent an component which contains a oscillating element (in the form of a crystal), which requires an external oscillation circuit before it useful.

Designators

A common designator prefix to use for oscillators is YY (e.g. Y1Y1). I do not recommend using the prefix XCXC as this should be reserved for crystal oscillators.

Important Parameters

Phase Noise

Phase noise is a way of describing the stability of the crystal in the frequency domain.

Start-Up Time

Symbol: TSUT_{SU}

The start-up time for most oscillators is within the range 2-20ms. This start-up time can be important in low-power designs when the start/stop time of the crystal results in wasted energy.

MEMS Oscillators

MEMS oscillators are built using small mechanical structures (less than 0.1mm in any dimension) that vibrate at set frequencies when electrostatic forces are applied. This mechanical vibratory part of a MEMS oscillator is called the MEMS resonator. This is etched into a silicon die, and surrounding electronics contain both the driving, measuring, and compensation circuitry.

They use less power than a crystal-based oscillator, making them suitable for battery-powered devices. They are manufactured using standard IC manufacturing processes, so they are also more durable. They typically have better frequency stability over their operating temperature range, with common values being 10ppm at room temperature and 100pm over their entire operating temperature range.

MEMS oscillators do not like ultrasonic cleaning baths. Ultrasonic baths may permanently damage the oscillator or cause long term reliability issue1.

Packaging

MEMS oscillators have been made in packages which are also commonly used for crystal packages, such as the 2012 SMD package.

Some common industry sizes for oscillators include:

  • 1612: 1.6 mm × 1.2 mm
  • 2016: 2.0 mm × 1.6 mm
  • 2520: 2.5 mm × 2.0 mm
  • 3225: 3.2 mm × 2.5 mm
  • 5032: 5.0 mm × 3.2 mm
  • 7050: 7.0 mm × 5.0 mm

Wien Bridge Oscillator

The Wien bridge oscillator is a relatively simple oscillator that can generate reasonably accurate sine waves. It is named after a bridge circuit designed by Max Wien in 1891 for the measurement of impedances. William R. Hewlett (of Hewlett-Packard fame) designed the Wein bridge oscillator using the Wein bridge circuit and the differential amplifier.

+-R1C1C2R2R4R3SINE_OUT
Schematics of a Wien bridge oscillator circuit, drawn in the traditional way with the RC and R networks shown as a bridge.

However the modern way to draw this is to split up the non-inverting and inverting feedback circuits like this:

+-R1C1C2R2R4R3SINE_OUT
The modern way to draw the Wien bridge oscillator circuit, separating the non-inverting and inverting feedback sections.

In my opinion this is a clearer way of drawing the circuit. Wien bridge oscillators are used in audio applications.

The series RC and parallel RC circuits form high-pass and low-pass circuit elements, respectively.

Wien Bridge Equations

Let's first look at the series and parallel RC circuits that provide the positive feedback.

The impedance ZSZ_S of the series RC circuit is:

ZS=R+XC\labeleqn:zs=R+1jωC\begin{align} Z_S &= R + X_C \nonumber \\ \label{eqn:zs} &= R + \frac{1}{j\omega C} \end{align}

The impedance ZPZ_P of the parallel RC circuit is:

ZP=R    XC=R    1jωC=R1jωCR+1jωCRule for impedances in parallel.\labeleqn:zp=RjωRC+1Multiplying top and bottom by jωC\begin{align} Z_P &= R \; || \; X_C \nonumber \\ &= R \; || \; \frac{1}{j\omega C} \nonumber \\ &= \frac{R \frac{1}{j\omega C}}{R + \frac{1}{j\omega C}} && \small \text{Rule for impedances in parallel.} \nonumber \\ \label{eqn:zp} &= \frac{R}{j\omega RC + 1} && \small \text{Multiplying top and bottom by $j\omega C$} \end{align}

We can then write an equation for the voltage at the non-inverting pin of the op-amp in terms of the output voltage, and then describing it as a ratio we can get the gain of the RC network, β\beta (the symbol β\beta used here is consistent with the Barkhausen stability criterion):

vnon-inv=ZPZP+ZSvoutResistor divider rulevnon-invvout=β=ZPZP+ZS=RjωRC+1RjωRC+1+R+1jωCSubs in Eq.\refeqn:zs and Eq.\refeqn:zp=RR+R(jωRC+1)+jωRC+1jωCMultiplying top and bottom by jωRC=jωRCjωRC+jωRC(jωRC+1)+jωRC+1Multiplying top and bottom by jωC=jωRCjωRC+(jωRC)2+jωRC+jωRC+1Expanding brackets=jωRC(jωRC)2+3jωRC+1Collecting terms\labeleqn:beta=jωRC(ωRC)2+3jωRC+1Using the identity j2=1\begin{align} v_{\text{non-inv}} &= \frac{Z_P}{Z_P + Z_S} v_{out} && \tiny\text{Resistor divider rule} \nonumber \\ \frac{v_{\text{non-inv}}}{v_{out}} &= \beta = \frac{Z_P}{Z_P + Z_S} \nonumber \\ &= \frac{ \frac{R}{j\omega RC + 1} }{ \frac{R}{j\omega RC + 1} + R + \frac{1}{j\omega C} } && \tiny\text{Subs in $Eq. \ref{eqn:zs}$ and $Eq. \ref{eqn:zp}$} \nonumber \\ &= \frac{ R }{ R + R(j\omega RC + 1) + \frac{j\omega RC + 1}{j\omega C} } && \tiny\text{Multiplying top and bottom by $j\omega RC$} \nonumber \\ &= \frac{ j\omega RC }{ j\omega RC + j\omega RC(j\omega RC + 1) + j\omega RC + 1 } && \tiny\text{Multiplying top and bottom by $j\omega C$} \nonumber \\ &= \frac{ j\omega RC }{ j\omega RC + (j\omega RC)^2 + j\omega RC + j\omega RC + 1 } && \tiny\text{Expanding brackets} \nonumber \\ &= \frac{ j\omega RC }{ (j\omega RC)^2 + 3j\omega RC + 1 } && \tiny\text{Collecting terms} \nonumber \\ \label{eqn:beta} &= \frac{ j\omega RC }{ -(\omega RC)^2 + 3j\omega RC + 1 } && \tiny\text{Using the identity $j^2 = -1$} \\ \end{align}

Now if we focus on the purely resistive feedback network to the inverting pin of the op-amp, you should recognize this as the standard non-inverting gain configuration, where the gain is:

\labeleqn:opampgainnoninvA=1+R3R4Gain equation for non-inverting op-amp.\begin{align} \label{eqn:op-amp-gain-non-inv} A &= 1 + \frac{R_3}{R_4} && \small \text{Gain equation for non-inverting op-amp.} \\ \end{align}

In steady-state oscillation, the reduction in amplitude of voutv_{out} to vnoninvv_{non-inv} as to be exactly "countered" by the gain provided from vnoninvv_{non-inv} to voutv_{out}. This is also known as the Barkhausen criterion:

βA=1(1+R3R4)(jωRC(ωRC)2+3jωRC+1)=1Subs. in Eq.\refeqn:beta and Eq.\refeqn:opampgainnoninv\begin{align} | \beta A | &= 1 \\ \left(1 + \frac{R_3}{R_4}\right)\left(\frac{ j\omega RC }{ -(\omega RC)^2 + 3j\omega RC + 1 }\right) &= 1 && \small \text{Subs. in $Eq. \ref{eqn:beta}$ and $Eq. \ref{eqn:op-amp-gain-non-inv}$} \end{align}

Now lets aim to separate the real and imaginary terms and write it as an equation which equals 0:

(1+R3R4)jωRC=(ωRC)2+3jωRC+1[(R3R42)ωRC]j+[ω2R2C21]=0\begin{align} \left(1 + \frac{R_3}{R_4}\right) j\omega RC = -(\omega RC)^2 + 3j\omega RC + 1 \nonumber \\ \left[ \left(\frac{R_3}{R_4} - 2\right) \omega RC \right] j + \left[ \omega^2 R^2 C^2 - 1 \right] = 0 \\ \end{align}

For this equation to hold true, both the real and imaginary parts must be equal to 0. If we focus on the real part first we can find ω\omega in terms of RR and CC:

ω2R2C21=0ω=1RCRe-arranging for ω\begin{align} \omega^2 R^2 C^2 - 1 &= 0 \nonumber \\ \omega &= \frac{1}{RC} && \text{Re-arranging for $\omega$} \end{align}

Or in terms of natural frequency rather than angular frequency:

f=12πRC\begin{align} f = \frac{1}{2\pi RC} \end{align}

We can now look at the real part of the equation, which also must be 0. This gives us criterion for the ratio of the resistors R3R_3 and R4R_4:

(R3R42)ωRC=0R3R42=0\labeleqn:r32r4R3=2R4\begin{align} \left(\frac{R_3}{R_4} - 2\right) \omega RC &= 0 \nonumber \\ \frac{R_3}{R_4} - 2 &= 0 \nonumber \\ \label{eqn:r3-2-r4} R_3 &= 2R_4 \\ \end{align}

We can plug this back into the equation for the non-inverting gain of the amplifier so see what gain this results in:

Anon-inv=1+R3R4=1+2R4R4Subs. in Eq.\refeqn:r32r4=3\begin{align} A_{\text{non-inv}} &= 1 + \frac{R_3}{R_4} \nonumber \\ &= 1 + \frac{2R_4}{R_4} && \text{Subs. in $Eq. \ref{eqn:r3-2-r4}$} \nonumber \\ &= 3 \end{align}

Realistic Wien Bridge Oscillator Circuits

There is a problem with the above Wien Bridge oscillator circuits which limits them to the realm of theory only. It all comes back to the requirement that the Wien Bridge oscillator must have a loop gain of exactly 1 to function properly (Barkhausen stability criterion). If the gain is less than this, the oscillator will not start (or will stop if already started). If it is more than 1, the oscillator output will saturate and your sine wave output will start looking more like a square wave. Wien bridge oscillators typically need a non-linear component (a component which has a resistance which changes with applied voltage) to actively limit the loop gain and keep it at 1.

Common methods of actively limiting the gain include using:

  • Incandescent bulb (resistance increases as it heats up)
  • Diodes across in parallel with feedback resistors (resistance decreases as voltage increases)
  • JFETs.

Wien bridge oscillators can also be made from a single supply2.

Diode Limited Example And SPICE Simulation

NOTE: I have just used the calculated capacitance and resistance values, and not picked the nearest realistic E96 value so that it's easier to keep track of where the values come from.

The first thing is to choose an oscillation frequency. Let's choose 1kHz1kHz. We will also choose an arbitrary capacitance of C=10nFC = 10nF. It's good to keep the capacitance somewhat low and use ceramic NP0/C0G type dielectrics, as they will introduce the lowest amount of distortion. This means we need a resistance of:

R=12πfC=12π1kHz10nF=15.9kΩ\begin{align} R &= \frac{1}{2\pi fC} \\ &= \frac{1}{2\pi 1kHz \cdot 10nF} \\ &= 15.9k\Omega \\ \end{align}

Let's use diodes as our non-linear element to make sure the loop gain stays at 1. The trick is to put the diodes in parallel with a portion of the R3R_3 resistance, and make the inverting feedback gain slightly larger than 3 before the diodes begin to conduct.

Ignoring the diodes for a moment, let's aim for a inverting gain of 3.2 and pick an arbitrary value for R4R_4 of 1kΩ1k\Omega.

R4=1kΩ\begin{align} R_4 = 1k\Omega \\ \end{align} A=1+R3R43.2=1+R31kΩR3=2.2kΩ\begin{align} A &= 1 + \frac{R_3}{R_4} \\ 3.2 &= 1 + \frac{R_3}{1k\Omega} \\ R_3 &= 2.2k\Omega \end{align}

Now, we want the oscillations at voutv_{out} to reach a decent proportion of the supply voltage before the diode kicks in. Since we are running of ±12V\pm 12V supplies, lets make the diodes begin to conduct at 5V5V. Let's calculate how much current is flowing through the series leg of R3R_3 and R4R_4 when there is 1V1V at the output:

I=1VR3+R4=1V1kΩ+2.2kΩ=0.312mA\begin{align} I &= \frac{1V}{R_3 + R_4} \\ &= \frac{1V}{1k\Omega + 2.2k\Omega} \\ &= 0.312mA \\ \end{align}

Assuming the diodes begin to conduct at 0.6V0.6V, with 0.312mA0.312mA of current flowing this would be across a resistance of:

R3,diode=0.6V0.312mA=1.92kΩ\begin{align} R_{3,diode} &= \frac{0.6V}{0.312mA} \\ &= 1.92k\Omega \\ \end{align}

So we need to split R3R_3 into two resistors in series, one of 1.92kΩ1.92k\Omega with the diodes across it R3,diodeR_{3,diode} and one of:

R3,nodiode=R3R3,diode=2.2kΩ1.92kΩ=280Ω\begin{align} R_{3, no-diode} &= R_3 - R_{3,diode} \\ &= 2.2k\Omega - 1.92k\Omega \\ &= 280\Omega \\ \end{align}
Wien Bridge oscillator circuit.

We can then simulate the circuit using ngspice (an open-source SPICE-like circuit simulator):

SPICE simulation results for the Wien Bridge oscillator circuit shown above. Note how the circuit takes approx. 350ms to start-up, relying on noise (which SPICE does simulate) for the initial 'kick' to begin oscillating.

You can count 6 cycles in approx. 6ms, which puts the simulated frequency at:

f=66ms=1kHz\begin{align} f &= \frac{6}{6ms} \\ &= 1kHz \end{align}

which agrees well with what we designed for!

You can download the following assets:

JFET Gain-Limited Example

Using a JFET to partially switch in another resistor in parallel with the ground-connected gain resistor R4R_4 in the Wien bridge oscillator circuit is another method for preventing the oscillator for saturating (as opposed to the diode method shown above). This JFET gain-limited approach is meant to introduce less distortion than the diode-limited approach above, as the RC circuit driving the JFET's gate does not change much over a single cycle (assuming a suitable large RC time constant is picked).

Schematics of this technique are shown below, with the circuit setup to oscillate at the same frequency as the diode gain-limited variant mentioned above.

A practical Wien bridge oscillator circuit using a JFET (Q1) as the non-element to actively limit the gain and prevent the oscillator from saturating.

Note the diode and RC circuit controlling the JFET's gate. When the circuit is first powered up, the gate is at ground and hence the gate-source voltage VGS=0VV_{GS} = 0V. Therefore the JFET is almost fully on (remember, JFETs are depletion mode devices), and R5R_5 is in parallel with R4R_4, increasing the gain of the op-amp. As the output voltage beings to oscillate, on the negative part of the cycle, diode D1D_1 will conduct and charge the RC low-pass filter C3C_3 and R6R_6 with a negative voltage. This will decrease VGSV_{GS} below 0V0V, which will begin to turn the JFET off. This will then increase the equivalent resistance of R5R_5 in parallel with R4R_4 and decrease the op-amp gain. This will continue until the system reaches a steady-state and oscillates forever.

And below are the simulation results for this circuit:

SPICE simulation results for the JFET gain-limited Wien bridge oscillator circuit shown above. Notice the ringing on the gain that takes a few hundred milliseconds to stabilize.

Ring Oscillators

A ring oscillator (a.k.a. RO) is an electronic oscillator made up of a chain of an odd-number of digital logic NOT gates. The output of the last NOT gate is fed into the input of the first. The oscillator relies on the propagation delay from the input of the first NOT gate to the output of the last NOT gate to set the oscillation frequency.

The world's most basic ring oscillator, using one NOT gate.

Simulation

KiCad schematic of a three stage ring oscillator (ready for simulation).

I ran into convergence issues when using the 74HCU04 SPICE model I found floating around on the internet (located in a file called 74HCng.lib). Simulating one instance of the inverter worked fine, but I got the dreaded doAnalyses: TRAN: Timestep too small error when connecting the second/third/e.t.c inverter in the ring. The convergence issue still occurred even when driving the first inverter instance from a slow frequency PULSE voltage source (rather than the driving it from the output of the last inverter), indicating it wasn't a problem with the ring structure.

I then looked harder around the internet and found the MyHCU04 SPICE model posted on Google Groups by the late Jim Thompson:

On popular request, 74HCU04 Spice Model rescued from 1993 archives and posted on the Device Models & Subcircuits page of my website...

This SPICE model for an inverter fixed the convergence issues I was having (if anyone else is interested in this file, I've saved it here). Hurrah!

It's working! Simulated output of the three stage ring oscillator schematic shown above.

Manufacturer Part Numbers

  • SiT1533AI: SiTime standard clock oscillators and MEMS oscillators.
    • SiT1533AI-H4-D14-32.768G: MEMS clock oscillator.

Footnotes

  1. https://www.mouser.com/datasheet/2/371/SiT1533_rev1.4_03202018-1324419.pdf, retrieved 2021-01-18.

  2. https://www.analog.com/media/en/technical-documentation/application-notes/AN-111.pdf, retrieved 2021-05-01.