Real Time Clock
I've built several clocks now and
I have had good
results with the NJU6355 RTC. It is available from DigiKey as an 8-pin
DIP for around C$2. The manufacturer part number is NJU6355ED#
and the DigiKey part number is NJU6355ED#-ND.
(The NJU6355 is no longer available. Check out the DS1302, below.)
The
spec sheet is available from either DigiKey or the manufacturer link
above. There is also an application note which I cannot find a link to
anymore. A search turns up one hit to a page with a broken link. Anyway
I placed a copy if it here.
The application note contains
information on the crystal requirements and explains the test mode I
use to measure the oscillator frequency.
The
application note is a little vague on what capacitance crystal to use.
The crystal is 32.768 KHz and is available in several load capacitances
such as 6 or 12.5 pf. Crystals are cheap and readily available. Since
the frequency changes with the layout of the circuit (among other
factors), it is hard to be precise about the accuracy. But if you get
the right crystal and lay it out properly, the accuracy of the RTC is
amazing.
In my recent projects (appliance
timer and chiming clock)
I have included a 'clock test' in the setup menu, which tells the chip
to output its clock signal, which should be precisely 128.0000 KHz, on
the Data pin. You can measure it with a frequency counter and see how
accurate the clock is. If the frequency is high, you can add
capacitance to bring it down. If it is too low, you should probably use
a different crystal, with a higher capacitive load specification. I
have had good results with 12.5 pf crystals with this chip. (Unfortunately
I now have several used crystals around that I don't know their
specification.) Once
you have the chip running at the designated frequency, the clock is
very accurate and does not need resetting very often. Lately I have
been using a tiny 10 (or so) pF trimmer to make the adjustment easy.
One more thing about the NJU6355, if you place a call to rtc_test()
in your code, you have to make sure the chip has time to power up
before calling this function. I do not see this information in the spec
sheet, but believe me if you call rtc_test() immediately after power on
you will not see any signal coming out. I am guessing around 250ms;
anyway the problem will not occur if the backup battery is connected.
You could also try to use a DS32khz
instead of a crystal. I tried this in my thermostat
project with excellent results. The disadvantages are cost,
around C$9, and now only surface mount package is available.
I also used the DS1302,
see my travel clock
project. It is quite similar to the NJU6355,
but it has a neat feature for trickle charging the backup power source,
possably a super capacitor.
VE3LNY's
Electronics Notebook Page