GK-AMO-DS1302 geeekus DS1302 Real Time Clock Sensor Module for Arduino Raspberry Pi micro:bit

Price:
US$5.41
GK-AMO-DS1302
In stock
+
Add to wish list

The geeekus DS1302 real time clock module is high quality RTC module with high accuracy that provides seconds, minutes, hours, day, date, month, and year information.

The DS1302 trickle-charge timekeeping chip contains a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds, minutes, hours, day, date, month, and year information. Only three wires are required to communicate with the clock/RAM: CE, I/O (data line), and SCLK (serial clock). Data can be transferred to and from the clock/RAM 1 byte at a time or in a burst of up to 31 bytes. The DS1302 is designed to operate on very low power and retain data and clock information on less than 1μW. The DS1302 has dual power pins, one for primary and another for backup.

*CR1220 battery is included

Pinout of geeekus DS1302 RTC Module:

This module has 5 pins:
-CLK: Clock pin
-DAT: Data pin
-RST: Reset (Must be HIGH for active mode / Active High)
-VCC: Module power supply – 5V
-GND: Ground

Specifications: 

-Working voltage: DC 5V 
-Working current: 60mA
-Maximum power: 0.3A
-Working temperature: -25℃-65℃
-Interface: 5pin header interface with 2.54mm pitch
-Positioning hole: 3mm in diameter
-Size: 50*28mm -Weight: 5.8g
-The backup battery is CR1220 and non-rechargeable
-Voltage:3V
-Current: 40mAh
-The theoretical data can be retained for more than 1 year

 

Hookup Diagram

Test Code

 

#include <stdio.h>
#include <string.h>
#include <ds1302.h>
/* Set the appropriate digital I/O pin connections */
uint8_t CE_PIN   = 5;
uint8_t IO_PIN   = 6;
uint8_t SCLK_PIN = 7;
/* Create buffers */
char buf[50];
char day[10];
/* Create a DS1302 object */
DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN);
void print_time()
{
  /* Get the current time and date from the chip */
  Time t = rtc.time();
  /* Name the day of the week */
  memset(day, 0, sizeof(day));  /* clear day buffer */
      
  switch (t.day) {
    case 1:
      strcpy(day, "Sunday");
      break;
    case 2:
      strcpy(day, "Monday");
      break;
    case 3:
      strcpy(day, "Tuesday");
      break;
    case 4:
      strcpy(day, "Wednesday");
      break;
    case 5:
      strcpy(day, "Thursday");
      break;
    case 6:
      strcpy(day, "Friday");
      break;
    case 7:
      strcpy(day, "Saturday");
      break;
  }
  snprintf(buf, sizeof(buf), "%s %04d-%02d-%02d %02d:%02d:%02d",
           day,
           t.yr, t.mon, t.date,
           t.hr, t.min, t.sec);
  Serial.println(buf);
}
void setup()
{  Serial.begin(9600);
  rtc.write_protect(false);
  rtc.halt(false);
  Time t(2020, 8, 5, 11,12,13,4);
  rtc.time(t);}
void loop()
{ print_time();
  delay(1000);}
</ds1302.h></string.h></stdio.h>

Test Result

Once the code is uploaded, the current time and date are displayed on the serial monitor, as shown above.

Notice for California Residents: Warning symbolWARNING: Cancer and Reproductive Harm - www.P65Warnings.ca.gov