The Three Dollar Frequency Standard

[Paulie] over on the EEVBlog forums picked up an inexpensive frequency counter on eBay and realized it was just a little bit off. As a result, he decided to build a frequency standard. His build wound up costing him about $3 and he shared the design and the software for it.

The hardware design is very simple: a TCXO (also from eBay), an ATMega8, a pushbutton, and a AA battery with DC to DC converter to power the whole thing. The software does all the work, providing frequencies from 10MHz down to a few hundred hertz (including some common audio test frequencies).

If you haven’t worked with a TCXO before, it is a crystal oscillator that includes a temperature compensation circuit to pull the crystal frequency up or down depending on temperature. Although crystal oscillators are pretty accurate already, adding this temperature compensation improves accuracy over the design temperature dramatically (typically, 10 to 40 times better than a naked crystal oscillator). If you want to learn more about TCXOs, here’s a good write-up.
A TCXO isn’t as good as an OCXO (where the first O stands for Oven). However, OCXOs cost more, are larger, and drain batteries (after all, it is running an oven). You can even hack your own OCXO, but it is going to cost more than $3.

If you want to see the real guts of one TCXO, check out the video.

19 thoughts on “The Three Dollar Frequency Standard

    1. Nice! but that’s really a longterm average. it’s interesting, but the question often is whether the oscillator has the same frequency at the height of summer as during the coldest of winter.

  1. I generally recommend having a look at your average electronic’s distributor’s stock. In this case, let’s talk about newark/farnell:
    http://www.newark.com/webapp/wcs/stores/servlet/Search?catalogId=15003&langId=-1&storeId=10194&categoryId=800000004557&sort=P_PRICE&pageSize=25&showResults=true&aa=true&sf=783&pf=811996066,811996069,812022224,812022225,812054712&max=811996069

    So if you’re not in the mood to pick an unknown-quality (yes, there are different quality bins for oscillators, and manufacturers test and sell the worse ones for cheap) oscillator, buying a new one for $3.30 does seem like a viable alternative. Of course, the ebay sourced, step-up powered, and self-assembled TCXO based reference does quite a bit more (and is a fun project), but it surely shouldn’t be considered to play in the same leagues as something put together from new, known-quality parts.

    I’d have a bit of criticism, too, regarding the design: Using an ebay step-up DC/DC converter without very solid filtering of the supply voltage will introduce measurable noise in the clock signal, even if the low-pass (average) voltage of the DC/DC converter doesn’t change significantly under load. That’s a common problem with switch-mode power supplies. Now, noise in a frequency reference effectively becomes phase noise, which effectively reduces the accuracy of what the clock-using device sees. Hence, adding in a good analog low-pass in the power supply lines is a must.

    Also, this really depends on the oscillator, but typically, these devices are made to drive capacitive loads in the order of 5-50pF, not 100pF + Atmega input pin capacitance. Over-loading the output will also reduce accuracy.

      1. Apologies for diverging from the topic, but I cannot find anyone knowledgable about the topic to ask and you look like you know what your doing.

        I’m trying to build a frequency counter, and the modulus prescaler I’m using says it can drive a 2pF output, or higher if you connect a resistor to ground (up to 4mA current output). I’m connecting it to a binary clock (SN54LV1612A) which has a ‘Ci’ of 1.8pF (dunno what that means). Does this fit the bill for connecting the output of the scaler to the input of the counter with a thin trace?

    1. a sub 200$ GPSDO would in fact be pretty impressive. You’re definitely a few orders of magnitude more accurate, if you’re doing that right. I don’t see how your GPS module is outputting an oscillator, though, only a 1pulse-per-second signal. You seem to be using that do discipline your VCOCXO. There’s nothing wrong with that approach, but it means that you can only do adjustments once per second. If your control loop design is good, that’s not a problem, because after a few seconds, the drift will be very small, so that adjustments will be very minimal, and hence, clock frequency variance (aka. long-term phase noise).

      How did you model the the control loop you’re building? How does the VCOCXO react? This is a pretty control loop theory centric thing, because you’re playing the competing control loop game. You will need to specify a design goal: Is it stationary accuracy, speed of correction, mitigation of oscillation? Coming from an old-school control loop theory, that’ll determine the amount of P, I and D in your PID controller, assuming that’s the architecture you’re going to chose (hint: it’s not necessarily the best one for a controller where there’s such a big gap between intervals of observation and intervals of opportunity to control).

      1. It’s a work-in-progress. I haven’t actually completed the prototype build yet. The boards are at OSHPark being done right now. What I’ve done is breadboarded some of the components to test the subsystems and written the firmware in advance.

        I have done PID before for my reflow oven controller(s), but at the moment the firmware doesn’t actually do PID. Instead, I have kind of an if/else tree that attempts to use small adjustments when the error is small and large adjustments when it’s not. It’s ad-hoc, but I’m hopeful that it’ll work out. We’ll see in a week(ish). If it’s too fiddly, then I’ll break out the PID.

        In fact, it’s not 1 PPS, because 1 count either way at 10 MHz (I’m designing for 20 because it’s what I want, but I realize others will want 10) is only 100 ppb. I want to be inside of 20 ppb, so I need to keep a rolling window of 10 samples. I will claim a “lock” whenever the error is inside of 4 counts out of 200,000,000 or 2 counts out of 100,000,000.

        The analog feedback section is a variation on a Connor Winfield application note. The only change I’m making is swapping out the AD5061 DAC because I need it to run on 3.3v and 16 bits of resolution is enough (instead of 18).

  2. It seems to me if you’re interested in an oven controlled crystal oscillator build that it’d be hard to improve on this kit: http://www.qrp-labs.com/ocxokit.html In fact I have been thinking about submitting this for the last week or two, I just never got around to it (working on my own projects). It’s inexpensive, cleverly designed, and has detailed build instructions.

    1. The Si5351 phase noise leaves something to be desired, even when externally referenced. Plus this Si5351 article doesn’t really get into the subject of proper low noise power supply and interconnect/layout (the devil lives there). If you are going to do this properly, at least GPS discipline a high quality VCOCXO (e.g. a 10MHZ Isotemp module), and use a fully linear isolated supply with telecommunications-grade low noise linear regulators. If you need a variable frequent output, then use an Si571 (not the Si570, and not the Si5351). Use the high speed A-grade Si571 with LVDSoutput, divide the output to further reduce noise. Yes the Si5351 is cheap and can get son tiny breakout boards with them along with sample Arduino code. But in this case you get what you pay for.

  3. the Ebay counter (picture) are pic or avr based, to me it’s not a professional measurement at start, it doesn’t have an tcxo / ocxo etc … based clk reference.

    Mod this, and resolution will be better at start … for calibration i use an gps based clock source. around 15$.
    You have precise hz counter for 35$ with 2.5 pmm clk .. ???

    The project is good, cheaper solutions are sometimes good too.

  4. Or, for similar price, you can source a DCXO with less than 1ppm. I think most consumer radios are all moving to DCXOs, they are smaller, take up less power and can be just as precise as a basic TCXO, but not near a monster oven controlled part.

Leave a Reply to voja antonicCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.