0

I'm making a slow control system using Arduino Mega. The Arduino board needs to measure temperature, magnetic field, switch on/off LEDs, and exchange messages with an external system via UART. All of the measurement data needs to be recorded in a microSD card with accurate and precise(1ms or smaller) timestamps.

At a glance the tasks seem to require a RTC. However, I'm not able to put a battery on my peripheral board due to a space limitation. Then it would make more sense that I don't use a RTC but just count time using a Arduino timer. However, I wonder if timing count with a Arduino timer is reliable.

With the combination of a RTC and Arduino timer input capture mode, one can achieve a timing resolution of 1/32k seconds. Without the RTC, Arduino timer can prescale system clock and count time. Without using AVR library, would the timestamping be accurate enough?

11
  • 3
    You don't need a battery to run an RTC - only to keep time while the board is powered off. If you don't care what the actual time is, and only the delta between readings, then it doesn't matter what time the RTC thinks it is, only that it's reliable. Most RTCs give a regular 1 second pulse output that could be used as a time correction signal for the internal timer.
    – Majenko
    Jun 29 '18 at 12:51
  • 1
    @EdgarBonet So you are talking about an inaccurate initial time reading from RTC?
    – Nownuri
    Jun 29 '18 at 17:46
  • 1
    Yes. Even a perfect RTC won't give you absolute time without an external source to synchronize to. And even if you don't care about absolute time, you should expect about 1 ppm drift, meaning that you can be 1 ms off after only 15 minutes. Jun 29 '18 at 17:50
  • 1
    @EdgarBonet RTC reading is used only once in this context. After the moment only the signal from oscillator is relevant. Is the drift about the clock signal from the oscillator?
    – Nownuri
    Jun 29 '18 at 17:53
  • 1
    @EdgarBonet .. the external crystal oscillator on Arduino Mega board? That's interesting.
    – Nownuri
    Jun 29 '18 at 18:06

Your Answer

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

Browse other questions tagged or ask your own question.