Hiya,
Having used a Duo for some while now, I'm looking to build a breadboard ATmega based device.
Slightly confused about what values of capacitor to use with a 16MHz crystal. The Duo has 22pF caps, whereas this http://interface.khm.de/index.php/labor/experimente/sleep_watchdog_battery/ very bare implementation has no caps (The blue one in the pic is across the supply.) The crystal I am looking to use is referred to as 16.000 MHz HC49/S 30 pF. Does this mean I need to use 2 x 30pF caps, or, within reason, does it not matter? The supplier I am looking to order from has 22pF and 33pF but no 30pF caps. Also, these are refered to as NPO caps. Is this ok?
Strictly speaking the capacitors should be chosen to match the load capacitance the crystal is cut for. The ATmega8/168 and pretty much any other processor you might use for an Arduino or similar device will be designed for a parallel resonant crystal.
Parallel resonant crystals are 'cut' for use with specific load capacitance and at the frequencies we are most likely to use (4 - 20MHz or so) this value will be between about 18pf and 30pf. When used with the correct value of capacitance they will operate closer to the design frequency and with best stability. Generally speaking however the 22pf is a good compromise value as most of the crystals you are likely to find will be cut for 18pf, 20pf or 22pf, 30pf being somewhat rarer these days.
The crystal will work in most cases without the capacitors, but it may be well off frequency, be noisy or jittery and possibly unreliable in oscillation.
Strictly speaking the capacitors should be chosen to match the load capacitance the crystal is cut for.
The equation for the load capacitance of a parallel resonant crystal is as shown below where CL is the effective load capacitance (which should match the crystal's specification), CL1 and CL2 are the values of the physical load capacitors, and CS is the stray capacitance of the circuit.
CL = (CL1 * CL2) / (CL1 + CL2) + CS
Usually, the two load capacitors are equal in nominal value so simplifying and solving for the physical load capacitor value gives
CL1 = CL2 = 2 * (CL - CS)
The stray capacitance for a well designed circuit board is likely to be 3-5 pF (perhaps a bit higher for a solderless breadboard) so for a crystal with a specified 30pF load capacitance, you'd select a pair of loading caps with a nominal capacitance of about 50pF. The closest commonly available value is 47pF but you might be able to find 51pF or even 50pF values.
Don's equations are correct, but the 30pF capacitance that you (the OP) quoted is pretty far outside the normal range of such crystals; digikey doesn't list any 16MHz crystals with a load capacitance above 20pF, for instance, and assorted Atmel data sheets and Microchip App notes say that 17pF is "typical."
Almost everyone throws a couple of 18-22pf caps in there and has it work right, despite the fact that you SHOULD take a bit more care...
the item on the on-line suppliers site I'll probably be using is here
It is interesting to note that virtually all of the crystals available on that website indicate 30pF if any capacitance specification is given. It may be that the person who did this was confused and they actually meant "30 ppm". A few crystals do have the accuracy specification but no load capacitance specification.
I would recommend contacting the supplier and asking for a link to the manufacturer's datasheet or find a different supplier.
I suspect that one of the reasons that it is so common to have a crystal circuit where someone has just "thrown on" the "typical value" 18 or 22pF caps, rather than carefully analyzed the PCB with respect to the particular crystal they are using is that initial designs tend to be built based on crystals from "hobbyist" sources where there IS no detailed datasheet for the crystal.
The two 22pF caps from the arduino basic schematic will almost certainly work with any crystal you are likely to find from suppliers similar to the one mentioned in this thread. If you need "as much accuracy as you can get", you might want to buy a crystal from a supplier that does have a data sheet, and then carefully tune the cap value while watching a highly-calibrated scope and/or frequency counter. If you have a particularly "weird" capacitor (ultra mini smt, for instance), you might worry about it more...