1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

How to Accurately Measure External Oscillator

Discussion in 'Microcontrollers' started by jpanhalt, Sep 17, 2015.

  1. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE
    Well my RTC boards arrived this morning:

    Bangood4.jpg

    Oops! :arghh:
     
  2. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,900
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE
    Ouch! Were they shipped though New York ? ;)

    If you ordered through Banggood, I suspect it will replace them. I have been paying the extra $1.30 to get tracking. Not sure it really helps, but so far, no problems with US mashers, and it seems just a little faster.

    John
     
  3. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,329
    Likes:
    585
    Location:
    Peterhead, Scotland
    ONLINE
    No problem, they just need de-fragging!

    JimB
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE

    They are issuing me credit.
     
  6. Andrei_D12

    Andrei_D12 Active Member

    Joined:
    Aug 23, 2015
    Messages:
    177
    Likes:
    43
    Location:
    Craiova, Romania
    Hi!
    That image just shocked me. The modules look like they were put under the wheel of a truck. I'm curious how were they packed!!!
     
  7. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE
    They were all loose together, with two layers of thin foam wrapped around them, slid into a thin black plastic bag.

    Basically as they weren't protected they have crushed against each other - presumably very badly treated somewhere on their journey (the UK post doesn't do this sort of thing).
     
  8. Andrei_D12

    Andrei_D12 Active Member

    Joined:
    Aug 23, 2015
    Messages:
    177
    Likes:
    43
    Location:
    Craiova, Romania
    So they were all in one bag, no separate cover for each module. But I can imagine what force these modules were supposed to resist...
     
  9. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,031
    Likes:
    952
    Location:
    NJ
    Hi,

    It's obvious what happened here as this is a standard procedure. They send the boards first to the LHC in order to find out if there really is a time particle. They smash two RTC clock boards together at near light speed to see if they break down into their constituents one of which might be the elusive Chroniton (the time particle). :) :)

    Hope you get new boards soon.
     
  10. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,900
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE
    Nigel,

    The three boards I got were each in a sealed bubble-wrap packet, and the three packets were then warped together in additional foam. The outer wrapping was as you describe.

    Quality Control?

    John
     
  11. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,228
    Likes:
    641
    Location:
    Derbyshire, UK
    ONLINE
    I suppose it depends where they come from?, the label on the bag is actually marked Malaysia.
     
  12. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
  13. Andrei_D12

    Andrei_D12 Active Member

    Joined:
    Aug 23, 2015
    Messages:
    177
    Likes:
    43
    Location:
    Craiova, Romania
    There are many ways to pack some fragile components in order to protect them. Lets say that a careless employee drops these RTC modules on a solid floor, it can happen, but, seriously, broken PCBs and batteries with bent case aren' t the result of dropping them on a floor, or accidentally putting something heavy on them. Or these circuits are more fragile than I can imagine....
     
  14. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    I wonder if customs people were told to damage anything that looks like it could be used to make a time bomb. Now the ABC homeland security may have you on their watch list.
     
    • Like Like x 1
  15. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    The only way to test a crystal is to simulate the test specifications from the OEM.
    The counter must be at least 10 times more accurate than the expected accuracy.

    Normally a good design has about 3 to 5pF stray capacitance included in the design assumptions for fix cap selection and only 1% NP0 (COG) temp stable caps are used.
    http://www.ebay.com/itm/Digital-LED...ter-DIY-Kit-/351374760137?hash=item51cf9158c9
    This (reposted) unit could be used for convenience after it has been calibrated for a limited room temp range, and verified for load capacitance matching specs and nulled to within 1ppm for 25'C ( They ship spare caps for different std. CMOS/XTAL parts to extend range of trimmer.) It has an easy socket for Xtals and a buffered logic signal out for external counter and onboard 4 digit counter. (cheap) Calibrating the board would then require a gold standard Xtal or a capacitance meter to verify the accuracy of the load and the error of the gold std. xtal.

    Since it is unlikely you have these, all you need to do is choose the right fixed caps on board ( soldered radial NP0) and see that you can achieve the marked value on the can within the specified "Tolerance" in the datasheet or the error can be nulled with a trimmer, which is included in all watches.

    The 32kHz tuning fork have negative parabolic 2nd order curve so the maximum frequency is cut to 25'C suitable for watches worn on wrist with the specified tuning cap and adjust for tolerance errors.

    This is also the maximally flat tempco part of the curve unless offset by errors in cut angle. AT Xtals in the MHz have a 3rd order characteristic.
     
  16. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,031
    Likes:
    952
    Location:
    NJ
    Hello again,

    A quick little 'clock' test this morning on an Arduino Uno set up with a sketch that shows time since last reset showed an error of 4 seconds over a test period of 71 minutes. That's an error of about 900 parts per million. Just goes to show how bad it can be sometimes.
    These tests are easy to do if you have the time to let it run for several hours.
     
  17. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    MrAI I suppose that is using a software interrupt vs an RTC or ?
    TimedAction timer = TimedAction(1000,clockUpdate);

    So the question next is ... do you think it is some logic error or an XTAL error or excess capacitance loading? ( I assumed it was slow)
     
  18. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    In the old days mechanical watches were calibrated in seconds by using the tick sound converted to a narrow pulse to sample the phase of a tuning fork reference. (as long as the tick sound was accurately detected for peak to a pulse much smaller than the wavelength of the reference and is equal in f or a subharmonic of some crystal reference.
    The phase error was then plotted on mini-thermal printer.
    Any slope to the phase error would indicate a frequency error and the watch repair guy could tune it in seconds.

    I have used the same principle in Doppler tracking of scientific rockets and 4Mbps PLL clock sync designs, many times.

    Use a trimmed 10MHz crystal oscillator (XO) trimmed to any better reference (VLF, WWVB, GPS, OCXO etc) ,

    If you dont own a frequency counter, you can buy one or make an analog measurement do the same quickly. Essentially using any known reference frequency can be use dto measure an unknown clock and measured quickly depending with ppm resolution using a DMM and an analog or digital mixer.

    e.g.
    Convert XO sine or squarewave to sawtooth.
    Then using selectable counter divider PLL simple breadboard, choose the reference clock to match the DUT clock or harmonic to match, such that the harmonic frequency difference is zero.

    e.g. if you had a 2MHz XO being tested use a std calibrated 10MHz XO and either divide by 5 or use square to sawtooth and S&H as a phase detector to measure phase asa voltage with DMM, then null slope on trimcap on DUT clock so you get a steady intermediate voltage.

    e.g. if you had 1 Hz clock, use an XOR gate with RC delay on one side to make a narrow edge detector and frequency doubler as well as sample pulse for a 1MHz sawtooth.
    Now you get 1 PPM resolution full scale every tick of the clock on your DMM.

    e.g. if you are measuring unknown clock frequencies, then using a dial-a frequency synthesizer with BCD thumbwheel presets to BCD counters from 1MHz clock say and compare the beat frequency for null.
     
    Last edited: Oct 16, 2015
  19. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,031
    Likes:
    952
    Location:
    NJ
    Hi,

    Yes it looks like an XTAL error, but i have not tracked it down.
    To adjust i would have to add about 1 second every 10 minutes. This is similar to what i would see with a PIC and 4MHz crystal without any adjustment.
    This wasnt really intended to be a Real Time Clock software, just a quick test to see where the board was running frequency wise. Curiosity more than anything else.

    From what i have read the "millis()" function was once off by 24 microseconds per millisecond because of the non power-of-two whole integer divide down to 1ms of a 16MHz crystal, but from what i understand that had been corrected in later updates of the IDE source files.
     
  20. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,151
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    Most common XTAL error is using a Series Xtal in a parallel application and 900 ppm off sounds about right to me.
    I was never able to pull an AT cut Colpits design (Par. mode not series) more than +/400ppm with a varicap.
     
  21. Diver300

    Diver300 Well-Known Member

    Joined:
    Oct 19, 2007
    Messages:
    3,067
    Likes:
    101
    Location:
    England
    You can sometime get wide pulling ranges by running near series and adding an inductor in series with the varicap.
    The hyperabrupt varicaps give a lot better pulling, especially if the control voltage is limited.
    Having said that, when I was making VCXOs, anything over ±250 ppm was difficult, when trying to get reasonable stability.
     

Share This Page