Real Time Clock (DS1302) Module with Battery CR2032


Product Description

Real Time Clock

This module allows you to use your Arduino to do many time and date related things like starting something at a specific date and time or to record the date of time of something like the time a sensor were triggered.

The backup battery makes sure that the time and date are kept accurate even if your Arduino is powered off.

– DS1302 timing IC
– This real time clock has the ability of calculating prior to the 2100 second, minute, hour, day, week, month, year, and the ability to adjust a leap year
– Wide working voltage: 2.0~5.5 V
– When The working voltage is 2.0V, the current is less than 300nA
– Read/write clock or RAM data have two transmission modes: Single-byte / many bytes group
– Simple 3 line interface. Easy to install

Pin out

VCC -> Arduino +3.3V
GND -> Arduino Gnd

Works great using the DS1302 library written by Henning Karlsen. The library can be found at 3 Examples are included.




// Example sketch for interfacing with the DS1302 timekeeping chip.
// Copyright (c) 2009, Matt Sparks
// All rights reserved.
#include <stdio.h>
#include <DS1302.h>

namespace {

// Set the appropriate digital I/O pin connections. These are the pin
// assignments for the Arduino as well for as the DS1302 chip. See the DS1302
// datasheet:
const int kCePin   = 8;  // Chip Enable
const int kIoPin   = 7;  // Input/Output
const int kSclkPin = 6;  // Serial Clock

// Create a DS1302 object.
DS1302 rtc(kCePin, kIoPin, kSclkPin);

String dayAsString(const Time::Day day) {
  switch (day) {
    case Time::kSunday: return "Sunday";
    case Time::kMonday: return "Monday";
    case Time::kTuesday: return "Tuesday";
    case Time::kWednesday: return "Wednesday";
    case Time::kThursday: return "Thursday";
    case Time::kFriday: return "Friday";
    case Time::kSaturday: return "Saturday";
  return "(unknown day)";

void printTime() {
  // Get the current time and date from the chip.
  Time t = rtc.time();

  // Name the day of the week.
  const String day = dayAsString(;

  // Format the time and date and insert into the temporary buffer.
  char buf[50];
  snprintf(buf, sizeof(buf), "%s %04d-%02d-%02d %02d:%02d:%02d",
           t.yr, t.mon,,
 , t.min, t.sec);

  // Print the formatted string to serial so we can see the time.

}  // namespace

void setup() {

  // Initialize a new chip by turning off write protection and clearing the
  // clock halt flag. These methods needn't always be called. See the DS1302
  // datasheet for details.

  // Make a new time object to set the date and time.
  // Sunday, September 22, 2013 at 01:38:50.
   Time t(2014, 10, 6, 12, 57, 50, Time::kMonday);

  // Set the time and date on the chip.

// Loop and print the time every second.
void loop() {

Additional Information

Weight 0.10 kg


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.