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

How to Use Adafruit DS1307 RTC Breakout: Examples, Pinouts, and Specs

Image of Adafruit DS1307 RTC BreakoutDesign with Adafruit DS1307 RTC Breakout in Cirkit Designer

Introduction

The Adafruit DS1307 RTC Breakout is a real-time clock (RTC) module that keeps track of the current time and date. It is based on the DS1307 RTC IC from Maxim Integrated. This component is widely used in electronics projects that require timekeeping functionality, such as data loggers, clocks, and schedulers. Its ability to maintain accurate timekeeping even when the main power is off, thanks to a backup battery, makes it a reliable choice for time-sensitive applications.

Explore Projects Built with Adafruit DS1307 RTC Breakout

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 Adafruit DS1307 RTC Breakout 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

Technical Specifications

Key Features

Pin Configuration and Descriptions

Pin Number Name Description
1 GND Ground connection
2 VCC Power supply (4.5V to 5.5V)
3 SDA I2C Data Line
4 SCL I2C Clock Line
5 SQW Square Wave/Output Driver
6 32K 32.768 kHz Output
7 RST Reset (active low)

Usage Instructions

Connecting to an Arduino UNO

  1. Connect the GND pin to the ground on the Arduino.
  2. Connect the VCC pin to the 5V output on the Arduino.
  3. Connect the SDA pin to the A4 (SDA) on the Arduino.
  4. Connect the SCL pin to the A5 (SCL) on the Arduino.

Setting the Time

Before using the RTC, you need to set the current time. This is typically done through an initialization routine in your Arduino sketch.

Best Practices

Example Arduino Code

#include <Wire.h>
#include <RTClib.h>

RTC_DS1307 rtc;

void setup() {
  Wire.begin();
  rtc.begin();

  if (!rtc.isrunning()) {
    // The following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }
}

void loop() {
  DateTime now = rtc.now();

  // Print the current date and time to the Serial Monitor
  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(" ");
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();

  delay(1000); // Wait for 1 second before repeating the loop
}

Troubleshooting and FAQs

Common Issues

FAQs

Q: How do I replace the backup battery? A: Carefully remove the old battery and insert a new CR1220 coin cell battery.

Q: Can the DS1307 RTC operate at 3.3V? A: The DS1307 is designed to operate at 4.5V to 5.5V. For 3.3V applications, consider using a different RTC module like the DS3231 which is compatible with 3.3V logic.

Q: How do I read the temperature from the DS1307? A: The DS1307 does not have a built-in temperature sensor. If you need temperature readings, you will need to use a separate temperature sensor.

Remember to keep your documentation up-to-date with the latest information and best practices to ensure users have the most accurate and helpful guidance.