I'm working on a very time limited project (8 weeks). Basically I need to perform measurements and save to memory. 2 identical boxes, 4 hours and no wireless or wired connection. Each box is measuring on accelerometers.

Due to the limitation in time I need a platform with minimal soldering, PSU design and so forth.

The Arduino is an obvious choice but the crystal is simply to unstable. I need precision of +/- 30 ppb of clock frequency.

I've found OCXO that meet spec but not at 16Mhz..(or 8).. Changing the clock speed to 12 MHz would help me a lot - but then the libraries becomes an issue.

My idea so far is to use arduino, write a program that sets a digital pin high, then waits x microseconds and then sets digital pin low. This way I can calibrate the x using a oscilloscope to land the right frequency of sampling.. hmm


  • \$\begingroup\$ I hope you realize that 30 ppb is the accuracy of a clock with an error of less than 1 second every 951 years ! 30 ppm sounds more reasonable but is still 1 second per year. Do you need 30 ppb/ppm stability or absolute accuracy ? The last one will be almost impossible without specialized equipment. \$\endgroup\$ Commented Apr 7, 2016 at 8:10
  • \$\begingroup\$ Looks like something similar to the Hafele-Keating experiment ? See en.wikipedia.org/wiki/Hafele%E2%80%93Keating_experiment Now you know why they used atomic clocks. \$\endgroup\$ Commented Apr 7, 2016 at 8:13
  • \$\begingroup\$ @FakeMoustache Maybe my calculations are wrong but I would say that: 4 hours = 14400 seconds * (5 *10^-9) = 72 us (microseconds) Here 5 is the error of 5 ppb of the crystal \$\endgroup\$
    – Andreas HD
    Commented Apr 7, 2016 at 9:17
  • 1
    \$\begingroup\$ You are right, but! During the 4 hours, I cannot predict the temperature development. Box 1 could potentially be at -40 and box 2 at + 80. They could drift in opposite directions. How would I go about syncronize/calibrating that? \$\endgroup\$
    – Andreas HD
    Commented Apr 7, 2016 at 9:44
  • 1
    \$\begingroup\$ @FakeMoustache - according to my arithmetic, there are 31,536,000 seconds in a (365 day) year. So 30ppm error could be as bad as 946 seconds/year (32.556 * 30), and not 1 second/year as your comment suggested. 30ppb is only 1,000 times better, and hence is slightly better than 1 second/year, and not 1 second every 951 years. I thought I should mention it. \$\endgroup\$
    – gbulmer
    Commented Apr 7, 2016 at 14:22

1 Answer 1


You can use an Arduino, but calibrate it to an external clock (or replace the clock with the external one).

For instance Teensy 3.0 can use this FreqCount library https://www.pjrc.com/teensy/td_libs_FreqCount.html and basically compare its internal clock with an external one -- for 30 ppb, you'll need to average over 1 minute or so, but you can then calibrate your internal oscillator for basic timing.

To keep things stable you'll need to ensure the temperature of the arduino's crystal doesn't change too quickly for the calibration to catch up.

Alternatively, use an arduino, and replace its crystal with an external OCXO signal.

  • \$\begingroup\$ Interesting library - I'll give it a look. Replacing the crystal with an OCXO is my current plan, but I haven't found OCXO that are precise enough and has a freq. of 16 Mhz. What are the implications of changing the clockfreq. ? I've read that e.g. millis() are affected since the arduino library does a divison of 16/16mhz = 1 us... \$\endgroup\$
    – Andreas HD
    Commented Apr 11, 2016 at 6:37
  • \$\begingroup\$ The Teensy expects a 16 MHz at boot up, but with some effort, you may be able to switch later. Instead, use the Teensy & FrequencyCount lib to count an external OCXO (10 MHz), and calibrate all other readings/settings to that. \$\endgroup\$
    – jp314
    Commented Apr 11, 2016 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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