6
\$\begingroup\$

I recently found my way onto a Datum x72 rubidium standard and had half a mind to turn it into a homebrew atomic clock, since I'm not exactly using it for a garage-based satellite business.

It seems there are plentiful examples of building atomic clocks using AVRs and PICs online, but most of these appear to feed one of the source-derived inputs (for example, the 1pps signal) into a timer that counts. On the interrupt, there is software action that drives the clock.

I suppose the main question is - is there a better, more direct way to do this? I haven't found any RTC modules that would accept a 10MHz signal (seeing as that would drive power draw up, voiding the concept of an RTC), but is there any sort of clocking device or IC out there that could reference the rubidium signal?

The software clock-timer system tends to feel like a bit of a hack to me, so if someone could break the components of this project down for me a little better it'd be much appreciated.

\$\endgroup\$
  • 1
    \$\begingroup\$ If you have a 10 MHz output disciplined to the oscillator, then you can just clock an AVR off that and use the timer peripheral to produce intervals to count in software for your clock display. Be very careful not to have any calculations which accumulate rounding error. \$\endgroup\$ – Chris Stratton May 20 '15 at 17:37
  • 1
    \$\begingroup\$ Isn't the 1pps output already dividing the 10MHz signal for you? \$\endgroup\$ – Samuel May 20 '15 at 17:42
  • \$\begingroup\$ Info only: Rubidinium clocks have two (at least) stability degradation modes. A common one is caused by the plating of Rubidium on the lamp glass and the excessively enthused can fix this with a hot air gun and enough skill luck knowledge and daring. Good brief discussion here \$\endgroup\$ – Russell McMahon May 27 '15 at 6:52
  • \$\begingroup\$ Depending on the output wanted a gps and any rubidium osc that can lock to it will give time to the 10 tens of ns. There are gps receiver's that accept the 10mhz and the 1pps to give accuracy down to ns. \$\endgroup\$ – user93116 Nov 30 '15 at 5:28
3
\$\begingroup\$

If the input is down to a 1PPS, then one method of keeping the time calculation at ISR deterministic (neither fast, nor slow, but consistent) would be to actually calculate time one second into the future elsewhere, then use the ISR to update time to the "one second ahead" time. In this case, even relatively slow periodic code could:

  1. Keep a previous time and see the ISR advance the time
  2. Use the change of time to calculate the "next second's time" to prepare it for the ISR.

If the timing of the interrupt is faster than 1PPS, that simply means less time to detect and calculate the 1/x time into the future somewhere else.

\$\endgroup\$
  • \$\begingroup\$ Of course, there still can be some jitter if interrupt latency is variable (due to need to complete a multicycle instruction, perhaps) or the interrupt is ever masked \$\endgroup\$ – Ben Voigt May 20 '15 at 21:21
7
\$\begingroup\$

If you configure a MCU to use an external oscillator then you could feed the 10MHz signal into the MCU (you may need a level shifter if it doesn't use TTL/5V CMOS signal levels) and then use timer prescalers to get it down to a more manageable clock rate for further use.

\$\endgroup\$
  • \$\begingroup\$ It may not be that straightforward. Many of these devices put out a waveform that is either sinusoidal or at least very far from a square wave. And any method of converting it to a clock signal has to have ultra-low phase noise if the usefulness of the original reference signal is to be maintained. \$\endgroup\$ – Oleksandr R. May 21 '15 at 10:54
3
\$\begingroup\$

If you want a 1 pps signal from a 10 MHz input, you can configure two '4059 counters in series, say divide by 5000 then divide by 2000. (If you want a symmetrical square wave, divide to 2 Hz, then put it through a flip-flop for the last divide-by-2.)

Of course, a microcontroller can do the division as well. But sometimes soldering is easier than programming.


For accuracy of a clock, you need to specify what your output is. If you want a display for a human to read, taking a few ms to update the display after receiving the PPS toggle is no big deal. Similarly, a bit of jitter is OK for human use (naive implementation will take a little longer when values roll over.) If you need a low-jitter or zero-latency output you should state your requirements more clearly.

\$\endgroup\$
  • \$\begingroup\$ "Soldering is easier than programming" - kudos to that. However, the Datum x72 standard already carries 1pps outputs. What I'm more worried about is from a code-architecture perspective - it's easy enough to run a counter, but a standard HH:MM:SS clock scheme requires loops and compares, and I'm worried that those operations would dilute the accuracy of using a rubidium standard. \$\endgroup\$ – ecfedele May 20 '15 at 18:03
  • \$\begingroup\$ Actually, I suppose on a 1pps signal, there would be enough time to run iterative ISRs, but can you help shed any light on general code perspectives? \$\endgroup\$ – ecfedele May 20 '15 at 18:04
1
\$\begingroup\$

If it's a 10 MHz square wave, just about any digital system will do. Ignacio's suggestion of directly clocking a microcontroller is a good one. You could also divide down the 10 MHz clock to 1 kHz and connected it to an MCU's external interrupt pin. One interrupt per millisecond should be easy to handle without any perceptible delay. (For that matter, so would one interrupt per second.)

If you'd rather avoid MCUs, you can use decade counter ICs and logic gates to produce BCD values for seconds, tens of seconds, minutes, tens of minutes, etc. This web page shows an example circuit. Again, you could do this with a divided-down 1 kHz clock (if you want to show milliseconds), or the 1 PPS signal. The BCD values can then be fed into seven-segment decoders driving seven-segment LED displays.

If you want to control an analog clock, you could use a similar method to generate pulses for a stepper motor.

Regardless of which method you use, there should be no perceptible inaccuracy or drift beyond what the rubidium oscillator provides.

\$\endgroup\$
0
\$\begingroup\$

I designed and built a RTC for a PC before RTCs were included in the PCs (around 1980). I used a 10MHz crystal oscillator and divided it down to 1PPS. Then, just like Adam mentions, I counted up the pulses and used 7-segment displays to display the hours, minutes, and seconds. The reason I used the 10MHz source, was to obtain very high accuracy. There is no reason a "more accurate" source could not be used (your rubidium oscillator). Nothing "fancy" is required. Dividers, counters, and displays, is all you need.

\$\endgroup\$

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.