DS1302 Real Time Clock (RTC) Chip

DS1302 is a real-time clock capable of counting seconds, minutes, hours, date, month, day of the week and year up to 2100. The leap year compensation is made to incorporate internally. The static RAM DS1302 is of 31 Bytes. A simple serial SPI interface makes DS1302 communicate and interact with any microprocessor or microcontroller having an SPI communication interface. There are two forms of time indication i.e. 24 hours format or 12 hours with an indication of AM/PM. It operates on very low power. Retention of data and clock information can only take 1µW at most. Synchronous serial communication is used for connecting this RTC chip with a microprocessor. RST (reset), I/O (data line) and SCLK (serial clock) are the three terminals required for communication with DS1302. Single byte or multiple byte mode are utilized for data transferring to or from clock or RAM.

DS1302 Pinout Diagram

DS1302 is available as an 8-pin IC. Its pinout diagram is shown as:

DS1302 pinout diagram

Pin Configuration Details

PINSDetails
1 (Power Supply- )This pin is for connecting the primary power source.

VCC1 is connected to a source which acts as back up if the primary source is not present or working. DS1302 actually operates on any of the two i.e. VCC1 or VCC2 depending on the magnitude of a higher one. VCC2 acts as a primary power source if  VCC2 > VCC1 + 2 . if VCC2 < VCC1 + 2 , VCC1 acts as a power source.

2 (Oscillator Connection-X1)These pins are meant for connecting standard quartz crystal of oscillation frequency 32.768 kHz. For incorporating an external oscillator of value 32.768 kHz, X1 is connected to an oscillator while X2 is kept open/ floating.
3 (Oscillator Connection-X2)
4 (Ground-GND)This pin is for connecting ground
5 ( Reset- RST)This pin is also named as CE. The input at this pin should be high during a read or write.
6 ( Data line-I/O)This is input push-pull-output. It is bi-directional in nature provided communication is occurring through a three-wire SPI interface.
7 ( Synchronizing Clock-SCLK)This pin is for synchronizing data for serial interfacing.
8 (Power Supply- )This pin is connected to an energy source which can be recharged. This is for systems using trickle charging. Battery back-up is normally connected.

Where and How to Use DS1302 RTC Chip?

DS1302 has shift register, control logic, oscillator, real-time clock and RAM as the main constituents of timekeeping through SPI serial communication. The block diagram is correspondingly shown as:

DS1302 internal block diagram

DS1302 Example

A typical application of DS1302 example is shown as:

DS1302 typical application example

The crystal oscillator is connected between pin X1 and X2. Power supplies are connected to VCC2  and VCC1. DS1302 actually operates on any of the two i.e. VCC2  and VCC1 depending on the magnitude of a higher one. VCC2 acts as a primary power source if  VCC2 > VCC1 + 2 . if VCC2 < VCC1 + 2 , VCC1 acts as a power source.Pin no. 4 is grounded. The serial communication occurs through pins 4, 5 and 6 as shown above.

Each data transfer starts with a command byte. The MSB determines whether writes to DS1302 are possible or not. If this MSB i.e. bit no 7 is 1 writes to DS1302 is enabled and if its logic 0 writes to DS1302 is disabled. 0 zero logic on bit no. 6 determines clock or calendar data while logic shows RAM data. Bit no. 1 to 5 regards data registers to be input or output. Logic 0 at bit 0 I.e. LSB shows wrote operation and logic 1 shows read operation. This is depicted as:

data register

Applications

The applications of DS1302 include incorporated digital clocks/ timers of various modules in our real lives.

Other equivalents ICs of RTC are:  DS1307, DS3231, DS3232

DS1302 interfacing with Arduino

In this section, we will see an example of interfacing RTC chip with Arduino Uno. We will need an external crystal and a lithium battery to use this IC. Instead of purchasing this IC alone, there are many RTC modules available in the market. You can buy a DS1302 RTC module. Picture of module is shown here:

DS1302 RTC mdule pinout diagram

 

Real-time Chip Features

The operational features of DS1302 are shown as:

ParametersDS1302
Input leakage (µA)500
I/O leakage (µA)500
Active supply current- Oscillator enabled (mA)0.4
Timekeeping current- Oscillator enabled (µA)0.3-1.0
Stand by current- Oscillator disabled (nA)100-200
Trickle charge resistors- R1 (kΩ)2
Trickle charge resistors- R2 (kΩ)4
Trickle charge resistors- R3 (kΩ)8
Trickle charge diode voltage drop (V)0.7
Input capacitance (pF)10
Input/ output capacitance (pF)15
Data to CLK setup Vcc=2V (ns)200
Data to CLK setup Vcc=5V (ns)50
CLK to data hold Vcc=2V (ns)280
CLK to data hold Vcc=5V (ns)70
CLK to data delay Vcc=2V (ns)800
CLK to data delay Vcc=5V (ns)200
CLK low time Vcc=2V (ns)1000
CLK low time Vcc=5V (ns)250
CLK high time Vcc=2V (ns)1000
CLK high time Vcc=5V (ns)250
CLK frequency Vcc=2V (MHz)0.5
CLK frequency Vcc=5V (MHz)2
CLK rise and fall Vcc=2V (ns)2000
CLK rise and fall Vcc=5V (ns)500
CE to CLK setup Vcc=2V (µs)4
CE to CLK setup Vcc=5V (µs)1
CLK to CE hold Vcc=2V (ns)240
CLK to CE hold Vcc=5V (ns)60
CE inactive time Vcc=2V (µs)4
CE inactive time Vcc=5V (µs)1
CE to I/O high impedance Vcc=2V (ns)280
CE to I/O high impedance Vcc=5V (ns)70
SCLK to I/O high impedance Vcc=2V (ns)280
SCLK to I/O high impedance Vcc=5V (ns)70

DS1302 DATASHEET DOWNLOAD

Leave a Comment

two × 5 =