16MHz Crystal selection for ATMega328P

Hi everyone,

I am trying to move my next Arduino project to my own designed printed circuit board using the ATMega328P. I however got a bit overwhelmed when looking for a 16MHz crystal for the ATMega328P. I am still quite new to electronics, but what I know is that Crystals allow the processor IC to count and define a cycle. However when looking on the internet I found specs like "load capacitance" "frequency tolerance" and "ESR" for which I was not sure what my ATMega328P would prefer to run on.

The data sheet of the ATMega328P does not make things much clearer for me in section 9 starting on page 36.

For now my schematic looks like this:

For the crystal I have selected: Yangxing Tech|Yangxing Tech X49SM16MSD2SC|SMD Crystal Resonators|LCSC

And for the capacitors I have selected 2 of these: FH(Guangdong Fenghua Advanced Tech)|FH(Guangdong Fenghua Advanced Tech) 0805CG220J500NT|Multilayer Ceramic Capacitors MLCC - SMD/SMT|LCSC

Will these components above work for me? Could someone clarify the specs so that I can modify my selection or make a more sensible decision in the future?

Most chrystals oscillators use small capacitors in order to oscillate properly..

was not sure what my ATMega328P would prefer to run on.

The Arduino is not very particular and will run on just about any crystal.

You should match the capacitors to the crystal you use (see the crystal data sheet), but the values are not very critical.

jremington:
The Arduino is not very particular and will run on just about any crystal.

You should match the capacitors to the crystal you use (see the crystal data sheet), but the values are not very critical.

Accidentally clicked on post instead of preview while forging my original question. See the schematic and links above :slight_smile:

Which load capacitance option did you select for the crystal?

Keep in mind that this is the total load capacitance, which includes the PCB trace capacitance (typically a few pF).

The crystal sees those two 22pf (NPO/COG) capacitors in series as an 11pf load.
The remaining ~9pf (for a 20pf load) is the chip and circuit board capacitance.
Keep traces between chip/crystal/ground sort-ish.

The wrong capacitive load makes the crystal oscillate on a slightly higher/lower frequency, which is not a problem for most projects. Most Arduinos use ceramic resonator (not a crystal) that is off frequency and temp dependent waaay more than a crystal ever will be.
The only problem with the wrong load could be that the oscillator won't start, or start slower.
Leo..

jremington:
Which load capacitance option did you select for the crystal?

Keep in mind that this is the total load capacitance, which includes the PCB trace capacitance (typically a few pF).

For the crystal in my first post I have selected a load capacitance of 20pF a frequency tolerance ±20ppm and an equivalent series resistance of 40 Ohm(Max). Does that seem right to you?

Wawa:
The crystal sees those two 22pf (NPO/COG) capacitors in series as an 11pf load.
The remaining ~9pf (for a 20pf load) is the chip and circuit board capacitance.

To my understanding these two 22pF C0G capacitors below are not in series. Could you please explain?

Wawa:
The wrong capacitive load makes the crystal oscillate on a slightly higher/lower frequency, which is not a problem for most projects. Most Arduinos use ceramic resonator (not a crystal) that is off frequency and temp dependent waaay more than a crystal ever will be.
The only problem with the wrong load could be that the oscillator won't start, or start slower.

I found some people use this resonator in their projects.
However, as I understand from your answer crystals are in fact often superior and are more stable than ceramic resonators. What would a good load in your opinion. Please share your calculation :smiley:

See this

Budvar10:
See this
Choosing the Right Crystal and Caps for your Design « Adafruit Industries – Makers, hackers, artists, designers and engineers!

Awesome link Budvar10!

Using adafruit's rule of thumb: C1, C2 = 2CL – 2Cstray
220-25 = 30pF

So this capacitor would do a better job here.

However the info on adafruit's website was very clear. The data sheet remains to be confusing as there are many frequencies mentioned. Actually none of which mention a 16MHz crystal which I took as a starting point from an arduino nano schematic I found which also uses the atmega328P.
In table 9.3 of the data sheet on page 39. It is mentioned that for a frequency range for 8.0 - 16.0 MHz the recommended range for capacitor C1 and C2 = 12 - 22 pF. Which is below the calculated 30pF above :confused:
I feel like we're slowly getting there :slight_smile:

I would not go above 22pF. So 22p is fine.

1 Like

TheAliw1:
To my understanding these two 22pF C0G capacitors below are not in series. Could you please explain?

Imagine no Atmega and no ground between the capacitors.
All you have left is the crystal and the two capacitors in series across the crystal.
Two 22pf in series = 11pf.
Leo…

I have been reading many forum posts on different forums that ask about the same question I asked here. It has been a frustrating process to find a straight answer. Many sources on the internet just specify a 16MHz crystal without specifying the load capacitance of the crystal they use. In the end I see a lot of sources just say 16MHz and two 22pF.

I found one source that clearly references the specs of the crystal with proof it works. It was Julian Ilett’s video linked here. He very kindly specified the source from where he bought the crystal in the description of the video in which we find that he used a HC-49S, 16MHz, 20pF load capacitance, frequency tolerance of +/- 20ppm.

Finally!! :smiley:

I have seen the HC-49S come across more often in other projects so I decided to just go with this one.

As for the decision to go for a crystal over a resonator I reference this video by Derek Molloy. He explains that over time the timing of resonators might become offset and might pose difficulty when communicating between chips. I am planning to communicate over bluetooth to another chip in this project in the future so that’s why I want to stay with the crystal.
However, as he explained resonators have a capacitive element built in which eliminate the need for external capacitors.

Furthermore just one question persists. I was wondering if multilayer ceramic caps are suitable instead of the through hole ceramic capacitors everybody is using. From what I understood from this discussion any NP0 multilayer ceramic capacitor will work sufficiently.

Hope that by sharing what I found I help people looking for the same answers in the future.

If someone could provide us with more in depth knowledge in case I got something wrong please let us know!

You seem to be overthinking this.
For most projects (including serial communication) it won't matter if that clock frequency of 16Mhz is a bit off.
Therefore you see a resonator (cheaper, and maybe lower power draw) on most Arduinos.
It only matters if you have a project that needs accurate/consistent timing, like a sports timing gate.

It does not matter if the caps are through-hole or smd, as long as they are listed as NPO or COG (temp independent).
Leo..

I have been reading many forum posts on different forums that ask about the same question I asked here. It has been a frustrating process to find a straight answer. Many sources on the internet just specify a 16MHz crystal without specifying the load capacitance of the crystal they use. In the end I see a lot of sources just say 16MHz and two 22pF.

It can depend on MCU type, exactly its oscillator circuit. Some are without caps some not. Datasheet for ATmega328P definitely says the capacitors are needed. The value is not so important but should be within recommended range. It has impact to frequency offset, slightly higher or lower, as was mentioned above.

If precise timing is needed, like for clock application, then it is better to use RTC circuit or to use 32768Hz clock crystal. However, 328P shares pins for main crystal and clock crystal and in adition 32kHz is too slow for performance. Usually it is solved by using of separate RTC like DS3231 with 1Hz output to INT input of 328P.

I think, more important for you could be PCB design.
Try this:
http://ww1.microchip.com/downloads/en/appnotes/atmel-2521-avr-hardware-design-considerations_applicationnote_avr042.pdf

TheAliw1:
I am planning to communicate over bluetooth to another chip in this project in the future so that's why I want to stay with the crystal.

Maybe you should use an ESP32 module for your secret project.
Crystal controlled processor and BT in one.
Leo..