[time-nuts] First success with very simple, very low cost GPSDO, under $8
albertson.chris at gmail.com
Thu Apr 10 07:33:27 UTC 2014
A couple more comments on the Arduino...
> 1) Have you checked for glitches in your dual-DAC system? The Arduino API
> is forcing you to make two successive calls to analogWrite(). I wonder if
> there might be a glitch when the LSB carries/borrows into the MSB, since
> each PWM is configured separately. You can check this with a test version
> of your code that linearly sweeps through all possible DAC values and then
> continuously measure the output voltage with a high-res voltmeter.
The 16-bit DAC has more resolution then my Fluke volt meter. I tested the
DAC by generating triangle waves but any glitches would be hard to see.
I think what makes this work is the very heavy analog filter. It goes
into a CRC "pi" filter made with a 100K resister and two 4.7 uf caps.
The PWM on both outputs uses the same clock The the pulses are in perfect
What likely does mess it up is the resisters are not precision and the step
sizes are not right.
One idea I had was to not treat this as a 16-bit value. I might thnk of it
as an 8-bit fine adjustment DAC with an 8-bit bias DAC.
I need some method to test the DAC. I running blind now.
> 2) Once you get rid of the unnecessary timer interrupt and have just the
> GPS 1PPS interrupt, realize that since all you do is a PID calculation and
> DAC update once a second, you can simply move that code to the interrupt
> handler. That further avoids any contention between main and interrupt
> code, since loop() has nothing to do.
I really do have to keep the interrupt handler short. The arduino does
lots in the foreground, like PWM and serial data. This that LOOK simple
like adding two numbers take time because this is an 8-bit CPU and even a
16-bit add is done is software. A multiply for the PID is way to long.
The AVR lacks even an 8x8 multiply unit and has to use shits and addition
in a loop.
> 3) Please consider using the ATmega input capture feature rather than a
> rising edge interrupt. The trouble with doing precise timing with
> interrupts is that, in AVR chips at least, there is some latency and
> jitter, depending if a multi-cycle instruction was in progress. You can
> avoid this by using hardware timer/capture registers. To find examples
> search for words like: Arduino timer ICR1H ICR1L
> 4) If you use (ICR1H) ICR1L you don't even need to use interrupts since
> the value is frozen until the next edge. I mean, you could poll if the code
> is simpler that way. Then your GPSDO is all in loop() with no interrupts at
> all. It's hard to get much simpler than that.
I'm going to eventually use the TIC which is connected to the 74HC4046 PPL
chip. I need a PPS interrupt for that. Also "loop" maybe e slow once I
add a user interface and LCD screen and I will at some point need to read
sawtooth from the GPS and I will also want to monitor the stays of the GPS
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to
> and follow the instructions there.
Redondo Beach, California
More information about the Time-nuts_lists.febo.com