Overview

The DS1307 is a low-power, full binary-coded decimal (BCD) real-time clock (RTC) IC manufactured by Maxim Integrated (Analog Devices). It counts seconds, minutes, hours, day of the week, date of the month, month, and year with leap-year compensation valid up to the year 2100.

The chip incorporates a 32.768 kHz32.768\text{ kHz} quartz crystal oscillator circuit, a power-sense circuit that automatically switches to a 3V CR2032 lithium battery backup during power outages, and 56 bytes of nonvolatile battery-backed SRAM for storing custom user settings.

Quick reference

Operating Voltage (VCC)4.5 V to 5.5 V DC (5.0 V required)
Backup Battery Voltage (VBAT)2.0 V to 3.5 V DC (3 V CR2032 coin cell)
Oscillator Frequency32.768 kHz (requires external crystal with 12.5 pF12.5\text{ pF} load capacitance)
Nonvolatile SRAM56 bytes (address 0x08 to 0x3F)
Communication InterfaceI2C (fixed slave address 0x68, up to 100 kHz)
Square Wave Output (SQW/OUT)Programmable output frequency: 1 Hz, 4.096 kHz, 8.192 kHz, 32.768 kHz
Backup Battery Current<500 nA< 500\text{ nA} (battery lasts 10+ years)

Pinout

8-Pin DIP / SOIC Package & Tiny RTC Module Header

text
           ┌──────────┐
        X1 ──│ 1      8 │── VCC (5V)
        X2 ──│ 2      7 │── SQW/OUT
      VBAT ──│ 3      6 │── SCL
       GND ──│ 4      5 │── SDA
           └──────────┘
PinNameTypeDescription
1X1Oscillator InputConnect to 32.768 kHz crystal terminal 1
2X2Oscillator OutputConnect to 32.768 kHz crystal terminal 2
3VBATBattery InputBackup +3V CR2032 lithium battery input
4GNDPowerGround (0 V)
5SDADigital I/OI2C Serial Data line
6SCLDigital InputI2C Serial Clock line
7SQW / OUTDigital OutputSquare-Wave / Interrupt output line (Open-drain)
8VCCPower InputPrimary supply voltage (+4.5 V to +5.5 V DC)

Specifications

ParameterSymbolMinTypMaxUnitConditions
Primary Supply VoltageVCCV_{CC}4.55.05.5VDC
Battery VoltageVBATV_{BAT}2.03.03.5VCR2032 Lithium coin cell
Active Supply CurrentICCAI_{CCA}0.81.5mAVCC=5.0 VV_{CC} = 5.0\text{ V}, I2C active
Battery Backup CurrentIBATI_{BAT}300500nAVCC=0 VV_{CC} = 0\text{ V}, VBAT=3.0 VV_{BAT} = 3.0\text{ V}
Power-Fail ThresholdVPFV_{PF}1.21 VBATV_{BAT}1.25 VBATV_{BAT}1.29 VBATV_{BAT}VSwitch to battery mode threshold
Crystal Load CapacitanceCLC_L12.5pF32.768 kHz32.768\text{ kHz} quartz crystal

Register Map (BCD Format)

Time and calendar data are stored in Binary-Coded Decimal (BCD) format across registers 0x00 to 0x06:

AddressRegisterBit 7 (MSB)Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0 (LSB)Range
0x00SECONDSCH10 SecondsSeconds00–59
0x01MINUTES010 MinutesMinutes00–59
0x02HOURS012/2410Hr / AM/PMHours01–12 / 00–23
0x03DAY00000Day of Week01–07
0x04DATE0010 DateDate01–31
0x05MONTH00010 MonthMonth01–12
0x06YEAR10 YearYear00–99
0x07CONTROLOUT00SQWE00RS1RS0Control byte
0x080x3FRAM56 Bytes General Purpose Non-Volatile User SRAM0x000xFF
Note

Clock Halt (CH) Bit: Bit 7 of register 0x00 is the Clock Halt (CH) bit. When CH = 1, the internal crystal oscillator is STOPPED and the clock does not run. Software MUST write CH = 0 during initialization to start counting time!

Wiring

DS1307 Module PinMicrocontroller (Arduino Uno / ESP32)Notes
VCC5VMust be 5.0 V DC (Does NOT work on 3.3V)
GNDGNDGround
SDASDA (A4 on Uno, GPIO21 on ESP32)4.7 kΩ4.7\text{ k}\Omega pull-up resistor
SCLSCL (A5 on Uno, GPIO22 on ESP32)4.7 kΩ4.7\text{ k}\Omega pull-up resistor
SQWDigital Pin (optional 1 Hz pulse interrupt)Open-drain output

Common mistakes

  • Powering with 3.3V: The DS1307 requires VCC4.5 VV_{CC} \ge 4.5\text{ V}. Operating on 3.3V causes the power-fail comparator to assume main power was lost, locking out I2C access. For native 3.3V systems, use the DS3231.
  • Forgetting to clear Clock Halt (CH) bit: New DS1307 ICs default to CH = 1. Time values stay frozen until software writes 0x00 to register 0x00.
  • Crystal temperature drift: Unlike the DS3231 (which has an integrated TCXO temperature-compensated crystal), the DS1307 uses an external uncompensated crystal. Ambient temperature changes can cause time drift up to 1–2 minutes per month.

Notes

  • Tiny RTC modules often contain an 8-pin 24C32 EEPROM chip on the same I2C bus at address 0x50.

Assets & downloads