Categories

ATMega328 RC vs quartz oscillator comparison

Posted on Wednesday, April 25th, 2012 in demonstrations by DP

Kenneth compares the RC oscillator found on the ATMeg328 against an external quartz crystal. As expected there is a huge difference in precision and stability between the two.

This really demonstrates how both oscillators, but particularly the internal one, are very sensitive to temperature changes around the microcontroller.  This is why my counter’s oscillator is contained in a small oven, such that it’s held at a specific elevated temperature and doesn’t change temperature along with the room.

This entry was posted on Wednesday, April 25th, 2012 at 11:00 pm and is filed under demonstrations. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

10 Responses to “ATMega328 RC vs quartz oscillator comparison”

  1. dext0rb says:

    Could not resist temptation to ask…well….”whats the frequency, Kenneth?”

  2. Brian says:

    The RC is totally useable for many many applications, so the initial “why we don’t use it” seems rather silly. UARTs aren’t really that time sensitive. Even USB devices can handle use less than ideal RCs in place of XTALs (see MCP2200 datasheet). There are many applications where jitter, phase noise and frequency stability are important, but simple UART isn’t it. I would guess that the XTAL is on Arudunio for long term time stability for people who want to build clocks and the like.

    • UziMonkey says:

      USB has a sync byte at the beginning of each frame though. This is used to calibrate internal rc oscillators for each frame. Since USB has no clock pin, timing is very crucial for even half speed USB, not to mention the much faster speeds. Sometimes it’s just easier to use a crystal but with care an rc will do.

  3. Drone says:

    I agree the RC oscillator is often very useful, especially for less time critical applications where the processor needs to run slower – thereby greatly reducing power consumption.

  4. robert says:

    The problem with the ATmega AVR chips is that the factory calibration of the RC oscillator is usually pretty bad. It varies between batches. Therefore baud-rates are too far off to have an UART work reliably out of the box. It needs to be calibrated in code using the OSCCAL register. The first larger batch of chips I bought worked just fine with factory calibration + UART, the next batch simply didn’t. The last ATmega I had in my fingers ran at 8.33MHz instead of 8.00MHz.

    • Brian says:

      Well I have used a lot of AVRs and never had one that didn’t do any baud-rate I desired with no bit errors. Even with a perfect clock there are errors due to divide by N.

  5. Bobi says:

    Hello,
    I’m new in microcontrollers and was wondering if it is possible to use any kind of Atmega wihout external oscellator? For example just connecting battery and LED. Is it possible? Some links please.
    Thank you.

  6. Bobi says:

    Haha, so everything is about Fuses configuration. That’s a new topic for me to google and kill one or another chip. :D
    Thank you Robert, I’ll study your link.

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recent Comments

  • coppice: If all you have found so far is fake iphones, the next place you should visit is SEG in Hua Qiang Bei. Get out of...
  • Edward Cooper: Great article and good find on the markets! Any chance you can provide the locations of these places? I'm in Shenzhen at the moment and...
  • Dan: I'm up for one
  • TrickyNekro: Always in for another bunch! :-D
  • mol-1: Maybe this time !