Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use RTC DS13072: Examples, Pinouts, and Specs

Image of RTC DS13072Design with RTC DS13072 in Cirkit Designer

Introduction

The RTC DS13072 is a high-precision, low-power real-time clock and calendar chip designed by Electronics Hut. It is engineered to maintain accurate time and date information, functioning even when the primary device power is off. This component is ideal for applications such as embedded systems, data loggers, clocks, and smart devices where timekeeping is crucial.

Explore Projects Built with RTC DS13072

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino UNO with DS1307 RTC Controlled LED Lighting System: A project utilizing RTC DS13072 in a practical application
Arduino UNO with DS1307 RTC Controlled LED Lighting System

This circuit features an Arduino UNO connected to a DS1307 Real Time Clock (RTC) module for timekeeping and a red LED with a series resistor for indication purposes. The Arduino communicates with the RTC via I2C (using A4 and A5 pins for SDA and SCL, respectively), and controls the LED connected to digital pin D8 through a 330-ohm resistor. The embedded code sets the RTC time, checks the current time, and turns the LED on or off based on the specified time condition (between 11:00 AM and 11:43 AM).

Open Project in Cirkit Designer
Image of Arduino UNO Controlled Relay with DS3231 RTC: A project utilizing RTC DS13072 in a practical application
Arduino UNO Controlled Relay with DS3231 RTC

This circuit features an Arduino UNO microcontroller connected to a DS3231 Real Time Clock (RTC) module and a 12V single-channel relay. The Arduino provides power to both the RTC and the relay, and it communicates with the RTC via I2C using the SDA and SCL lines connected to A4 and A5 respectively. The relay is controlled by the Arduino through a digital output on pin D13, allowing the Arduino to switch external loads on and off based on time events managed by the RTC.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 VCC Power supply pin (2.0V to 5.5V)
2 GND Ground pin
3 SDA Serial Data for I2C interface
4 SCL Serial Clock for I2C interface
5 MOSI Master Out Slave In for SPI interface
6 MISO Master In Slave Out for SPI interface
7 SCLK Serial Clock for SPI interface
8 /CS Chip Select for SPI interface

Usage Instructions

How to Use the Component in a Circuit

  1. Power Supply: Connect VCC to a 2.0V to 5.5V power source and GND to the system ground.
  2. Interface Selection: Choose between I2C or SPI for communication with the microcontroller.
  3. Battery Backup: Attach a coin cell battery to the VCC and GND pins to enable timekeeping during power loss.

Important Considerations and Best Practices

Example Code for Arduino UNO

#include <Wire.h> // Include Wire library for I2C communication

// RTC DS13072 I2C address
#define DS13072_I2C_ADDRESS 0x68

void setup() {
  Wire.begin(); // Initialize I2C communication
  Serial.begin(9600); // Start serial communication at 9600 baud rate
  // Set initial time and date here if needed
}

void loop() {
  Wire.beginTransmission(DS13072_I2C_ADDRESS); // Start I2C transmission
  Wire.write(0); // Set DS13072 register pointer to 00h
  Wire.endTransmission();
  
  Wire.requestFrom(DS13072_I2C_ADDRESS, 7); // Request 7 bytes of data
  
  // Read data from the RTC and print it
  if (Wire.available() == 7) {
    // Convert the byte data to num
    int second = bcdToDec(Wire.read() & 0x7F);
    int minute = bcdToDec(Wire.read());
    int hour = bcdToDec(Wire.read() & 0x3F);
    int dayOfWeek = bcdToDec(Wire.read());
    int dayOfMonth = bcdToDec(Wire.read());
    int month = bcdToDec(Wire.read());
    int year = bcdToDec(Wire.read());
    
    // Print the date and time
    Serial.print(year);
    Serial.print("/");
    Serial.print(month);
    Serial.print("/");
    Serial.print(dayOfMonth);
    Serial.print(" ");
    Serial.print(hour);
    Serial.print(":");
    Serial.print(minute);
    Serial.print(":");
    Serial.println(second);
  }
  
  delay(1000); // Wait for a second
}

// Convert binary coded decimal to normal decimal numbers
int bcdToDec(byte val) {
  return (int)((val / 16 * 10) + (val % 16));
}

Troubleshooting and FAQs

Common Issues Users Might Face

Solutions and Tips for Troubleshooting

FAQs

Q: Can the RTC DS13072 be used with both 3.3V and 5V systems? A: Yes, the RTC DS13072 operates within a range of 2.0V to 5.5V, making it compatible with both 3.3V and 5V systems.

Q: How long can the RTC keep time with a battery backup? A: The battery life depends on the quality and capacity of the coin cell used. With a typical 3V coin cell and the low backup current of the DS13072, it can last for several years.

Q: Is it necessary to use an external crystal with the DS13072? A: The DS13072 typically has an integrated crystal. However, check the specific module from Electronics Hut to confirm if an external crystal is needed or already included.