Using the basic datalogger hardware, logging can be carried out at regularly spaced intervals (up to several hours) using simple programmed time
delays. For example, the datalogger program presented last month used the
"Pause" instruction to generate a 60,000ms (1 minute) sampling interval.
However, time delays generated in this way are not entirely
accurate, due mainly to manufacturing tolerances within the PICAXE micro's
internal resonator. This becomes particularly evident when longer sampling
periods are called for. To avoid this problem, you can add a real-time clock
(RTC) IC to the basic datalogger module.
DS1307 Real-Time Clock chip
Fig.1: this diagram shows how the DS1307 real-time clock chip is connected to the PICAXE-18X 4-Channel Datalogger circuit.
The Maxim/Dallas Semiconductor DS1307 is an accurate real-time
clock in an 8-pin DIP package. It automatically maintains the current time and
date, including corrections for leap years and months with less than 31 days. A
standard low-cost 32.768kHz watch crystal connects between pins 1 & 2 to
provide an accurate time base.
An optional 3V lithium coin cell can also be connected to pin 3,
ensuring that the device keeps functioning even when main circuit power is
removed. The IC automatically detects removal of the main power source and
switches to the lithium cell when required. Less than 1μA of current is consumed by the chip in
this mode, meaning a cell life of 10 years or more.
The DS1307 has two additional features of interest. Pin 7 is an
open collector output that can be programmed to flash at a 1Hz rate. This allows
an LED to be attached as a seconds indicator in clock applications. The IC also
contains 56 bytes of general-purpose RAM, which can be used as extra memory by
the PICAXE micro.