Just like a lot of people I'm using a RPi as a NTP server (more info about the basic setup here: https://framkant.org/2017/03/stratum-1-ntp-server-with-freebsd-on-raspberry-pi/)

I have found that the stability is really bad and it's especially sensitive to temperature changes. Even me walking out the door in the morning changes the indoor temperature enough to affect the timekeeping.

In order to resolve this I would like to change the X1 oscillator to something more stable like a TCXO or OCXO. But I not really sure what I need to know/think about before doing this.

  • Do I need a special type of oscillator other than one with the correct frequency?
  • How hard would it actually be to replace the part? (soldering and so on)
  • Is the X1 actually the part I want to replace?


For reference, here is a graph of the timekeeping today with a spike from me making dinner in a room approx 10m away. :D (The scale is microseconds (milli*milli))

NTP graph


All RPi boards use standalone quartz crystals, not external oscillators. It's impossible to replace a crystal by an oscillator without some redesign of the schematic, and it will be very hard to do on an already populated PCB.

Check out the datasheet you've found: the IQXT-260 oscillator has 4 or 6 pins depending on the package. The X1 part on the RPi has only two pins.

  1. You'll need one with exactly the same circuit characteristics as the stock XO.

  2. If you're skilled with a hot-air rework station, and have all the right tools and equipment, it's not too hard. It's virtually impossible if you don't, though.

  3. Likely not. NTP is designed to work around variable system clocks through network consensus, so changing the XO won't give you much. Using a GPS's PPS signal effectively gives you a GPS/Multi-GNSS Disciplined Oscillator, so as long as you have skyview, you've got atomic clock accuracy even without a network. If you don't have skyview or network, it wouldn't be impossible to piece something together based on a used rubidium frequency standard — but even the cheapest of those have fearsome power requirements and are far from plug-and-play.

  • Thanks for the answer. I have a pretty good skyview and I get reasonable good PPS signals from GPS at the moment. But thats not much help for the stability when the PI is extremely temperature sensitive. – Peter Nov 11 '17 at 11:28
  • You might be using the wrong board. The Raspberry Pi is an inexpensive computer for education, not a lab-grade frequency reference – scruss Nov 11 '17 at 16:24
  • Hehe, I know. The only thing I want is to make the raspberry PI as accurate as possible. If I need a professional NTP server I will buy one. – Peter Nov 11 '17 at 17:59

This is a not a very fruitful idea, for several reasons.

The clock circuit on an embedded device like the PI is not designed for accuracy or stability, there are more elements than the XO that will affect jitter and drift.

  1. Stability and drift in the Phase-Locked Loop (PLL) inside the Broadcom CPU which generates the core clock
  2. Temperature Drift in XO resonance circuit
  3. Temeperature drift in the latching/clocking threshold detection circuits.
  4. etc. etc.

Additionally, Any hand rework, even with good equipment, runs the risk of wiping out any improvement from a better spec'd oscillator. They are very sensitive parts.

The improvement in temperature stability switching to a different XO in the same package is marginal, you are buying better tolerance and matching characteristics that reduce clock drift and temperature dependence for the device class, but physically speaking all crystals will expand/contract with temperature changes and all will experience clock drift, very hard to compensate for this.

In the end its unnecessary, if you want to run an NTP node it will work regardless, if you want to function as a (local) time standard you will need to interface external equipment, Like a GPS, thermally stable clock, cesium clock, etc...

However, If you want to experiment with stabilizing the on-board oscillator this I would suggest and alternative approach


Clock references in precise equipment are usually in a constant temperature oven, and require some time to stabilize. These "ovens" provide a constant temperature (not necessarily HOT), usually controlled by a Peltier Element

These devices are known as Oven Controlled Crystal Oscillator (OCXO). Unfortunately they require a significant change to the circuitry and are not drop in replacements.

They Look like This: enter image description here

To experiment, you could replicate some of the stability of an OCXO by putting a Thermo-Electric Cooler (TEC aka Peltier Element) to keep the XO and the broadcom CPU at a constant temperature.

In other words, eliminate the temperature issue by keeping the Raspberry PI at constant temperature.

  • 1
    Excellent answer, but keeping the temperature stable is really not that simple. And I'see a lot of pll changing frequency with cpu usage, probably caused by the noise on the power supply caused by the cpu core... I would recommend using a GPS with a PPS output – pim Nov 9 '17 at 18:36
  • 1
    @pim "but keeping the temperature stable is really not that simple" Indeed, the TEC was a suggestion for "experimentation", because OP may need self-convincing that the idea won't pan out. In Real-life its very problematic and error prone (OCXO is in a metal can for a reason!) . The real solution like you say is an external stable clock source - GPS is a great low-cost option, billions of dollars of R&D into making a perfect clock source, may as well use it! – crasic Nov 9 '17 at 18:41
  • Hi, Thanks for the answer, but it puzzles me for several reasons. I state in the question that I use it fo NTP, and if you follow the link you will see that Im actually using GPS to discipline the clock. But still its very temperature sensitive. Then you talk about OCXO which I also mention in the original question. I also provide a link to a TCXO with a very small package. – Peter Nov 11 '17 at 11:25

I agree that the Raspberrypi crystal is the weak point in a pi based ntp server. Your idea is interesting but you are very far from bringing the best out of the raspberrypi/GPS combo. With the unmodified Raspberrypi and PPS (not kernel pps) it is possible to get offsets of +-3 us peak, offset standard deviation (RMS) less than 1 us, jitter 2 us given a poll time of 16 s which is the suggested polling rate. And my pi crystal is constantly 7 ppm off! Your polling time seems to be much higher given your curve with many visible steps. I attach some graphs to illustrate what's possible now.Offset versus time Freqency of the Raspberry Crystal Oscillator

  • Hi! thanks! The graph is done with observium using a polling time of 5min and not from the loopstats. I use min/maxpoll 4. In what kind of temperature conditions do you keep your pi? And btw, I run FreeBSD and using the kernel module gpiopps.ko. – Peter Jan 20 '18 at 8:39
  • I have maybe 3°C temperature deviation during a day and I run raspbian 4.9.59 with ntp 4.2.8p10. Considered you use min/maxpoll 4 I think your pps is not working. You need a "o" in front of your pps enabled clock in ntpq -p. just "x" or "#" indicates your pps is not working and offsets are in the milliseconds range then. – tanGIS Jan 21 '18 at 10:36
  • Yes I have a o in front. No, my offsets are in the microsecond range. Peaks out at +-10µs. And thats a whole lot better than without the PPS-signal. (Notice the milli-milliseconds). – Peter Jan 22 '18 at 18:37
  • Oh, I got this milli-millisecond scale wrong. Then we have similar results. – tanGIS Jan 24 '18 at 17:31

Although not a direct answer to your question, http://www.osengr.org/Projects/NTP-Server/NTP-Server.shtml with the "advanced" variant may give you an idea on what is needed for such a setup. Considered there is already an TCXO in your GPS module there is no need adding another one on the microprocessor. The Raspberrypi has other components placed very closely to the crystal. I would sure damage something trying to solder in this area.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.