Go Down

Topic: Arduino Atmega Standalone - need for Capacitors & Crystal? (Read 6025 times) previous topic - next topic

Andy_Cool

Hi

I have read several tutorials showing how to run an Arduino Uno Atmega chip as standalone
after programming it on the Arduino board. My query is-
Why do we need capacitors & 16MHz Crystal?

If I have grasped it correctly, the capacitors on the power-pins are required to remove
the DC ripple effect.

About the 16 MHz Crystal, I think Arduino Uno has 16MHz external clock & this Crystal
does that function on the standalone. However,  the Atmega328 chip has an internal clock.
Can I not use it, without the Crystal, on the standalone board?

Project intention: 3x & 4x LED Cube
Source: http://www.instructables.com/id/Standalone-Arduino-ATMega-chip-on-breadboard/

johnwasser

You can eliminate the crystal and associated load capacitors if you change the fuses to select the internal 8 MHz RC oscillator.  You can do this by selecting one of the 8 MHz boards (like "LilyPad Arduino w/ ATmega328") and burning a fresh bootloader.  You will need an ISP to burn the bootloader.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Fat D

The internal clock is limited to half the speed that is usually present on Arduino and is subject to inaccuracies if you have not calibrated it. But yes, it can be used (with a bootloader adapted for it), but timing-dependent stuff like serial communications might be unreliable.
Similarly, the power supply filter capacitor is not necessary per se, but it is very useful and improves reliability.

RobDrizzle

You don't need a crystal and caps. You have to change the Atmega's fuses (by an ICSP programmer) to use the internal oscillator @ 8MHz.

*edit* someone beat me to it!

Andy_Cool

Thanks John, Fat D & Rob for replying. So the internal clock would require a new bootloader.
That doesn't help if one wishes to program the chip on-board & just place it on a PCB.

A new bootloader & a fuse select is needed for the internal clock to work.
Got it. So, primarily, the chip is dependant on the clock frequency that its corresponding
bootloader was burnt on.


Brad Burleson


You can eliminate the crystal and associated load capacitors if you change the fuses to select the internal 8 MHz RC oscillator.  You can do this by selecting one of the 8 MHz boards (like "LilyPad Arduino w/ ATmega328") and burning a fresh bootloader. 


Unfortunately you'll need to modify the boards.txt file and change the fuse settings if you're using an ATmega328.  The current 328 Lilypad entry expects an external 8MHz crystal.

Currently only the "LilyPad Arduino w/ ATmega168" will work "out of the box" with the internal oscillator.

Brad (KF7FER)

pluggy

An option which allows the arduino to work like an arduino without changing the fuses and is simpler than a crystal and capacitors is to use a 16Mhz ceramic oscillator (like the Uno).  1 component rather than 3 and no workarounds to get it working at half speed on the internal oscillator.
http://pluggy.is-a-geek.com/index.html

pwillard

Just buy the resonator and skip the internal oscillator option.

Techone

Quote
Just buy the resonator and skip the internal oscillator option


Now, that is a good idea.  ... I should try that...

Most in my breadboard project, I only use a 16 MHz crystal, no 22 pF cap. But on a PCB version, I do have a crystal - 16 MHz and the 2 cap of 22 pF. For a reliability operation of my project... it is a must.

I just don't understand why you don't want to use it in your project....( I don't know your situation... ) 

RobDrizzle

FYI in the future... This page will help you setup a chip for use with out the need for external mumbo jumbo.

http://arduino.cc/en/Tutorial/ArduinoToBreadboard

Andy_Cool

Thank you all for replying :)

Quote
I just don't understand why you don't want to use it in your project....( I don't know your situation... )  


@Techone Nothing like that. I was just curious to know what was the need & what prevents the internal clock from being used as is. Beginners knowledge sake :)

floresta


FYI in the future... This page will help you setup a chip for use with out the need for external mumbo jumbo.

http://arduino.cc/en/Tutorial/ArduinoToBreadboard


Unfortunately this tutorial does not set a very good example.  Two things that come to mind are the lack of decoupling capacitors at the IC power pins and the long wires between the crystal and the IC.

Don

RobDrizzle

All true... But it does have a readily available Board.Txt file with all the fuses and settings for running at 8MHz without a crystal making the bootloading and fuses easy as pie....
























mmmmm... pie.

MarkT


Hi


If I have grasped it correctly, the capacitors on the power-pins are required to remove
the DC ripple effect.



No, the power supply capacitors are for decoupling - for logic circuits they prevent the high-speed(*) switching transients from all the 10,000's of transistors adding up on the supply rail and causing circuit misbehaviour - incorrect logic switching.  Since the Arduino chip has analog inputs as well the decoupling also is very important in reducing analog noise.  With high speed decoupling its important the capacitors are right next to the chips connected via a low impedance (low inductance) path - that means short fat wires/PCB-traces.
Often voltage regulators require a certain amount of capacitance on the output rail to be able to live up to their specifications.  Typically you want 0.1uF ceramic caps next to each chip and 10uF to 100uF somewhere on the board for lower-frequency decoupling.

Inadequate decoupling shows up as unreliable behaviour, pattern sensitive and difficult to trace with a logic analyser or 'scope since monitoring the signals changes the high-speed transients that are causing the problem.  It will drive you crazy trying to work out what's happening, so never skimp on decoupling.

Incidentally DC ripple should be handled by the voltage regulator circuit/chip.

(*) modern CMOS devices switch output pins in 1 to 10 nanoseconds, but internally some might be switching in 10's to 100's of picoseconds (and have local decoupling capacitors built onto the surface of the chip!). 
[ I won't respond to messages, use the forum please ]

Andy_Cool

@MarkT Wow. That was heavy :) I will have to read it several times more & cross-reference it with the help of Google Uncle before I fully understand it. Thanks all the same for willing to share your knowledge.

Go Up