Pages: [1] 2   Go Down
Author Topic: Standalone ATMega328 Crystal Selection  (Read 1942 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  : )_~
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27425
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  : )_~
Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 593
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27425
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: June 29, 2012, 01:06:50 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  : )_~
Logged

Germany
Offline Offline
Faraday Member
**
Karma: 59
Posts: 3091
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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% "
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why would you say that is wrong?

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

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  : )_~
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 593
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



it's from this page

http://www.oscilent.com/spec_pages/PNDescrpt/Load_Cap.htm
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged


South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1001
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Accelerate to 88 miles per hour.

0
Offline Offline
God Member
*****
Karma: 0
Posts: 593
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

Wisconsin
Offline Offline
Edison Member
*
Karma: 4
Posts: 1001
I LOVE THIS STUFF!!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Accelerate to 88 miles per hour.

Pages: [1] 2   Go Up
Jump to: