[time-nuts] How to properly characterize 32kHz oscillators manually and with a microcontroller?

Pete Stephenson pete at heypete.com
Tue Jun 28 05:04:03 EDT 2016

On Mon, Jun 27, 2016 at 10:51 PM, Hal Murray <hmurray at megapathdsl.net> wrote:
> I assume you are doing this for fun.  That means you get to do whatever you
> think will be fun.

Indeed, this is strictly for fun. I have strange values for "fun".

> The DS3231 is pretty crappy by time nuts standards.  If you can also measure
> the temperature, you should be able to make neat graphs.  If you watch it as
> the temperature ramps up slowly, you should see a sawtooth pattern.  The
> crystal will track the normal freq/temp curve until the temperature changes
> enough for the correction logic to add in another step.

Oh, I know the DS3231 isn't terribly great. The datasheet calling it
an "Extremely Accurate...RTC/TCXO/Crystal" makes me laugh, as it's
tooting its own horn.

For more precise stuff timing, I have a Thunderbolt and other goodies.
(Speaking of which, I really need to figure out how to use the
Thunderbolt as an external clock source for my Arduinos.)

Still, the DS3231 is a reasonably accurate RTC, inexpensively priced,
is easy to interface with my Raspberry Pis, Arduinos, etc., and
provides a handy 32kHz output. It also has an internal temperature
sensor that it checks every 64 seconds, the output of which is also
accessible. Your idea of plotting the temperature vs. frequency is a
good one; I'll add it to the project list.

> Have you looked at tvb's PICPET and friends?
>   http://www.leapsecond.com/pic/picpet.htm
>   http://www.leapsecond.com/pic/picdiv.htm
> I think he has one that turns 32KHz into PPS.  You could feed that PPS into a
> picPET running off your Thunderbolt.

I have seen those, but I have little experience with PICs and the Wife
Acceptance Factor of buying more stuff for a one-off measurement is

> If you have a spare counter, you can run that in frequency mode and feed that
> to a PC.

Alas, I'm ashamed to say I have no frequency counter at all.

> Where are you going to collect the data?

My plan was to have the ATmega328 simply output the data over a serial
connection so I can put it in a spreadsheet or something.

> The PPS input on a PC may be be useful.

Indeed. I normally use it for NTP.

Thanks for the advice!


> pete at heypete.com said:
>> I'm a little concerned about the speed at which the pulses need to be
>> counted. The 32kHz pulses come in every ~30.5 microseconds, and handling an
>> interrupt on an ATmega328 running at 16MHz takes about 5.125 microseconds[1]
> ...
> Use one of the counters to divide things down to a rate that is easier to
> handle.
> --
> These are my opinions.  I hate spam.
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.

Pete Stephenson

More information about the time-nuts mailing list