# [time-nuts] Digital temperature compensation

Sat Nov 1 16:40:41 EDT 2014

```I'm experimenting with using a temperature sensor to estimate local
oscillator frequency changes.  My goal is to have a decent holdover
clock for a NTP server with not so great GPS antenna placement.

I've been sampling temperature every minute, measured by a DS18B20.
I've been measuring local clock frequency differences, using chronyd's
logs from the GPS's PPS.  At 28C through 21C, I get a pretty good
result that fits a quadratic polynomial decently (0.117 ppm stddev).
I've attached the graph of that as "temp-clock-warmer.png".

With the colder temperatures, there's a sudden drop off in frequency
that I'm having a hard time finding a equation that fits as nicely.
All the examples I can find on the web look like third degree
polynomials, while my data doesn't seem to fit that exactly.  The best
result I've had so far (0.198 ppm stddev) is attached as
"temp-clock.png" and uses the function:

f(x) = -abs(a * (x - 20.88)) + b * ((x - 20.88)**2) + c * ((x - 20.88)**3)
a = 0.888582
b = 0.113806
c = -0.00445763

Does anyone have any advice on how to better model this?  Has anyone
seen this behavior?

I can provide the raw data if that would help any.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp-clock-warmer.png
Type: image/png
Size: 15870 bytes
Desc: not available
URL: <http://www.febo.com/pipermail/time-nuts/attachments/20141101/bbc7a46b/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp-clock.png
Type: image/png
Size: 17406 bytes
Desc: not available
URL: <http://www.febo.com/pipermail/time-nuts/attachments/20141101/bbc7a46b/attachment-0003.png>
```