# Arduino Forum

## Topics => Science and Measurement => Topic started by: I_J on Jan 17, 2020, 06:57 am

Title: Measuring Circuit/Technique for Quartz Thermometer
Post by: I_J on Jan 17, 2020, 06:57 am
Hi Y'all,

First time posting. I have been at this for a while, so I want to start out saying that this forum has been extremely helpful to me over the last years, without having asked a question.

Anyway, I got myself one of these quartz thermometers (https://en.wikipedia.org/wiki/Quartz_thermometer ) . They change their frequency ever so slightly with changing temperature. They are extremely accurate, as long as you can measure the frequency accurately.
In my case, this crystal is connected to a coil that creates an electromagnetic field. I build a coil that is picking up the signal, and my scope is showing the correct frequency (Yay!).
Now how do I go about measuring this with an Arduino?
The base frequency is 262.144 kHz. The biggest change I need to measure is 262.4kHz and I want good resolution between this (I would like to be able to detect changes of 0.001).

Heres an example datasheet of the crystal: https://web.archive.org/web/20101130042739/http://statek.com/products/pdf/10162.pdf
Title: Re: Measuring Circuit/Technique for Quartz Thermometer
Post by: wildbill on Jan 17, 2020, 02:28 pm
Condition the signal from the coil until it's at the level your Arduino can read if it isn't already.

Use an interrupt to catch the rising edge and note the time using micros, perhaps grabbing it every tenth time. Then calculate the frequency.

You may find on a 16MHz Arduino that it's not accurate or indeed that the Arduino can't keep up - there isn't much time between interrupts. If so, you could use external discrete logic to reduce the rate or get a faster Arduino/Teensy.

Title: Re: Measuring Circuit/Technique for Quartz Thermometer
Post by: jremington on Jan 17, 2020, 06:10 pm
The fastest and most accurate way to time external events is to use the Input Capture mode of Timer1.

Of course, the Arduino's clock is also temperature dependent.
Title: Re: Measuring Circuit/Technique for Quartz Thermometer
Post by: MarkT on Feb 10, 2020, 09:54 pm
The standard Arduino Uno has a ceramic resonator, no use whatsoever for this.  Even quartz crystal microcontrollers will not have a stable enough frequency reference, just a cheap low-precision crystal.

A rubidium frequency standard or ovenized frequency standard or GPS-conditioned reference is assumed for this kind of sensor, did you realize this?
Title: Re: Measuring Circuit/Technique for Quartz Thermometer
Post by: wvmarle on Feb 11, 2020, 01:45 am
The base frequency is 262.144 kHz. The biggest change I need to measure is 262.4kHz and I want good resolution between this (I would like to be able to detect changes of 0.001).
That's less than 0.4 ppm.

To measure at this level your reference must be better. So a typical 25 ppm crystal does not do. You want your reference to be better than what you measure, ideally by an order of magnitude so you can neglect that error.

As soon as you can get your Arduino's crystal to be better than 0.4 ppm over the temperature range the Arduino itself experiences, you're in business, though ideally you'd aim for <0.04 ppm. Then it's time to look at how to deploy the Timer1 counter input. Or, better, use timer1 (as it's 16 bit) to count processor clock cycles while timer2 (8 bit) counts the pulses of the thermometer crystal.
Title: Re: Measuring Circuit/Technique for Quartz Thermometer
Post by: 6v6gt on Feb 11, 2020, 10:02 am
I guess that if you could beat the frequency in the range 262.144 kHz to 262.4kHz with a highly accurate 262.0 kHz source, you'd reduce the problem to interpreting a signal in range 144Hz to 4kHz which is then quite possible for an Arduino to handle.