Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • Thank you very much ocrdu I have arduino uno R3 (revision three) and I see a rectangular crystal on the board, So I guess its more accurate? Commented Sep 2, 2020 at 16:56
  • 2
    As far as I know, the UNO R3 also has a resonator on the board for the CPU, and the crystal is used for the USB timing only. This may be different between revisions of the board. Still, even with a crystal, I doubt you will get the accuracy you want. Commented Sep 2, 2020 at 17:10
  • 1
    Well, what I would do is just try it with a time of, say, two hours (or however long you can be bothered to observe the thing), see if it is close enough, and if not, introduce a calibration factor in the code to compensate. Measuring equipment would make this an easier process. If it turns out you can't properly adjust that way because of clock instability, you can always add a precise RTC module. Primitive engineering, maybe, but worth a shot. Commented Sep 2, 2020 at 18:51
  • 3
    1. Re “I think what you do will work”: It will. delay() can handle up to ULONG_MAX milliseconds, which is about 49.7 days. 2. Re “introduce a calibration factor”: if the experiment is performed in just a few hours, this will likely work. But then frequency wander will defeat the calibration at longer time scales. You can expect the clock frequency to “random walk” with a typical √t law at time scales longer than a few seconds. Commented Sep 2, 2020 at 20:51
  • 1
    @Felix0004: 3 minutes in one day is 3×60÷86400 ≈ 0.002, or 2,000 ppm. Kind of high, but still within the tolerance of a typical ceramic resonator. Commented Sep 4, 2020 at 9:26