Skip to main content

DS1307 I2C Real Time Clock (RTC)

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.


Pin Configuration

Pin Number

Pin Name



X1 , X2

Crystal Oscillator should be connected to these pins



Connected to Positive terminal of the battery



Ground pin of the IC



Pins for I2C communication with CPU


SQW / Out

Square wave output driver pin to obtain square wave frequencies.



Powers the IC typically 5V


DS1307 Specifications

  • 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


Equivalent for DS1307: PCF8523, DS1820, DS1338

Other RTC IC’s: DS3231


How to use DS1307

The DS1307 is a 8-pin IC which operates on 5V and communicates with CPU though I2C protocol. A typical application circuit for the DS1307 from DS1307 datasheet is shown below.


As you can see the IC has SCL (Serial Clock) and SDA (Serial Data) pins using which it communicates to the CPU, both these pins has to be pulled high using a resistor. The IC can be powered by providing 5V on the Vcc pin, when the power fails it will automatically switch to battery operated mode in which it will obtain power with Lithium cell connected to pin Vbat and ground.

The pins X1 and X2 are used to connect the crystal oscillator; typically a 32.7KHz Quartz crystal is used. The SQW pin is used to provide a PWM square wave of programmable frequencies in the range of 1Hz, 4KHz, 8KHZ or 32KHz. This pin also requires a pull up resistor. Data between the CPU and RTC IC is exchanged only though the I2C protocol. Both Read and write happens through this communication. The IC can provide details like Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the Week, and Year with Leap-Year Compensation Valid Up to 2100.



· Robotics

· Gaming

· Servers

· Computer Peripherals


· Utility power meters


2D-Model (PDIP 8-pin)

DS1307 I2C Real Time Clock 2-D Model

Component Datasheet

Related Post

Join 20K+subscribers

We will never spam you.

* indicates required

Be a part of our ever growing community.