Continue to Site

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.

  • 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.

How to Accurately Measure External Oscillator

Status
Not open for further replies.
If you put any load on the crystal, such as with the scope, you change its frequency. Is there an accepted and relatively easy way to determine its frequency more precisely in the MCU circuit?

Going back to this original question - the two terminals on the PIC are effectively IN and OUT - IN is high impedance and will be greatly affected by a scope probe - OUT is low impedance, and will be far less affected by a scope probe. Regardless you need to use at least a x10 probe , and a x100 will have even less effect.
 
I think you're over-imagining what the cheap RTC clock modules are :D

Assuming they do use special capacitors, then using the same capacitors on a PIC would give a similar result - the RTC's are just a chip with an external crystal and capacitor, just like TMR1 on a PIC.

Why do you imagine they are 'well engineered', and what do you mean by that?.

Hi Nigel,

Well it would really help for you to read one of the data sheets. They give more details than i can, especially about the temperature compensation, of which i dont remember how they actually do this. But think about it for a minute. Why did anyone invent crystal ovens? It's because they wanted a more stable clock than they could get from a crystal that was sitting out in the free ambient air which gets unpredictable temperature variations. To put this another way, imagine we have an oscillator with a single crystal sitting in the free air with no temperature compensation, and another oscillator that is synced to the atomic clock. Which one is better :)
But you may be satisfied with the free air crystal. I wasnt so i had to move to a RTC SMD part. I hated having to make a board for that little thing though. I used it as a clock source for real time keeping interfaced to a PIC.
From what i remember, the RTC chips (the right ones i guess) have better specs (PPM) than pure crystals which dont have any form of dynamic compensation.
 
Hi Nigel,

Well it would really help for you to read one of the data sheets. They give more details than i can, especially about the temperature compensation, of which i dont remember how they actually do this. But think about it for a minute. Why did anyone invent crystal ovens? It's because they wanted a more stable clock than they could get from a crystal that was sitting out in the free ambient air which gets unpredictable temperature variations. To put this another way, imagine we have an oscillator with a single crystal sitting in the free air with no temperature compensation, and another oscillator that is synced to the atomic clock. Which one is better :)
But you may be satisfied with the free air crystal. I wasnt so i had to move to a RTC SMD part. I hated having to make a board for that little thing though. I used it as a clock source for real time keeping interfaced to a PIC.
From what i remember, the RTC chips (the right ones i guess) have better specs (PPM) than pure crystals which dont have any form of dynamic compensation.

Sorry, but I'm dubious about such claims on cheap Chinese products :D

The 32KHz clock crystals were chosen both for their convenient frequency, making it easy to divide down to 1Hz, but also because it's a good choice for stability.

So what kind of accuracy are you looking for?.

If you want accuracy, then sync to an atomic clock as you suggest.
 
Hi Nigel,

Well it would really help for you to read one of the data sheets.

Well, I did just that for the AMS AS1801 RTC ( https://media.digikey.com/pdf/Data Sheets/Austriamicrosystems PDFs/AS1801.pdf ).

Frequency change with temperature ( 0°C to 50°C) is about 20 ppm or about 2/3 second per year. They allow relatively easy adjustment to a time standard, but they are no more stable than a regular crystal with respect to temperature. This crystal (https://www.abracon.com/Resonators/abs25.pdf ) ,for example, shows a ppm/degree error of 15 ppm over the same range (0 to 50 degrees Celsius).

As I see it, the real advantages of RTC's is that you can trim them in software to the correct frequency, and they have selectable output frequencies.

John

Edit: The above ppm calculations are incorrect. One ppm is approximately 30 seconds per year. See post #25.
 
Last edited:
Hi again John and Nigel,

John:
That device you linked to is not strictly speaking an RTC. It's only part of an RTC circuit. A true RTC will be self contained and not require any external crystal. Also, i think you'll need to review at your calculations for long term time errors.

I think first we have to clear up some misconceptions about crystal oscillators and how they perform when used in the real time clock circuit applications.

First, Nigel brought up a good point embodied in the question, "What accuracy are you looking for?". The first thing we have to think about is just how good do we want this thing. I wont try to decide that for everyone but for me i wanted "the best i could get" without going to atomic or GPS or any other implementation that would require a receiver of some type. You have to decide for yourself what you consider good timing over whatever time you consider long enough. I wanted good one-year timing so i would not have to reset the clock more than once per year, if at all. Your requirement could be less, or more stringent.

Next we get to the basic calculations that tell us what we have to look for in either a crystal or self-contained RTC.

Since most if not all of these timing devices are rated in terms of PPM (parts per million), and because the PPM affects the long term accuracy, we could use the PPM spec to determine what long term timing error we might expect.

There are at least two separate PPM spec's:
1. Initial non adjusted PPM spec
2. Temperature PPM spec

but first we could look at what PPM does to the long term timing in general, then look at the individual variations.

For wall clock timing, a quick estimate of the error over one year boils down to simply:
Error=PPM/2

where
'Error' is the error in minutes over one year, and
'PPM' is the parts per million variation of the crystal or RTC.

For a typical crystal with an initial non adjusted spec of 20PPM, that means if the crystal was off by the full spec and ran that way for a full year, we would see an error in the clock indication of 10 minutes. That is also often quoted as an approximate 1 minute per month.

But most applications will have a way to adjust the initial crystal accuracy, so in theory we could adjust this down to zero, or lets say 1 second per month depending on what technique we use to adjust.
The problem that comes up with that though is that the initial adjustment has to be made at some initial temperature, and once the circuit changes temperature the frequency changes. This frequency variation is due mostly to the crystal variation and the load caps used for that crystal. What else is unfortunate is that the error with temperature is accumulative. That means that if the oscillator changes temperature by +10 degrees C and then goes back down by -10 degrees C (back to the original adjusted temperature) the error does not go away. This is probably expected though. What might not be expected is that if the oscillator then goes down by another -10 degrees (now at -10 C from the original adjusted temperature) the error still goes up. It does not even out the error from when it went up by +10 degrees C. This is due to the way the crystal construction itself responds to temperature, and is probably one of the most troubling properties of a crystal. This brings us to the second spec.

The spec for the change with temperature for a typical crystal could be 100PPM, which is 5 times the non adjusted spec. This means the crystal changes frequency quite a bit with temperature. If we adjust at 25 deg C and then the temperature goes up to the end of the range (probably not reasonable though) we would see a variation of 100PPM which if we use the rough guide formula we get:
Error(minutes per year)=100/2=50 minutes per year
which is almost an hour!
Divided by 12 and we get roughly 4 minutes per month.

By contrast, a good RTC can do 2PPM, which would result in 2/2=1 minutes per year, or 5 seconds per month. It would also hold that accuracy over a fairly wide temperature variation.

A good thing to do would be to look up the data sheet for a real self contained RTC. The part number will probably start with "DS".

Yearly error factor calculation notes...
[1]
The calculation for seconds per year comes out to about 31e 6, which is 31 million.
A 1MHz crystal off by +20PPM will result in a frequency of 1000020 Hz, an error factor of 1.000020 which is 20ppm. Multiplied by 31e6 we get about 10 minutes error for a year.
[2]
The physical reason for the error accumulation is because the frequency/temperature characteristic is parabolic in nature rather than monotonic. There is also no reason to believe that our applications temperature would go plus and minus (and thus average to zero) over time anyway.
[3]
DS3234: 2.0PPM over 0 to 40 deg C, 3.5PPM otherwise
 
Last edited:
I agree my error calculations were wrong. I was not feeling well, but went to bed anyway still worried about them. Of course, a year is 31.5 million seconds.

John
 
Actually an average year is 31,557,600 seconds - just a figure I 'happen to remember'

Due to the Earth's rotation is slowing down we have to add a 'leap second' every few years.

E

Extract:
Since 1972, a total of 25 seconds have been added. This means that the Earth has slowed down 25 seconds compared to atomic time since then. This does not mean that days are 25 seconds longer nowadays. Only the days on which the leap seconds are inserted have 86,401 instead of the usual 86,400 seconds.
 
A 4x2 section of pinheader with some pins removed, a small piece of strip board with 3-holes per pad, one 32 kHz crystal, two SMD capacitors, a small piece of wire, and some solder to hold it all together.

John
 
I agree my error calculations were wrong. I was not feeling well, but went to bed anyway still worried about them. Of course, a year is 31.5 million seconds.

John

Hi John,

Oh, sorry to hear that. I hope you feel better soon. Order out for some chicken soup and tea :)
For a sore throat brandy works wonders if caught soon enough.
 
MikeMl

Hi Mike,

I have been looking around for affordable receivers to try your suggestion. Can you recommend any modern (non-tube) units that might be had for <$500 (even less is better)? I am definitely not adverse to getting a used unit. Are the tuners alone available? Despite the lure of Ham radio since my early years, I never got into doing it.

Regards, John
 
If you can get hold of one, the Lowe Electronics series were excellent receivers:



I work in the same small town as they were made, I knew both designers, and had a close association with Lowe Electronics.

Funnily enough, I took old Mr Lowe (who started the company) a new TV just the other week. I'm not sure how old he is, but I took him his previous set about 7 years ago and he didn't really look any older :D
 
Funnily enough, I took old Mr Lowe (who started the company) a new TV just the other week. I'm not sure how old he is, but I took him his previous set about 7 years ago and he didn't really look any older :D
He looked old (to me) when I met him in his shop in 1970!

JimB
 
Mr Al can used gps disciplined standard ref oscillator if he has access to and lock the counter time base with gps .

I had an occasion to measure and adjust the Alcatel E10B electronic switch clocks to a single reference to meet data and modem service improvement.
My frequency counter was not up to mark.
then I had to seek clock from the zonal headquarters on the o f cable . sync my counter time base and then quickly use it to measure the digital switch master clocks .
All that was possible as I was working in a telecom psu
 
Hi Nigel, Those Lowe units are prized even today. The HF-150 units on US eBay are selling for more than they were new (https://www.ebay.com/sch/i.html?_fr...RC0.A0.H0.TRS5&_nkw=lowe+hf+receiver&_sacat=0 ).

Just an update on the Banggood RTC recommended by Eric. Mine (3) arrived today. After unpacking and just plugging one in, it read 32768.001 ± 0.0005 Hz on my Racal-Dana 1992. That counter has not been calibrated in at least 10 years, so I can't say how accurate it is, but it is impressively stable right out of the box. Certainly adequate for my needs. I was also pleased with Banggood's side of the transaction. The order was processed and received in Chicago in less time than it took to get from Chicago to Cleveland.

John
 
Those Lowe receivers seem overpriced.

Look at this:
**broken link removed**
From the wilds of North Dakota, much better value for money.

JimB
 
He looked old (to me) when I met him in his shop in 1970!

Would that have been in the 'wooden hut' at the end of Cavendish Road :D

As you say, he looked old back when I first met him as well - probably 72/73?.

Interestingly he used to live and work in Canada, the only reason I know is he has an aerial photo of 'utter destruction' on his wall, and he saw me looking at it. So I asked him what it was, and it was a mine in Canada he used to work at - he opened Lowe Electronics when he came back from Canada (presumably with the money he made there?).
 
Would that have been in the 'wooden hut' at the end of Cavendish Road
This was basically an ordinary shop on a steep hill in Matlock.

The last time that I was at Lowe Electronics in the mid 1980s, he had a new place outside Matlock where you reached the shop on the upper floor by walking across a foot bridge from the carpark by the side of the road.
A curious building built on the side of a hill.

JimB
 
MikeMl

Hi Mike,

I have been looking around for affordable receivers to try your suggestion. Can you recommend any modern (non-tube) units that might be had for <$500 (even less is better)? I am definitely not adverse to getting a used unit. Are the tuners alone available? Despite the lure of Ham radio since my early years, I never got into doing it.

Regards, John
I have owned one of these for years and years. There was also a R600 and R2000 version.

I consider it a useful piece of test gear that gets used for all kinds of things, including an IF for some VHF and UHF converters. It runs on either 120Vac or 12Vdc, so when looking for sources of RFI in the neighborhood, I stick it in the car and power it with a cigar-lighter cord. It is very useful for testing the RFI produced by SMPS wall-warts and power supplies.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top