# Precision timing using arduino and external clock

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

Ideas?

• 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. Commented Apr 7, 2016 at 8:10
• 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. Commented Apr 7, 2016 at 8:13
• @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 Commented Apr 7, 2016 at 9:17
• 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? Commented Apr 7, 2016 at 9:44
• @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. Commented Apr 7, 2016 at 14:22