General Information

We understand that online shopping can sometimes be uncertain. If you order the wrong product or change your mind, don’t worry! We accept returns of unused items within 30 days. For items that are sensitive to moisture or sealed in pouches, just ensure they are unopened when you return them. Your satisfaction is our priority.

The Velleman DS1302 Real-Time Clock Module is a handy component for timekeeping in electronic projects. It contains a real-time clock/calendar and 31 bytes of static RAM. The module communicates with a microprocessor via a simple serial interface. Here are some key features:

- Real-time clock/calendar: Provides information on seconds, minutes, hours, day, date, month, and year.
- Automatic month adjustment: Corrects for months with fewer than 31 days and accounts for leap years.
- 24-hour or 12-hour format: Can operate in either format with an AM/PM indicator.
- Low power consumption: Ideal for time-related projects.
- Comes with a CR2032 battery for power backup.

You can use this module to enhance your projects and ensure accurate timekeeping even when the main power source is disconnected . It's a great addition for any electronics enthusiast! 😊

To connect a DS1302 Real-Time Clock (RTC) module to a microprocessor, you'll need to follow a few steps. The DS1302 is a simple and widely used RTC chip that provides real-time clock/calendar functionality. Here's how you can connect it:

1. Wiring Setup:
- The DS1302 module typically has three pins for communication:
- CE (Chip Enable): Also known as RST (reset), this pin is used to enable or disable communication with the DS1302.
- I/O (Data Line): This is the data line for synchronous serial communication.
- SCLK (Serial Clock): The clock signal for data transfer.
- Additionally, there are two power pins:
- Vcc1: this is if you want to use a different battery to the battery on the board
- Vcc2: Connect this to +5V or +3.3V (depending on your microprocessor's voltage level).
- A 32.768kHz crystal should be connected to X1 and X2 on the DS1302 module.

2. Coding the DS1302:
- You can use an existing library for interfacing with the DS1302. For example, there's a library available from Virtuabotix that simplifies communication with the DS1302.
- The library provides common functions for reading and writing time and date information.
- You can find the library and its functions here: [Virtuabotix DS1302 Real-Time Clock Module Pin-Out & Coding Guide](https://www.virtuabotix.com/virtuabotix-ds1302-real-time-clock-module-pin-out-coding-guide/).

3. Code Example: Printing Data using the DS1302 library in python

# Example code snippet (printing time and date elements):
#include <DS1302.h>

DS1302 rtc(CE_PIN, IO_PIN, SCLK_PIN); // Initialize DS1302 with appropriate pins

void setup() {
  rtc.halt(false); // Unhalt the clock
  rtc.writeProtect(false); // Disable write protection
}

void loop() {
  // Read time and date elements
  int seconds = rtc.getSeconds();
  int minutes = rtc.getMinutes();
  int hours = rtc.getHours();
  int day = rtc.getDay();
  int month = rtc.getMonth();
  int year = rtc.getYear();

  // Print elements
  Serial.print("Time: ");
  Serial.print(hours);
  Serial.print(":");
  Serial.print(minutes);
  Serial.print(":");
  Serial.println(seconds);

  Serial.print("Date: ");
  Serial.print(day);
  Serial.print("/");
  Serial.print(month);
  Serial.print("/");
  Serial.println(year);

  delay(1000); // Wait for a second
}

More useful bits of information
  • The DS1302 operates on very low power and retains data even on less than 1μW. 
  • It's commonly used in Arduino projects, but you can adapt it for other microprocessors as well.