We are Apogeeweb Semiconductor Electronic


Home  Product Technical Articles   DS1307 Real Time Clock: Pinout, Datasheet, Circuit [Video]

DS1307 Real Time Clock: Pinout, Datasheet, Circuit [Video]

Author: Mia Date: 2 Apr 2021  81

ds1307 arduino

DS1307 is a low-power Full Binary (BCD) Real Time Clock (RTC) IC with 56 bytes of SVRAM that communicates via I2C Protocol.


This blog provides you a detailed introduction to DS1307 RTC, including  its pinout, application, how does it work in a circuit, what's its difference between DS3231 and more, hope this blog helps and thank you for reading!


This is a tutorial video teaching people how to connect DS1307 with Arduino.


DS1307 Description

DS1307 Pinout

DS1307 Features

DS1307 Parameter

What is I2C Protocol

DS1307 Working Principle

How to Use DS1307

DS1307 vs DS3231

DS1307 Application

DS1307 Manufacturer

DS1307 Package

Component Datasheet


DS1307 Description

The DS1307 serial real-time clock (RTC) is a low-power, full binary coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an I2C, bidirectional bus.


The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator.


The DS1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. Timekeeping operation continues while the part operates from the backup supply.


The DS1307 can operate in the following two modes:

  1. Slave Receiver Mode (Write Mode): Serial data and clock are received through SDA and SCL.

  2. Slave Transmitter Mode (Read Mode): The first byte is received and handled as in the slave receiver mode. However, in this mode, the direction bit will indicate that the transfer direction is reversed.

DS1307 Pinout

DS1307 RTC DS1307 RTC Pinout
DS1307 RTC DS1307 RTC Pinout


Pin Number Pin Name Description
1,2 X1 , X2 Crystal Oscillator should be connected to these pins
3 V-Bat Connected to Positive terminal of the battery
4 Ground Ground pin of the IC
5,6 SCL and SDA Pins for I2C communication with CPU
7 SQW / Out Square wave output driver pin to obtain square wave frequencies.
8 Vcc Powers the IC typically 5V

DS1307 Features

  • I2C Interface RTC IC

  • Operating Voltage: 5V

  • Less than 500nA current when operating with battery

  • 56bytes SVRAM

  • Operates in power or battery mode

  • Programmable square wave output pin

  • Available in PDIP and SO package

DS1307 Parameter

Type: Clock/Calendar
Features: Leap Year NVSRAM Square Wave Output
Base Product Number: DS1307
Interface: I²C 2-Wire Serial
Memory Size: 56B
Time Format: HH
Date Format: YY-MM-DD-dd
Voltage - Supply Battery: 2V ~ 3.5V
Current - Timekeeping (Max): 200µA @ 5V

What is I2C Protocol

I2C is a serial protocol that transfers data bit by bit.


I2C combines the best characteristics of SPI and UART. We can control many slave devices by using it with a single microcontroller.


Data is transferred in the form of messages in I2C, and the messages are then converted into data. Each message contains an address frame containing a binary address of the devices under control.


The I2C protocol is less expensive to implement than the SPI protocol. SPI controls a single slave device, whereas I2C controls multiple devices.


Let's take a look at the I2C protocol diagram for a better understanding.

I2C protocol picture

DS1307 Working Principle

Let's look at a circuit that uses the DS1307 to get a better understanding of how it works.


In this simple circuit, we connect the chip's first two pins, X1 and X2, to a 32.768 kHz crystal oscillator as the source.


The third pin is linked to a 3V battery.


We provide a 5v supply at Vcc, which can be provided by a microcontroller. If Vcc is not supplied, the read and write conditions are disabled.

working of ds1307

When using the I2c protocol, a device must have start and stop conditions in order to communicate with other devices.


We provide a specific identification and address register to a device in order to obtain the start condition.


For a better understanding of stop and start condition lets have a look at clock figure.

start stop condiction of ds1307

How to Use DS1307

The DS1307 is an 8-pin IC that runs on 5V and communicates with the CPU via the I2C protocol. A typical application circuit for the DS1307 is shown below, taken from the DS1307 datasheet.

ds1307 application circuit

As you can see, the IC has SCL (Serial Clock) and SDA (Serial Data) pins that it uses to communicate with the CPU; both of these pins must be pulled high using a resistor. The IC can be powered by applying 5V to the Vcc pin; if the power fails, it will automatically switch to battery mode, obtaining power from a Lithium cell connected to pin Vbat and ground.


Pins X1 and X2 are used to connect the crystal oscillator, which is typically a 32.7KHz Quartz crystal. The SQW pin generates a PWM square wave with programmable frequencies of 1Hz, 4KHz, 8KHz, or 32KHz. This pin also necessitates the use of a pull-up resistor. Only the I2C protocol is used to exchange data between the CPU and the RTC IC. This communication facilitates both reading and writing.


The IC can provide information such as a Real-Time Clock that counts seconds, minutes, hours, the date of the month, the month, the day of the week, and the year, with Leap-Year Compensation Valid Up to 2100.

DS1307 vs DS3231


The DS3231 is also a low-cost, extremely accurate I2C real- time clock (RTC). But it is a RTC with an integrated temperature- compensated crystal oscillator (TCXO) and crystal. The device incorporates a battery input, and maintains accu- rate timekeeping when main power to the device is inter- rupted.


The main distinction between the DS3231 and the DS1370 is the accuracy of time-keeping.


The DS1307 includes an external 32kHz crystal for timekeeping, the frequency of which is easily affected by external temperature. As a result, the clock is usually off by about five or so minutes per month.


The DS3231, on the other hand, is much more accurate because it includes an internal Temperature Compensated Crystal Oscillator (TCXO) that is unaffected by temperature, allowing it to be accurate to a few minutes per year at most.


DS1307 is still a great value RTC that will serve you well, but DS3231 is recommended for projects that require more accurate time-keeping.

DS1307 Application

  • Robotics

  • Gaming

  • Servers

  • Computer Peripherals

  • GPS

  • Utility power meters

DS1307 Manufacturer

Maxim Integrated develops innovative analog and mixed-signal products and technologies to make systems smaller and smarter, with enhanced security and increased energy efficiency. We are empowering design innovation for our automotive, industrial, healthcare, mobile consumer, and cloud data center customers to deliver industry-leading solutions that help change the world.

DS1307 Package

ds1307 package

Component Datasheet

DS1307 RTC Datasheet


  • What is DS1307?

The DS1307 is a low power Full Binary (BCD) Real Time Clock (RTC) IC with 56 bytes of SVRAM that communicates through I2C Protocol. The IC can work from directly supply on Vcc and switch to Battery automatically when required.

  • How do I know if DS1307 is working?

If you had a Master I2C/SMBus Engine tool built up, you could connect just it and the DS1307 together (with pull-ups and other essentials of course) and quickly see if you can communicate with the DS1307 in a few minutes. If you can, then you know that your DS1307 is working and it could be your C code.

  • How do I reset my RTC DS1307?

So to start, remove the battery from the holder while the Arduino is not powered or plugged into USB. Wait 3 seconds and then replace the battery. This resets the RTC chip.

  • Why RTC is used?

A real-time clock (RTC) is an electronic device (most often in the form of an integrated circuit) that measures the passage of time. Although the term often refers to the devices in personal computers, servers and embedded systems, RTCs are present in almost any electronic device which needs to keep accurate time.


Ordering & Quality

Photo Mfr. Part # Company Description Package PDF Qty Pricing
DS1307 DS1307 Company:Maxim Integrated Remark:Real Time Clock (RTC) IC Clock/Calendar 56B I²C, 2-Wire Serial 8-DIP (0.300", 7.62mm) Package:8-DIP (0.300"", 7.62mm)
In Stock:On Order
DS1307Z DS1307Z Company:Maxim Integrated Remark:Real Time Clock (RTC) IC Clock/Calendar 56B I²C, 2-Wire Serial 8-SOIC (0.154", 3.90mm Width) Package:8-SOIC (0.154"", 3.90mm Width)
In Stock:On Order
125+: $2.00720

Related Articles

LP2951 Application Note: One Button Switch Circuit

Iggy 30 Mar 2021  73

Hi there! In this blog, we will introduce you a simple and stable one-button switch circuit based on LP2951. In daily life, products such as regular electronic equipment and smart instruments are usu...

Continue reading »

LM393 Voltage Comparator: DIY Your Line Following Car

Irene 19 Aug 2020  596

Ⅰ Introduction A line following car designed with LM393 Voltage Comparator capable of tracking on a specific runway. The line following car mainly includes a solar power supply part and a tracking co...

Continue reading »

Introduction to AD620 Application Circuit

Mia 13 Oct 2020  2925

I DescriptionAD620 is a low-power, high-precision instrumentation amplifier. Based on the information provided by the AD company, this blog introduces the characteristics and typical usage of AD620. B...

Continue reading »

LM358N Op Amp: Pinout, Circuit, Datasheet [Video]

Mia 26 Feb 2021  131

LM358 is a dual op-amp IC integrated with two op-amps that are powered by a common power supply, these two amplifiers are independent, high gain, internally frequency compensated operational amplifier...

Continue reading »

4N35 Optocoupler: Pinout, Datasheet, Applications [Video]

Iggy 24 Dec 2020  788

The 4N35 is an optocoupler integrated circuit in which an infrared emitting diode drives a phototransistor. This blog describes the pins, datasheet, equivalence, etc. of the 4N35 optocoupler. Int...

Continue reading »

0 comment

Leave a Reply

Your email address will not be published.


# 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z