Measuring quartz crystals with the AVR transistor tester

Pieter-Tjerk de Boer, PA3FWM pa3fwm@amsat.org

(This is an adapted version of part of an article I wrote for the Dutch amateur radio magazine Electron, August 2016.)

Previously [12] I explained how I modified the AVR transistor tester firmware to also measure small inductances, by connecting them in parallel to a known capacitance, exciting this LC circuit with an impulse, and measuring the resonance frequency. If that is possible, would it then also be possible to measure the resonance frequency of a crystal? In the end I managed to do this, but it was much more difficult than initially thought...

LC circuits can be excited with a single pulse and will then (electronically) vibrate well and measurably, but crystals don't do that. To get a resonance of sufficient amplitude with a crystal, we have to excite the crystal not with a single pulse, but with several pulses, timed such that the contribution of each next pulse is in phase with that of the previous pulse, thus repeatedly increasing the amplitude a little bit. But... if you don't know the resonance frequency, you don't know what the appropriate timing for the pulses is. The only way out is to try lots of different frequencies: at every frequency generate several tens of pulses, and check whether the crystal resonates.

[equivalent circuit] Once the crystal vibrates, we can measure the varying voltage across it, using the sampling trick I described before, and thus measure the frequency. A next problem then is that the microcontroller is clocked at "only" 16 MHz. Our samples are therefore separated by at least 1/16 µs, which means we will have aliasing around 8 MHz: signals (and thus crystals) of e.g. 7 and 9 MHz cannot be distinguished. For this I came up with the following solution, which has the nice extra feature that also the crystal's motional capacitance is measured, and the difference between its parallel and series resonance (cf. the companion explanation).

If we just excite the crystal with a pulse train, it will resonate at its parallel resonance frequency., which is determined by Lm in parallel to the series circuit of Cm and Cp. But if we short-circuit the crystal, Cp no longer participates, so the crystal resonates at its series resonance frequency, which is slightly lower. We cannot measure this directly, because due to the short-circuit there is no voltage across the crystal. But if between exciting the crystal and measuring its frequency without short-circuit, we short-circuit it for a while (some microseconds), then the measured frequency will be that of the parallel resonance, but its phase will have shifted: the longer the crystal has been short-circuited, and the larger the difference between series and parallel resonance, the larger this phase shift is. So by repeating this measurement several times, each time with a different duration of the short-circuit, we can measure the difference between the series and parallel resonance frequencies. If we also let the tester measure Cp (by measuring the crystal as if it were a simple capacitor), then from the frequency difference also Cm can be calculated.
Practically, we do this short-circuiting by programming both microcontroller pins to which the crystal is connected as outputs and setting them to 0; in other words, by putting the "switches" in the first figure of [12] in the position "20 ohms to ground".
Furthermore we know that the series resonance frequency must be lower than the parallel resonance frequency. This makes it possible to solve the aliasing problem: the direction of the phase shift due to the short-circuiting tells us whether we are above or below 8 MHz.

I had hoped to also be able to determine the Q, and thereby the series resistance Rm, by measuring how quickly the amplitude decreases. With LC circuits this works fine, as described before [12]. But with crystals, no meaningful result came out of this; apparently the vibration is damped mostly by other causes than the crystal itself, such as the internal resistance of the microcontroller.

[prototype in action] So, the tester can measure the parallel resonance frequency, detect aliasing and compensate for it, measure the series resonance frequency, and calculate Cm from the difference.
There are some snags though: crystals of exactly 8 MHz cannot be measured well due to aliasing; above about 13 MHz the measurement doesn't work well because the ADC's input circuit attenuates too much (but that does avoid troubles due to the next aliasing at 16 MHz); some crystals tend to show a spurious resonance frequency rather than their main resonance, or (mysteriously) end up near 1.4 MHz; with rather low frequency (< 2 MHz) crystals the short-circuit trick turns out to work less precisely; and the resolution of the frequency measurement is just not enough for e.g. selecting crystals for a filter (this is caused by the resonance being damped too much). But well, it's still nice that such a simple piece of equipment, which was never designed for this, can do this with "just" a bit of software. My code for this has been integrated in the official software on the SVN server [3].

But if one wants to measure crystal parameters really well, e.g. to design a crystal filter, one better use a different method, e.g. using a network analyser which shows the entire impedance curve. Or use the measurement method by G3UUR, of which many descriptions can be found on the Internet: build an oscillator with the crystal, measure the frequency, and repeat this with a known capacitor in series with the crystal; from these, one calculate the components in the equivalent circuit. G3OTK even automated this entire process [4]: just plug the crystal into his tester and the parameters appear on the display.

References:

[3] https://www.mikrocontroller.net/articles/AVR_Transistortester
[4] G3OTK: An Automated Method for Measuring Quartz Crystals, QEX 11/2013.
[12] PA3FWM: Measuring small inductances and capacitance with the "AVR transistortester". Electron, December 2015; and on this website.

Text and pictures on this page are copyright 2016, P.T. de Boer, pa3fwm@amsat.org .
Republication is only allowed with my explicit permission.