I want to use my Atmega328P in 8MHz, but I noticed that the internal clock is not as accurate and cause problems in my application. To add an external crystal 8MHz I do like the image below or 22pF capacitors are only necessary when I use a 16MHz crystal?

enter image description here

  • 2
    You need to use the capacitors as this helps the signal generated by the crystal to be stable. If you do not use them, it will be worse than the internal clock basically. – RSM Aug 31 '16 at 15:19
  • 4
    You need to use the correct capacitors. The capacitors to choose depend on the crystal. Read the datasheet. – Majenko Aug 31 '16 at 16:51
  • If you want to keep your componenet count down- then you may want to consider a resonator instead of using crystals and capacitors – qwerty10 Aug 31 '16 at 22:34
  • @qwerty10 Resonators aren't that much better than the internal RC clock source. Yes, they can be faster, but no more accurate. Personally I don't use either. I use MEMS clock chips now - usually the ASEMB range from ABRACON. – Majenko Aug 31 '16 at 23:32
  • @Majenko My interpretation of the question is seemed to impliy that the OP wanted to use as few components as possible so I suggested using a resonator. In my experience Ive found resonators to be accurate. But it would depends on the situation of course how accurate the clock pulse is to be required which only the OP really knows. Yes you can use a clock chip too-sometimes found in old epson printers-which is what you seem to be referring to. – qwerty10 Aug 31 '16 at 23:37

Yes, you require the capacitors, and the capacitors have to be the right value for your crystal.

The datasheet will specify a load capacitance which you use in the following formula:

C1 = C2 = 2(CL - C_STRAY)

That is, the load capacitance of the crystal, minus the stray capacitance from your circuit (as long as your traces are short that is negligible and can be largely ignored unless you have very very tight timing requirements) multiplied by 2.

So for 22pF capacitors it is safe to assume that the crystal that is with them has a load capacitance of 11pF.

So check the datasheet for the load capacitance (it should be very prominent) and select the correct capacitors accordingly.

If you want to do away with the capacitors and your timing requirements aren't that precise you may get away with a ceramic resonator which doesn't require capacitors.

Another option is to use a MEMS® clock chip which generates a stable clock signal at a pre-set frequency. While this doesn't require capacitors for the clock signal it does still require a decoupling capacitor on the power supply for it, but of course that doesn't affect the timing of the clock signal, so precise selection of a specific value isn't needed.

| improve this answer | |
  • When would stray capacitance or stray inductance be significant if the 22pf capacitance was made from a number of capicitors connected in a combination of series and parallel to make up a 22pf capacitance? E.g. use two 44pf capacitors in series to make 22pf-and two 11pf capacitors for another 22pf-but it could be a lot more complicated than that-such as using lower values e.g. 1pf capacitors. – qwerty10 Sep 1 '16 at 4:58
  • This crystal here has 18pF capacitance, then I need two 36pF capacitors. Is correct? br.mouser.com/ProductDetail/ABRACON/ABLS-8000MHZ-B2-T/… – Renato Tavares Sep 1 '16 at 11:29
  • 1
    Yep, that is correct. – Majenko Sep 1 '16 at 11:30
  • it would be interesting to know a good answer to the question I made in the comment above. – qwerty10 Sep 1 '16 at 19:00
  • I am sorry, I do not understand the question. – Majenko Sep 1 '16 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.