Standalone ATMega328 Crystal Selection

Hi All,

Breadboarding the ATMega328.

Needing some clarity.

Upon reading the ArduinoToBreadboard article, it states:
a 16 MHz crystal,
a 10k resistor, and
two 18 to 22 picofarad (ceramic) capacitors.

However, Not all the required info is provided in the article parts list to make a crystal selection ...

  1. What is the correct:
    Tolerance
    Frequency Stability
    Load Capacitance

  2. Does the Load Capacitance define the PicoFarad for the Caps ??

Sorry, Tried searching with no definitive answer and tried finding this info in the datasheet, unfortunately I have not the education to comprehend the cryptology of datasheets!

Thanks

-Enjoy
fh : )_~

I use these two parts without any problems.
http://www.dipmicro.com/store/XC7-16000
http://www.dipmicro.com/store/C1K22-1000

I believe the circuit is pretty tolerant of variance in value.
I've built a bunch with wirewrap, which you would think would add a lot of capacitance and probably some inductance, and I've built a lot using PCBs with the same parts, and also with surface mount caps. I haven't noted any differences in operation, even at 115K serial speeds to a USB/Serial adapter module.

Much Thanks ...

Be nice if folks would write their articles/tutorials clearly and concise without ambiguity for those that they are writing them for ... us that do not know!

-Enjoy
fh : )_~

Or get hold of a 16Mhz resonator and forget about the extra components.

The reason for the perceived ambiguity is that it really isn't all that critical and a variety of components will work with no percepable change in performance unless you are really pushing things and need a certain set of parameters to be held to closely. Different capacitor values will affect teh timing of the crystal. If you are using the Arduino for some application where you need closer timing then you would have to adjust those components. For most playing/experimenting close enough is better than we need.

Do you absolutely need 16 MHz? You can skip both the crystal and resonator if you just ran on the internal 8 MHz resonator.

You don't need the 10 kilo-ohm resistor, there's an internal pull-up built into the ATmega already

There were numerous discussions in the old forum of erratic operation in standalone designs that were solved by adding the 10K pullup to compensate for the weak internal reset pullup, as the Arduino designs do.

This Atmel Application note also suggests the use of an external 10K pullup when an external reset switch is connected.
http://www.atmel.com/Images/doc8278.pdf

The purpose of a tutorial is to educate, ambiguity causes misinformation, misinformation inhibits quality education.

One needs to be taught what is proper and correct, what one does from there is up to them.
If they were given the proper and correct information then they have the ability to make an educated decision as to their choices.

Personally, I do not accept mediocrity, close enough is not good enough.
Right is right, Wrong is wrong and if it ain't right it's wrong!

As for what I need ... I am certain y'all could answer that better then I without even knowing what I'm trying to do, I know very little about electronics at circuit level, but I'm gaining.

I have ordered according to the specs of the components CrossRoads linked, I suspect they'll work just fine.

Thanks y'all

-Enjoy
fh : )_~

The correct answer is : "In general it does not matter ..."
Although there's less ambiguity, it's definitely wrong to say " You need a 16MHz crystal of max 20 ppm, and capacitors of 20 pF with max 5% "

Why would you say that is wrong?

In appearance it seems correct. (I don't have a clue if the numbers are technically correct . :frowning: )

But those numbers would of had me on my way (blindly) without any need of assistance. (and IMO wasting y'alls time)

I really didn't have a clue that it was not that critical, I'm from a world where if it's a bit off, it won't work, period!

Thanks

-Enjoy
fh : )_~

here's the math formula for the capacitor calculation you asked for earlier

it's from this page

Right is right, Wrong is wrong and if it ain't right it's wrong!

and the closer you get to zero the harder it is. Electronics is not perfect, and those cherry numbers in the datasheet will not match exactly whats in your hand, nor will it match the identical part in the other hand even if they are made one right after another... Depending on what degree of accuracy it will never be "right", it will be "close enough".

Its just one of those things you have to get, its always going to be a little loose when dealing with components, and while you can spend a ton of time getting everything exactly perfect, its not going to happen the next time you try it, even with the same parts! Due to wiring, materials, environmental factors and 3 particles of dust floating by neptune type stuff (again within you expectancy of accuracy)

Now I do totally agree with you with your points in regards to the tutorial, and your attitude to learn how to do it right is very commendable, Right IS right, Wrong IS wrong, BUT there is a big fat spectrum of grey as well. When your dealing with something measuring in one trillionth of a unit with a 15-20% tolerance, totally dependent on temperature, well its your sanity.

And close enough is close enough! Ever read the tolerances on some of your components? typically we use a resistor that is 10%, pay a bit more for 5% and a lot more for 1%. Capacitors can have tolerances like +10%, -50%.

While in the theoretical world it is easy to work with "ideal" components, out here in the real world we work with "actual" components. Don't have that 100 Ohm resistor, here's a 150, Yep, good enough for testing...

Tolerances - I used to be a machinist. we had tolerances on parts. Some guys would take all day to make a part that was dead on. I worked to the tolerances and could make 4 good parts that were all within tolerance and when installed no-one every knew the difference, except my 4 parts actually cost less because they took less time to make. Were they as good as the "perfect" part? as far as the machine was concerned they lasted just as long and did the same job as the other guys 1 part.

Good enough is generally good enough.

frank26080115:
Do you absolutely need 16 MHz? You can skip both the crystal and resonator if you just ran on the internal 8 MHz resonator.

You don't need the 10 kilo-ohm resistor, there's an internal pull-up built into the ATmega already

Yes you do.
Even if you don't want your end deal to have the 16 MHz crystal and the 10K pull-up with it all the time, you do need them at one point. Burning the bootloader. Whether you are programming it to use the 8MHz internal clock, your arduino needs to have that external 16MHz crystal to burn the bootloader with.

funkyguy4000:

frank26080115:
Do you absolutely need 16 MHz? You can skip both the crystal and resonator if you just ran on the internal 8 MHz resonator.

You don't need the 10 kilo-ohm resistor, there's an internal pull-up built into the ATmega already

Yes you do.
Even if you don't want your end deal to have the 16 MHz crystal and the 10K pull-up with it all the time, you do need them at one point. Burning the bootloader. Whether you are programming it to use the 8MHz internal clock, your arduino needs to have that external 16MHz crystal to burn the bootloader with.

No you don't, from factory, the RC oscillator is the default oscillator

That is from factory though, Not from sparkfun that already has a bootloader on it.
If you wish to use the bootloader, you need a 16MHz crystal during the burn.

I would personally just use a resonator. They are cheap and the frequency inaccuracy is generally mostly FUD.
The worst case error on a resonator is usually around 0.7%, usually much better.
This is a difference of 112KHz (usually less) which is reasonable. The internal RC oscillator is generally much worse then this.

Also claiming that it would be a problem with serial communication is also totally false since it would need to be atleast 5% off to affect it.

smeezekitty:
The worst case error on a resonator is usually around 0.7%, usually much better.

Not that it matters much for this discussion but the resonator on my UNO is almost 2% too slow. I can actually tune the internal oscillator to be more accurate (just less than 0.2%).

smeezekitty:
I would personally just use a resonator. They are cheap and the frequency inaccuracy is generally mostly FUD.

A little while ago I made some measurements of frequency error and stability, comparing a resonator and a crystal. The results are here:

Whether these errors are important depends on your application.

Strange... Maybe they should consider getting a better resonator. The parts I found on digikey were spec'd between 0.5% and 1% maximum error.

0.7% should allow for a change of 7000 PPM. Although this is quite a bit, it really only matters for precise timing applications of frequency generation.

the resonator on my UNO is almost 2% too slow.

That should be way out of spec. I read typical datasheets as 0.5% nominal inaccuracy, plus up to 0.2% over the temperature range...