Comparison · Beginner · 3 min read
DS3231 vs DS1307 Real-Time Clock Modules
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
A real-time clock module keeps the date and time running from a coin cell while your project is off. The DS3231 has a temperature-compensated oscillator accurate to about 2 ppm, roughly a minute a year, runs from 2.3 to 5.5 V and has two alarms. The cheaper DS1307 needs 5 V and an external crystal, so it can drift by minutes a month. Both use I2C address 0x68.
Key specs at a glance
- Interface
- I2C, address 0x68 (both chips)
- DS3231 accuracy
- ±2 ppm from 0 to 40 °C, about ±1 minute per year
- DS1307 accuracy
- Depends on the crystal, often ±1 to 2 minutes per month
- Supply
- DS3231 2.3 to 5.5 V; DS1307 4.5 to 5.5 V
- Backup
- CR2032 (or LIR2032 on some modules)
- Extras
- DS3231: 2 alarms, 32 kHz output, temperature reading; modules often add an AT24C32 EEPROM at 0x57
DS3231 or DS1307?
| DS3231 | DS1307 | |
|---|---|---|
| Oscillator | Built-in temperature-compensated crystal (TCXO) | External 32.768 kHz crystal |
| Typical drift | About 1 minute per year | Minutes per month |
| 3.3 V boards | Yes | No, needs 5 V |
| Alarms | 2, with interrupt pin | None |
| Extra | Temperature sensor (±3 °C) | 56 bytes battery-backed RAM |
| Best for | Loggers, timers, clocks | Simple 5 V clocks where cost matters most |
- Oscillator
- DS3231:
- Built-in temperature-compensated crystal (TCXO)
- DS1307:
- External 32.768 kHz crystal
- Typical drift
- DS3231:
- About 1 minute per year
- DS1307:
- Minutes per month
- 3.3 V boards
- DS3231:
- Yes
- DS1307:
- No, needs 5 V
- Alarms
- DS3231:
- 2, with interrupt pin
- DS1307:
- None
- Extra
- DS3231:
- Temperature sensor (±3 °C)
- DS1307:
- 56 bytes battery-backed RAM
- Best for
- DS3231:
- Loggers, timers, clocks
- DS1307:
- Simple 5 V clocks where cost matters most
Wiring and code
Connect VCC to 3.3 V or 5 V, GND to GND, SDA to SDA and SCL to SCL (A4 and A5 on an Uno, GPIO 21 and 22 on a classic ESP32 by default). Modules include pull-up resistors, so no extras are needed for one I2C device.
Install the RTClib library. Set the time once with rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));, upload, then comment that line out and upload again, otherwise the clock resets to the compile time on every boot. Read it with DateTime now = rtc.now();. On Wi-Fi boards you can sync the RTC from NTP whenever the network is up and fall back to the RTC when it is not.
The coin-cell charging trap
Many low-cost DS3231 modules include a resistor and diode that trickle-charge the backup cell. That is meant for a rechargeable LIR2032. A normal CR2032 is not rechargeable, and charging it can make it swell or leak. Either fit a LIR2032 or remove the charging resistor (or diode) on the module if you use a CR2032. A CR2032 in a DS3231 typically lasts several years because the chip draws only a few µA on battery.
Try it: I2C pull-up calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Leaving the rtc.adjust() line in the sketch.
- Charging a non-rechargeable CR2032 on a DS3231 module.
- Running a DS1307 from 3.3 V.
- Forgetting the backup cell, so time is lost at power-off.
- Two devices at 0x68 on one bus, such as an MPU6050 and an RTC, without changing the MPU6050 address.
Frequently asked questions
How accurate is the DS3231?
About ±2 ppm from 0 to 40 °C, which is roughly a minute a year.
Can I use a DS3231 with ESP32 or Raspberry Pi Pico?
Yes. It runs from 3.3 V and uses standard I2C.
Why does my RTC reset to the same time after every restart?
The sketch still calls rtc.adjust() at start-up. Remove it after setting the time once.
Does the RTC module conflict with an MPU6050?
Both default to 0x68. Pull the MPU6050's AD0 pin HIGH to move it to 0x69.
How long does the coin cell last?
Usually several years in a DS3231 when main power is present most of the time.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 142 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- Analog Devices (Maxim) DS3231 datasheet
- Analog Devices (Maxim) DS1307 datasheet
- Adafruit RTClib documentation
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.



