Shop OBEX P1 Docs P2 Docs Learn Events
Question about Propeller RTC emulator? — Parallax Forums

Question about Propeller RTC emulator?

RavenkallenRavenkallen Posts: 1,057
edited 2011-05-10 07:56 in Propeller 1
I was just playing around with Beau's RTC emulator and it got me thinking... Okay call me a weirdo, but conceivably couldn't a individual use a crystal with a lower frequency and get more accurate timing? OR do they sell crystals with a better accuracy rating... I assume Beau used the standard 5mhz Parallax crystal, which has an error rate of +/- 30 parts per million. He claimed accuracy of 12 minutes per year, which isn't bad but could be better. Is there a crystal more accurate than that? Sorry if my question seems silly, but it would be really cool to implement time functions in software and not have to worry about an external RTC chip...

Comments

  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2011-05-07 22:38
    Yes, there are much better crystals, some better than 1 part in 10^7.
    And then there are the crystal oscillators.
    Some are temperature compensated.
    And even better yet, temperature controlled oven oscillators.
    Some are as good as 1 part in 10^9.
    Of course, the more accurate the more expensive.
    Duane
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-08 10:29
    @Duane... Cool. Do you have any links to these? Price is not really a concern:)
  • Mike GreenMike Green Posts: 23,101
    edited 2011-05-08 10:37
    Ravenkallen,
    The way you find these things is to search on-line catalogs from companies like DigiKey and Mouser. Try "crystal oscillator" first. You'll learn more about what's available by browsing the couple of catalog pages involved. You can also do a broader internet search. Dallas / Maxim makes a variety of oscillators, some of them temperature compensated.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-08 10:48
    Ditto Mike's comment. DigiKey's keyword and parametric search functions are nothing if not miraculous. Not only that, if you already know the part number, it's a great way to zoom to a datasheet without trudging through useless Google links to alldatasheet.com and others of that ilk.

    -Phil
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2011-05-08 11:08
    And don't forget Mouser. They have a good parts searching function also, not as good as DigiKey's though.
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2011-05-08 11:20
    I forgot to comment on your question about lower frequency being more accurate.
    In general, accuracy is independent of frequency.
    OK, PLL type clock sources can introduce gitter but that doesn't change the accuracy.
    Last, in general crystal oscillators in the 1 to 20MHz range or so tend to have higher accuracy at lower cost.
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-08 11:22
    Oh, thanks for the tip guys:) I must say i have never even bought stuff once from Digi-Key yet, but i will give them a shot... I did search the Mouser website and only a few things came up. Maybe i did it wrong... The general consensus is that type of crystal does exist though, right?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-05-08 11:36
    There are various combinations of things. You have basic crystals. You have crystals in little insulated ovens with thermostats to keep them at a steady temperature. You have crystals with the necessary components for an oscillator so you get a digital pulse stream. You have crystals in ovens plus an oscillator. You have crystals with an oscillator and temperature sensitive circuitry that adds or removes some pulses based on the temperature so the frequency is temperature compensated ... and on and on in combination.
  • PublisonPublison Posts: 12,366
    edited 2011-05-08 11:44
    Rav,

    Your'e better off looking at Digikey. Mouser has some stuff, but not as much as Digikey in the oscillator field. Do a search on Digikey for "oscillator", then narrow it down to the parts that have +/- ppb, that's Parts per Billion. That will get you some accuracy.

    Ordering from Digikey is as easy as Mouser. I use them both based on the price quotes and quantity available.



    Oh, thanks for the tip guys:) I must say i have never even bought stuff once from Digi-Key yet, but i will give them a shot... I did search the Mouser website and only a few things came up. Maybe i did it wrong... The general consensus is that type of crystal does exist though, right?
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-08 12:44
    Well, i found some crystals with a accuracy of 10 +/- PPM, but they are in a weird frequency and it wouldn't work with the Propeller's PPL.. The others they had were very similar to the one that Parallax sells. Unless i overlooked something, which is entirely likely:)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-08 12:54
    You could try something like what I did here (or simply use an external 32.768KHz oscillator). Another alternative is to calibrate your software RTC. This can be as simple as fudging the _XINFREQ value to match the actual frequency of the crystal, rather than the nominal frequency. The latter will eliminate the crystal's systematic error, but not its temperature variation.

    -Phil
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-08 15:27
    @Phil.... Ahh, good idea. I didn't even think of that. Is there an easy way to determine the variation in a crystal without watching it for an extended period of time?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-08 16:12
    Is there an easy way to determine the variation in a crystal without watching it for an extended period of time?
    Here're a couple ways that might work, without expensive calibration equipment or a GPS that outputs a 1 PPS signal:

    1. Generate an NTSC signal and tweak the timing until all the "creepie crawlies" disappear from the screen -- that is to say the diagonal crosshatching that causes a stable picture to shimmer.

    2. Tune a shortwave receiver to WWV at 10 MHz. Program a counter (using a PLL mode and starting from clkfreq for the frqa computation) to output a 10 MHz signal, and attach a short length of wire to the pin. Listen for the beat frequency between WWV and the counter on your radio. Adjust _XINFREQ until the beat frequency goes to zero.

    -Phil
  • RavenkallenRavenkallen Posts: 1,057
    edited 2011-05-10 05:23
    Option 1 sounds the most plausible, but i don't understand? Creepie crawlies?:)
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-05-10 07:56
    You'll know 'em when you see 'em. Just set _XINFREQ off by about 1%, and you'll see what I mean. Also for method two, you don't have to use a shortwave receiver. An AM radio will also work. Just find a strong station at the high end of the band, and generate a signal at its frequency. You won't get the same accuracy as you would with one at a higher frequency, but the principle is the same. Also, I'm not sure whether commercial stations are required to have the same frequency accuracy as that of WWV which, when received, is +/- 0.1 ppm.

    Whichever method you choose, test it afterwards against a longer-term time-keeping standard.

    -Phil
Sign In or Register to comment.