### Author Topic: Choosing Capacitors for a Crystal; Do I Have It Right?  (Read 335 times)

0 Members and 1 Guest are viewing this topic.

#### RJDog

• Contributor
• Posts: 16
• Country:
##### Choosing Capacitors for a Crystal; Do I Have It Right?
« on: Yesterday at 12:50:16 AM »
So under the assumption that just choosing a 22pF capacitor to go along with a 12MHz crystal as shown in so many Arduino examples might not be the most ideal choice, I started looking into what the right value might be.  What tipped me off was the fact that there seemed to be quite a number of variances in "Load Capacitance" for the same frequency.

The best information I have found seems to be  C = 2*CL - 2*Cstray.  So for this crystal http://www.digikey.ca/product-detail/en/ecs-inc/ECS-120-20-46X/XC1753-ND/2676583 the Load Capacitance is listed at 20pF... this seems to be a pretty common value.  But my question pertains really to Cstray... all of the examples use 5pF for that value but other resources say it could be anywhere from 3 to 5pF.  How do I know, calculate or even guess what Cstray should be?  Is the higher value of 5pF the "safe" choice?

Using what appears to be the "standard" value of 5pF, this gives C = 2*20 - 2*5 = 30pF, which is quite a bit higher than 22pF so I can only assume that if I were to have used a pair of 22pF caps that the accuracy of the 12Mhz crystal would have been off a bit.

#### Ian.M

• Super Contributor
• Posts: 3607
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #1 on: Yesterday at 02:03:16 AM »
Cstray is highly dependent on the physical circuit layout and the active device used.  5pF is at best a guesstimate.  Its quite difficult to measure as one has to remove the crystal, disable the active device that's providing the gain so it tristates its output, and keep its terminals biassed at 1/2 Vcc so that any internal protection diodes don't interfere with the reading.

The two capacitors in a Pierce oscillator circuit don't have to be equal, but a gross imbalance causes problems.  The formula is Cload=C1*C2/(C1+C2), but Cstray must be treated as part of C1 and C2 (hopefully its similar for both, unless you have a pathologically bad board layout).  Use the simpler formula to get the desired C for two identical caps, then see what comes closest to the correct Cload, next preferred value (alowing for Cstray) up or down or one of each.

Its possible to use a trimmer either to replace or in series with one of the caps, but that may not be good for long-term stability.  Another factor to consider is the temperature coefficient of the caps, and also of the crystal.

Nowadays, for digital applications, its always worth investigating if its possible to compensate for frequency errors in the software rather than trying to trim it spot-on.
« Last Edit: Yesterday at 02:04:54 AM by Ian.M »

#### RJDog

• Contributor
• Posts: 16
• Country:
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #2 on: Yesterday at 04:51:10 AM »
So, I should have asked this in my original post, but when we're talking about Cstray, we're talking about the miniscule amount of capacitance that is present just between the traces and nearby ground traces and planes?  Also known as parasitic capacitance?

The traces on my board for the crystal and capacitors are mirrored exactly, so I'm quite confident that choosing the same capacitor value is the correct choice.  Is there a way to estimate the stray capacitance?

I suppose a better question is, what is the consequence of selecting not the exactly right capacitor value?

#### MagicSmoker

• Frequent Contributor
• Posts: 466
• Country:
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #3 on: Yesterday at 09:51:34 AM »
So, I should have asked this in my original post, but when we're talking about Cstray, we're talking about the miniscule amount of capacitance that is present just between the traces and nearby ground traces and planes?  Also known as parasitic capacitance?

More or less. Also the pads and crystal package itself.

Is there a way to estimate the stray capacitance?

I suspect no one bothers trying to estimate Cstray for a crystal oscillator; if frequency is really that critical then use an OCXO (Oven Controlled Xtal Oscillator). Cstray is usually low enough that you can just use the recommended load capacitance* for the crystal, or the next closest standard value down. If the crystal doesn't oscillate when the first board is built then you can tweak the load capacitor values, but that is rarely a problem.

I suppose a better question is, what is the consequence of selecting not the exactly right capacitor value?

Generally speaking, increasing the loading capacitance pulls the frequency down (NB - "pulling" is commonly used jargon for adjusting a crystal's frequency, usually by varying the load capacitance), until a point is reached which causes the crystal to either stop oscillating, or results in damage (fracture of the crystal). Decreasing the load capacitance pulls the frequency up, until a point is reached where the crystal stops oscillating. So clearly the consequences of too much loading capacitance are more severe than too little, but the range of "acceptable" capacitance can be surprisingly wide, particularly for crystals below, oh, 25MHz or so.

Which reminds me, crystals above 25MHz might use an overtone, rather than the fundamental, and these can be much more picky about the load capacitance. They also tend to be much less "pullable" as a result.

* - or twice the load capacitance for each capacitor, if there are capacitors to ground on either side of the crystal.
« Last Edit: Yesterday at 10:17:59 PM by MagicSmoker »

#### T3sl4co1l

• Super Contributor
• Posts: 7497
• Country:
• Expert, Analog Electronics, PCB Layout, EMC
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #4 on: Yesterday at 06:03:45 PM »
Seven Transistor Labs, LLC
Electronic Design, from Concept to Layout.
Need engineering assistance? Drop me a message!

#### shteii01

• Regular Contributor
• Posts: 60
• Country:
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #5 on: Yesterday at 08:36:26 PM »

#### RJDog

• Contributor
• Posts: 16
• Country:
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #6 on: Today at 12:56:56 AM »
So clearly the consequences of too much loading capacitance are more severe than too little, but the range of "acceptable" capacitance can be surprisingly wide, particularly for crystals below, oh, 25MHz or so.
So, if I iterperet correctly, estimating a "higher" value for Cstray (e.g. 5pF) is safer than a low or 0 value for Cstray, as that would cause one to come up with a lower value for the accompanying caps?

E.g. for the crystal I linked with 20pF CL, 2 * CL = 40pF for the caps, but estimating Cstray at 5pF leads to cap value of 30pF, which should be a "safe" choice being below the default value of 40pF?

#### MagicSmoker

• Frequent Contributor
• Posts: 466
• Country:
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #7 on: Today at 01:12:21 AM »
...
E.g. for the crystal I linked with 20pF CL, 2 * CL = 40pF for the caps, but estimating Cstray at 5pF leads to cap value of 30pF, which should be a "safe" choice being below the default value of 40pF?

Yes, if you want to be really precise about something that cannot be estimated precisely... Personally, I'd use 33pF for each load capacitor because it is a more common value, but you will likely find that anything from 22pF to 47pF will work as well, with just a few tenths of a percent change in frequency. But don't take my word for it; try a few different capacitor values yourself, and for each value hit the crystal with freeze spray, as a marginal oscillator will often stop when cooled down below 0C.

#### TimFox

• Frequent Contributor
• Posts: 676
• Country:
• Retired, now restoring antique test equipment
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #8 on: Today at 01:14:14 AM »
You can always use a screwdriver-adjust trimmer capacitor as part of the total load capacitance and adjust it to get the correct frequency with a counter.

#### CJay

• Super Contributor
• Posts: 1039
• Country:
##### Re: Choosing Capacitors for a Crystal; Do I Have It Right?
« Reply #9 on: Today at 06:57:39 AM »
Isn't the biggest problem, after accuracy (which isn't likely to be great on a cheap microprocessor crystal anyway) reliability of starting?

Better to choose a lower value by calculating for max and min then picking mid range perhaps

Smf