Increasing RTC Accuracy
Introduction:
On using a hardware RTC the accuracy was fixed and can not be increased.
The only way for more precise RTC was to realize it in software.
Why on hardware RTC the accuracy was low:
-
Using trimmed capacitor to adjust:
In general a trimmed capacitor must be adjusted in very small pieces of a
degree with nonlinear changing of the value So only a trial and error adjustment
in many steps can be done.
Also the deviation over the temperature and stability over the time was
bad.
Solution:
Use only software adjustment for high precise timebase.
-
Using slow crystal frequency:
In general the deviation over the temperature was lower and the stability
of a crystal was higher on higher frequency:
But hardware RTC use only slow frequency crystals of 32kHz to save
power.
Solution:
Use high frequency ( >= 1MHz) crystals.
The 10.000000 MHz crystal was often used for high precise timebase. You can
detect such crystals on a some times higher price than typical mcu crystals
(e.g. 11.0592MHz).
-
Using no temperature compensation:
In general a hardware RTC has no temperature compensation.
But the crystal frequency depend from the temperature.
Solution:
Its easy to add a temperature sensor circuit to your mcu.
E.g. the Dallas DS1621 can easy be read over the I2C-bus.
On using software correction of deviation you can load the correction value
from a table depending from the actual temperature. Then you need an exact
temperature diagram from the crystal manufacturer.
Attention:
In general the temperature deviation especially of high frequency crystal
was very low. Also for inroom applications the temperature was changed only
very small.
So temperature compensation was only needed for extreme high accuracy
(<= 10sec / year)
Additional advantages of software RTC:
-
faster access to the time values, since there are inside the mcu
-
shorter time steps can easy be realized
(some RTC give only time steps of 1 second)
-
daylight saving calculation can easy be realized
-
weekday calculation can easy be realized
-
day of year calculation over centuries can easy be realized
-
4 digit year calculation can easy be realized
(only some very new RTC can do this also)
The only disadvantage of a software RTC:
-
Need more power, since the mcu must permanent working for calculation time.
Solution:
Use the high precise software RTC during normal operation.
Use a less precise hardware RTC only to hold the time during seldom power
of times.
Realize a software RTC: