CRYSTAL AND OSCILLATORS

# Crystal And Oscillators

Date Published: | |

Last Modified: |

## 1. Overview

The page also includes discrete oscillator elements such are crystals.

## 2. Crystals

** Crystals are piezoelectric components which can be used to build an oscillator**. Combined with driving circuitry, they form an oscillator which can be made to output a periodic waveform to be used as a clock source for digital logic (e.g. flipflops, microcontrollers, FPGAs, e.t.c.). They can also be called

*piezoelectric resonators*.

### 2.1. Equivalent Circuit

A piezoelectric crystal resonator can be modelled as a series LCR circuit in parallel with a capacitor:

The series components \(C_1\), \(L_1\), and \(R_1\) model the physical properties of the piezoelectric crystal, and are called the motional arm[8]. They are not real physical electronic components inside the crystal. The parallel component \(C_0\) is the lead capacitance[2].

\(L_1\): This models the mechanical mass of the quartz in motion. Lower frequency crystals have a value of \(1-2H\) (yes, that’s whole Henries, much larger than micro/milli-Henries of most real inductors!). This value can drop down to \(1-100mH\) for the higher frequency crystals, which are smaller and therefore less mass.

\(C_1\): This models a number of mechanical properties of the quartz crystal: the stiffness, the area of the electrodes, and the thickness/shape of the wafer. The value for fundamental mode crystals ranges between \(0.005pF\) and \(0.030pF\).

\(R_1\): This models the impedance of the crystal when it is oscillating at it’s series resonant frequency. When a series LC circuit is at resonant frequency, it’s impedance is \(0\Omega\), therefore the impedance (and therefore current) is purely determined by this \(R_1\). \(R_1\) is inversely proportional to the active area of the crystal, therefore smaller crystals have a larger \(R_1\).

\(C_0\): This models the parallel capacitance (a.k.a. *shunt capacitance*) between the two leads of a crystal. It is the measured capacitance between the two leads when the crystal is not excited (i.e. not vibrating). \(C_0\) typically ranges from \(1-7pF\).

### 2.2. Series And Parallel Resonant Frequencies

The series resonant frequency \(f_S\) only depends on the motional arm (physical properties of the crystal) as shown in \(Eq.\ \ref{eq:series-res-freq}\)[8].

The parallel resonant frequency \(f_P\) also depends on the parallel parasitic capacitance \(C_0\), as shown in \(Eq.\ \ref{eq:parallel-res-freq}\)[8].

The series and parallel resonant frequencies are usually very close together. Crystals below 30MHz are operated at a frequency somewhere between the series and parallel resonant frequencies[8].

### 2.3. Quality Factor

The quality factor for crystal oscillators is extremely large, typically 10,000 or greater. This is due to the very low series resistance (typically around \(5\Omega\).

The quality factor is determined by the following equation:

where:

\(X_L\) is the impedance of the inductor.

### 2.4. 32.678kHz Crystals

32.678kHz is a popular frequency for crystals (also just shortened to *32kHz crystals*) because it is exactly \(2^{15}\). This means you can use one with a 15-bit binary counter to get a precise 1-second (1Hz) clock or "tick". It is also a good trade-off in terms of power consumption (lower frequency = lower power consumption, great for battery powered devices) and size (higher frequency means smaller crystal package). 32.678kHz crystal are very common in any embedded circuit design which needs a *real time clock* (RTC). As such, they are also "dirt cheap"!

Many microcontrollers have pins which you can connect a 32.678kHz crystal to, with pin names such as `XTAL32`

, `32K_XP/32K_XN`

(ESP32). Sometimes the `32`

is added to distinguish it from the "main" higher frequency oscillator pins, which typically support crystals in the frequency range from 1-48MHz. The microcontroller has an internal oscillator for driving the crystal. A *Pierce oscillator* is a popular oscillator topology used in microcontrollers to drive these crystals. For example, all of the 32.678kHz oscillators in the MSP430 range of microcontrollers use Pierce oscillators[7].

As shown in Figure 3, 32.678kHz crystals are also called *tuning fork crystals*, as the crystal is usually cut into the shape of a tuning fork[8] (a vibrates in a similar manner to a larger, metal one).

#### 2.4.1. Turnover Temperature

** Turnover temperature (\(T_O\)) is a term used with 32.768kHz crystals to describe the temperature at which the crystal is at it’s highest oscillation frequency**. 32.768kHz crystals have a negative parabolic frequency response to temperature (

**frequency drops proportionally to the square of the temperature change**) at the turnover temperature is at the maxima (at lower or higher temperatures, the frequency begins to drop). Most 32.678kHz crystals have a turnover temperature \(T_O\) between 20 and 30°C and \(\alpha\) of approx. \(-0.034ppm^{\circ}C^2\)[6].

\(Eq.\ \ref{eq:32khz-drift}\) shows how to calculate the drift from the current operating temperature of the crystal.

where:

\(ppm\) is the drift from \(f_O\), the oscillation frequency at the turnover point, in parts-per-million

\(T\) is the operating temperature of the crystal, in \(^{\circ}C\)

\(T_O\) is the temperature at the turnover point, in \(^{\circ}C\)

\(\alpha\) is a part specific co-efficient, specified in the datasheet, in \(ppm^{\circ}C^{-2}\). If no coefficient is listed, \(\alpha=-0.034ppm^{\circ}C^{-2}\) is a good assumption

Rather than using \(ppm\), \(Eq.\ \ref{eq:32khz-drift-as-ratio}\) shows how you can instead write is a ratio of \(\frac{f}{f_O}\).

where:

\(f\) is the actual oscillation frequency

\(f_O\) is the oscillation frequency at the turnover point, typically \(32.678kHz\)

### 2.5. The Negative Resistance Test

The *negative resistance test* can be used to find the oscillator load safety margin present on your circuit design. The test is performed by inserting a potentiometer in series between the crystal and the oscillator (which may be inside a microcontroller). You then slowly increase the resistance until you find the point at which the oscillator fails to start-up correctly[8].

### 2.6. Oven-Controlled Crystal Oscillators (OCXOs)

High-performance crystal oscillators are kept with temperature-controlled environments to increase the stability of the oscillator. They are called oven-controlled crystal oscillators (OCXOs).

The crystals are designed to have a *turning-point*, a point of greatest stability, close to the oven temperature. OCXOs, rather than having a temperature stability in the ppm (parts-per-million) range like normal crystals, have a stability in the ppb (parts-per-billion) range (20ppb would be a viable stability).

Peltier devices can be used as the "oven" to keep the crystal’s temperature constant.

### 2.7. Popular Crystal Packages

The HC-49/U package is a popular choice for older through-hole crystals.

Newer crystals come in small, custom SMD packages, with typically either 2 or 4 pins (with the 4-pin packages usually have two GND pins).

### 2.8. Simulation

Crystal oscillators can be difficult to simulate accurately in most SPICE-based programs[3]. Most SPICE programs use the Newton-Raphson algorithm for converging to a solution. Unfortunately, the Newton-Raphson algorithm is not suitable for very high Q circuits, of which a crystal resonantor is definitely one (Q values of \(10,000\) or more!). The time step has to be set so small for accurate simulation of crystal resonantor circuits that it can take days of simulation to "start-up" the ceramic resonantor (i.e. reach steady-state oscillation from power-on).

### 2.9. Crystal Component Packages

For info on crystal component packages, see the Crystal Packages page.

## 3. Oscillators

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.

### 3.1. Designators

A common designator prefix to use for oscillators is \(Y\) (e.g. \(Y1\)). I do not recommend using the prefix \(XC\) as this should be reserved for crystal oscillators.

### 3.2. Important Parameters

#### 3.2.1. Phase Noise

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

#### 3.2.2. Start-Up Time

Symbol: \(T_{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.

## 4. 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 issue[1].

### 4.1. 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

## 5. 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.

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

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.

### 5.1. Wien Bridge Equations

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

The impedance \(Z_S\) of the series RC circuit is:

The impedance \(Z_P\) of the parallel RC circuit is:

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):

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:

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

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

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 \(R\) and \(C\):

Or in terms of natural frequency rather than angular frequency:

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 \(R_3\) and \(R_4\):

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

### 5.2. 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 supply[5].

### 5.3. Diode Limited Example And SPICE Simulation

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 \(1kHz\). We will also choose an arbitrary capacitance of \(C = 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:

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 \(R_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 \(R_4\) of \(1k\Omega\).

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

Assuming the diodes begin to conduct at \(0.6V\), with \(0.312mA\) of current flowing this would be across a resistance of:

So we need to split \(R_3\) into two resistors in series, one of \(1.92k\Omega\) with the diodes across it \(R_{3,diode}\) and one of:

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

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

which agrees well with what we designed for!

You can download the following assets:

### 5.4. JFET Gain-Limited Example

Using a JFET to partially switch in another resistor in parallel with the ground-connected gain resistor \(R_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.

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 \(V_{GS} = 0V\). Therefore the JFET is almost fully on (remember, JFETs are depletion mode devices), and \(R_5\) is in parallel with \(R_4\), increasing the gain of the op-amp. As the output voltage beings to oscillate, on the negative part of the cycle, diode \(D_1\) will conduct and charge the RC low-pass filter \(C_3\) and \(R_6\) with a negative voltage. This will decrease \(V_{GS}\) below \(0V\), which will begin to turn the JFET off. This will then increase the equivalent resistance of \(R_5\) in parallel with \(R_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:

## 6. 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.

### 6.1. 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](ring-oscillator-single/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](https://groups.google.com/g/sci.electronics.basics/c/k93fFgwnw-s?pli=1):

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](ring-oscillator-triple/MyHCU04.lib)). Hurrah!

## 7. Manufacturer Part Numbers

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

## References

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

[2]: https://www.ctscorp.com/wp-content/uploads/Appnote-Crystal-Basics.pdf, retrieved 2021-04-28.

[3]: https://designers-guide.org/forum/Attachments/GEHRING_-_Fast_Crystal-Oscillator-Simulation_Methodology.pdf, retrieved 2021-04-28.

[4]: https://www.electronics-tutorials.ws/oscillator/crystal.html, retrieved 2021-04-29.

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

[6]: ST Microelectronics (2009, Jul).

*AN2971 Application note: Using the typical temperature characteristics of 32 KHz crystal to compensate the M41T83 and the M41T93 serial real-time clocks*. Retrieved 2021-09-09, from https://www.st.com/resource/en/application_note/an2971-using-the-typical-temperature-characteristics-of-32-khz-crystal-to-compensate-the-m41t83-and-m41t93-serial-realtime-clocks—stmicroelectronics.pdf.[7]: Spevak, Peter and Forstner, Peter (2006, Aug). _MSP430 32-kHz Crystal Oscillators _. Texas Instruments. Retrieved 2021-09-10, from https://www.ti.com/lit/an/slaa322d/slaa322d.pdf.

[8]: Atmel (2015, Mar).

*AVR4100: Selecting and testing 32kHz crystal oscillators for Atmel AVR microcontrollers*. Retrieved 2021-09-12, from http://ww1.microchip.com/downloads/en/appnotes/doc8333.pdf.

## Authors

### Related Content:

- Silicon Controlled Rectifiers (SCRs)
- Shift Registers
- Peltiers (Thermoelectric Cooler)
- Electropermanent Magnets (EPMs)
- Neon Sign Transformers

### Tags:

- electronics
- components
- oscillators
- crystals
- MEMS
- XTAL
- XC
- XO
- OCXO
- frequency
- clocks
- power consumption
- stability
- accuracy
- ultrasonic baths
- ring oscillators
- NOT gates
- turnover temperature