Computing stuff tied to the physical world

Precision time, anyone?

In Hardware on Jan 21, 2012 at 00:01

The RTC Plug uses a DS1340 chip to keep track of time. It has its own on-board coin cell and 32 KHz crystal, so that it can keep running when power to the JeeNode is switched off.

The 32,768 Hz crystal is rated at 20 ppm, with 3 ppm aging in the first year. A year has about 3600 * 24 * 365.25 = 31557600 seconds. With 20 ppm, the RTC Plug can be some 630 seconds off at the end of the year, i.e. close to one minute per month – worst case, that is. It’s fine for lots of uses, but evidently not all…

Here’s a new plug prototype, designed by Lennart Herlaar:

DSC 2860

It’s based on the DS3231 chip, which includes a “TXCO”, i.e. a Temperature Compensated Xtal Oscillator. There are many ways to improve the stability of a crystal oscillator, but this one is pretty nifty because it’s low-power (unlike an oven-based technique, which puts the crystal in an controlled temperature environment). The idea is that the chip periodically measures the ambient temperature, and then adjusts the capacitive loading of the crystal according to a calibrated function of temperature. IOW, it knows how to compensate its on-board crystal.

The DS3231 is specified at 2 ppm for temperatures 0 .. 40°C, i.e. ten times more accurate than the above crystal. So this clock will stay on time with an error of at most one minute per year, i.e. about a second per week.

For something, eh… slightly better – you could consider a Rubidium Frequency Standard with 50 ppt accuracy, i.e. well under a millisecond per year error. But don’t expect to run it off a coin cell – it draws about 11 Watt :)

If there’s enough interest, this plug could be added to the shop…

  1. What would it approximately cost, compared to the current RTC plug?

  2. Interesting technique – predict the errors from temperature variations and compensate for them on the fly. In an environment with a small band of slowly changing temperatures (e.g. domestic), it is likely to exceed its stability specs.

    Are pins INT/SQW or 32kHz accessible? Useful source of a known precision timing signal for calibrating test equipment for free.

    • Yes, the INT pin can optionally be tied to the IRQ pin on the port header via a solder jumper.

  3. That temperature range is pretty ‘in house’ too; you wouldn’t be able to read it out too (with a certain degree of precision, pun intended), is it?

    • According to the DS3231 datasheet: “Temperature is represented as a 10-bit code with a resolution of 0.25°C and is accessible”. So yes, precision and degrees, even with a certain degree of precision, it’s all there :-).

  4. I would like to see this in the shop!

    • Note that if this becomes available in the shop, it will be an official JeeLabs product, with the “trademark” blue-and-golden pcb.

  5. I built a clock based on the original Clock Plug (with a DS1340). It has been running for two years and has drifted less than a minute in that time. Am I just lucky?

    • Well… specs are supposed to be worst-case. But there’s another factor: if the temperature swing is minimal (i.e. always room temperature), you may well see better results than the 20 ppm of a standard 32 KHz crystal.

  6. The internal temperature sensed is available as a signed 9bit integer, hence the resolution of ~0.25°C, but uncalibrated, the accuracy is +/- 3 °C. Perhaps dunking in a bucket of iced water (distilled of course) can produce a calibration offset; the stability is likely to be good.

  7. And RTC is on my wish list. And if I would buy one, I would go for the better version. I’ve got a time critical project in mind, but do not need GPS precision.

  8. If anyone’s curious about the Rb frequency standard, I started a FAQ about it. I got three- couldn’t resist an actual atomic clock for under $50.

    • Neat – I’m tempted to get one too, just for the heck of it. Any tips on which eBay supplier to pick?

  9. Interesting concept, but if time accuracy is really an issue I’d rather look for an solution where the the (DS1340 or equivalent) RTC will be synchronised to some time server. NTP on my linux host, or even the time reference from some simple GPS dongle. Low drift is nice but you’ll still lack an absolute reference.

  10. How about DS3231 & micro SD on one nice datalogger PLUG :-) Count me in.

  11. Re: surplus Rb units: I suspect all the FE-5680A units on the market now are basically similar: at/near end-of-life. Seller will claim “tested” but this may not mean what you’d like it to mean. Two of three my units worked, and one needed an adjustment to achieve lock, as described in the FAQ. I purchased from 2010bluebook if it matters.

  12. i have a JN+RTC-Plug currently deployed where daily temperature variation is ~18c. I am seeing clock variations of around 2 minutes per month (well above DS1340 spec). I would buy a plug that better manages temperature variances.

  13. It would be great to have a more precise RTC plug. However, I’d prefer the commercial version of the DS3231 for garden geekery projects, since it can get below freezing outside in the winter.

Comments are closed.