Learning to design your own PCBs and being able to put together a schematic to solve a specific problem is both a valuable and rewarding skill. There are a number of resources out there to help you avoid common mistakes, but it isn’t always obvious to know where the values of certain common components come from, particularly common parts like resistors and capacitors. Figuring this out is part of the learning process, but it isn’t always easy to know where to look since you first need to know exactly the right terms to search for.
One good example that I haven’t seen a lot of attention paid to is deciding which crystal to use for your board and which caps go with it. Most people just copy and paste what they found on some other schematic (“12MHz + 22pF? … sounds good!”). Unfortunately, if you want to get accurate and stable results out of the crystal, you need to match the capacitors to the specific crystal you chose, and it varies from model to model even with the same manufacturer. Fortunately, it’s trivial to calculate the right capacitors for your crystal.
A 12MHz crystal that I use quite a bit is the NX3225SA-12.000000MHZ from NDK. It’s a good size, stable (+/-15 ppm), and easy to find. I use the more expensive +/-15 ppm model for better input to the PLL, but if you don’t use the right capacitors along with the crystal your signal will never be anything remotely close to +/-15ppm and you may as well buy a much cheaper crystal.
So how do you know which capacitors to use? Easy. Every crystal datasheet lists something called the Load Capacitance (CL). In the case of the crystal above, it’s 8 pF. C1 and C2 need to match this Load Capacitance, with the following formula being the key:
CL = (C1 * C2) / (C1 + C2) + Cstray
C1 and C2 are the two capacitors that you see attached to the crystal, but you might be wondering what Cstray is. Unfortunately, every trace, every lead on your component, just about everything on your PCB has some stray capacitance. The total of these values is represented by Cstray. You can usually guestimate this in the neighbourhood of 2-5pF as long as you follow good layout practice and keep the trace from the crystal to the pins on the MCU as short as possible with no vias, etc.
We know CL since it’s stated in the crystal datasheet (8 pF), and we know Cstray (say ~5 pF), so all we need to do is test our value for C1 and C2 to make sure that it will match CL taking into account Cstray. A commonly tossed around rule of thumb is to start with a pair of capacitors two times the CL of the crystal, which will get you to CL. In this case, that would be 2*8 pF = 16pF for the capacitors. Unfortunately, this ignores the stray capacitance (Cstray), and won’t give you the best results. Even if you are guestimating Cstray you will get better results taking it into account, but it means just using a capacitor 2* CL won’t work:
CL = 8 pF
C1, C2 = 16 pF
Cstray = 5pF
(16 pF * 16 pF)/(16 pF + 16 pF) + 5 pF= 13 pF
13pF is much too high to get the best results from your crystal. If instead of 16pF, we take a lower 6 pF value this will give much better results:
(6pF * 6pF)/(6 pF + 6 pF) + 5 pF =8 pF
If you think the stray capacitance is a bit lower, say 3pF, you might try a 10pF capacitor:
(10 pF * 10 pF)/(10 pF + 10 pF) + 3 pF = 8pF
There’s an obvious tradeoff between choosing a standard capacitor value, and having a good idea of what your Cstray is, but the above formula should at least explain HOW to determine what value those capacitors should be relative to your crystal. Even using a ballpark Cstray plud good layout should give you far more accurate results than just copying and pasting a value you saw on another schematic unless you’re using the exact same crystal model (which is unlikely since they are rarely even listed in the schematic).
A better rule of thumb is: C1, C2 = 2*CL – 2*Cstray
AN2867 – Oscillator design guide (ST Microcontrollers)
Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.
Join us every Wednesday night at 8pm ET for Ask an Engineer!
Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground” – Adafruit’s Apps!
Maker Business — Lessons Learned Scaling Airbnb 100X
Wearables — Start with a sketch
Electronics — When do I use X10?
Biohacking — Project Peri – Translates Sound into Light for the Hearing Impaired
Sorry, the comment form is closed at this time.