2

I'm using an Arduino Uno Rev3 Board and need to send a trigger signal at a certain frequency (20-50Hz). This trigger signal should be as accurate as possible (+/- 0.01 ms). The Arduino site states that the arduino uno has a 16MHz Quartz Crystal, but I'm measuring a frequency accuracy of about 0.35% (which would be typical for a ceramic resonator) instead of what i could expect from a quartz (0.001%). I'm using the micros() function to measure time. Am I doing something wrong? How is my frequency so inaccurate?

Thanks for your help! :)

enter image description here

Edit: Indeed when I have a look at the schematics, I see the ceramic resonator (Blue circle). However, there seems to be another 16 MHz part (red circle). could that be a quartz oscillator?

  • 1
    Can you please provide the measurement code by editing your question? – chrisl Jan 7 at 12:05
  • I don't know why they say it has a quartz crystal - it doesn't - it has a ceramic resonator. This one: uk.farnell.com/murata/cstce16m0v53-r0/… – Majenko Jan 7 at 12:11
  • 2
    Yes, I am sure. That is the part from the schematic. I have emailed the webmaster to try and get the error corrected on the product page. There are plenty of other better boards with crystals - more powerful boards generally, such as Teensy, chipKIT, etc. – Majenko Jan 7 at 12:34
  • 1
    @MarayJay The Uno R3 has a quartz crystal to run the ATMega16U2, not the ATMega328P. It's the one for the ATMega328P that you care about. Quartz is required for USB for the accuracy, but not for UART since it's more forgiving. – Majenko Jan 7 at 14:17
  • 1
    @MarayJay If you are good with soldering, there is no reason why you can't replace the resonator on the board with a 16 MHz crystal and two ceramic capacitors (22 uF). Something like this: images.app.goo.gl/x5KSXfUf9y1Q9K6e6 – Kavka Jan 7 at 16:14
2

The ATMega328P chip is, indeed, clocked by a ceramic resonator. The website is misleading in stating that it has a crystal (I have emailed the webmaster to try and get this corrected, though I don't hold out much hope).

The 16MHz crystal in the schematics is part of the USB interface circuitry and has nothing to do with the timing of your running code. It is purely used to clock the ATMega16U2 chip which provides USB connectivity (USB requires a higher accuracy for stable communication).

There are other boards available with better crystals - most often boards that have native USB connections, such as the Arduino Due or Leonardo, or any of the myriad of boards by other manufacturers, like Teensy or chipKIT.

  • Thank you very much for the clarification! I struggle finding an alternative that provides the following specs: - 5V Output (I need a 5V signal) - Quartz crystal - RS-232 communication possible - USB connection to connect computer Would you have a suggestion? – MarayJay Jan 7 at 16:36
  • @MarayJay The Arduino Leonardo may be your best bet. – Majenko Jan 7 at 16:41
  • do i understand this right: The leonardo just has one quartz oscillator, because there is no second processor for the usb communication? And you are 100% sure that this is a quartz oscillator, right? I don't trust the arduino page anymore, so i trust you. (you're saving my day btw) – MarayJay Jan 7 at 16:51
  • @MarayJay The Leonardo has a direct ("native") USB connection. It comprises the functionality of both the chips on the Uno in one. USB requires the accuracy of a quartz crystal. You can also use the Arduino Micro if you want a smaller footprint. Same chip, just a smaller board. – Majenko Jan 7 at 16:58
  • Thank you so much :) – MarayJay Jan 7 at 17:14

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.