DS1302 Real-Time Clock (RTC) Module with Battery Backup
The DS1302 Real-Time Clock (RTC) Module provides accurate time and calendar functions for Arduino, microcontroller and embedded electronics projects.
Built around the DS1302 RTC IC, the module can keep track of seconds, minutes, hours, date, month, day of the week and year. A backup coin-cell battery allows the clock to continue keeping time even when the main system power is disconnected.
The module communicates with a microcontroller through a simple 3-wire serial interface, making it easy to integrate into clocks, data loggers, automation systems and other time-dependent projects.
Technical Specifications
-
RTC IC: DS1302
-
Function: Real-Time Clock / Calendar
-
Operating Voltage: 2.0–5.5V DC
-
Interface: 3-Wire Serial
-
Communication Pins: CLK / DAT / RST
-
Clock Crystal: 32.768kHz
-
Time Format: 12-Hour or 24-Hour
-
Calendar: Date, Month, Day and Year
-
Leap-Year Compensation: Up to Year 2100
-
User RAM: 31 Bytes Battery-Backed RAM
-
Backup Battery Support: Yes
-
Typical Battery Holder: CR2032-Type Coin Cell Holder
-
Low-Power Timekeeping: <300nA at 2.0V
-
Data Transfer: Single-Byte or Burst Mode
Real-Time Clock & Calendar
The DS1302 automatically keeps track of:
- Seconds
- Minutes
- Hours
- Date
- Month
- Day of the Week
- Year
It also automatically adjusts for months with fewer than 31 days and includes leap-year compensation valid through 2100.
12-Hour & 24-Hour Time
The RTC can operate in either:
12-Hour Mode with AM/PM
or
24-Hour Mode
depending on the software configuration.
Battery Backup
The module includes a coin-cell battery holder that allows the RTC to continue keeping time when the main circuit is switched off.
This makes it particularly useful for projects that must retain the correct date and time after a power interruption.
3-Wire Serial Interface
Unlike I²C RTC modules such as the DS1307 or DS3231, the DS1302 uses its own simple 3-wire synchronous serial interface.
The main communication signals are:
-
CLK / SCLK – Serial Clock
-
DAT / I/O – Bidirectional Data
-
RST / CE – Communication Enable
Power connections are:
-
VCC – Module Power
-
GND – Ground
31 Bytes of Battery-Backed RAM
In addition to its timekeeping functions, the DS1302 provides:
31 × 8-bit General-Purpose RAM
This memory is battery-backed and can be used for storing small amounts of information that should remain available while the main power is disconnected.
Low-Power Operation
The DS1302 is specifically designed for low-power timekeeping.
The RTC itself consumes less than approximately:
300nA at 2.0V
during low-power operation, allowing a suitable backup battery to maintain the clock for an extended period.
Microcontroller Compatibility
The module can be interfaced with many microcontroller platforms, including:
- Arduino UNO
- Arduino Nano
- Arduino Mega
- ESP32
- ESP8266
- Raspberry Pi
- STM32
- PIC
- AVR
- Other Microcontrollers
Appropriate software libraries and correct logic-voltage considerations should be used for the selected platform.
Typical Wiring
A typical 5-pin DS1302 module provides:
VCC → Power Supply
GND → Ground
CLK → Microcontroller Digital Pin
DAT → Microcontroller Digital Pin
RST → Microcontroller Digital Pin
The CLK, DAT and RST signals can generally be assigned to suitable GPIO pins according to the software library being used.
Applications
Ideal for:
- Digital Clocks
- Alarm Clocks
- Data Loggers
- Arduino Projects
- ESP32 Projects
- Robotics
- Home Automation
- Timers
- Scheduled Control Systems
- Attendance Systems
- Electronic Displays
- Embedded Systems
- Measurement Equipment
- Time-Stamped Sensor Logging
- Educational Electronics Projects
DS1302 vs DS3231
The DS1302 is a simple and economical RTC suitable for general timing applications.
For projects requiring higher timekeeping accuracy, especially across changing temperatures, a temperature-compensated RTC such as the DS3231 is generally a better choice.
The DS1302 remains a good option when low cost, simple interfacing and battery-backed timekeeping are the main requirements.
Important Battery Note
The DS1302 IC supports a programmable trickle-charging function for an appropriate rechargeable backup source.
However, do not enable trickle charging when using a standard non-rechargeable CR2032 battery.
A CR2032 lithium coin cell is not designed to be recharged.
If the specific module is configured for a rechargeable backup battery, use only the battery type specified by the module manufacturer.
Important Notes
-
The DS1302 uses a 3-wire serial interface; it is not an I²C device.
- Check the module pin labels before wiring.
- Observe correct VCC and GND polarity.
- Verify GPIO voltage compatibility when using 3.3V microcontrollers.
- The backup battery is used primarily to maintain the RTC when main power is removed.
- Battery may not be included, depending on the supplied package.
- For applications requiring very high clock accuracy, consider a DS3231 RTC module.
Package Includes
1 × DS1302 Real-Time Clock (RTC) Module
Backup battery is not included.