DS3231Temperature-compensated I²C real-time clock
Keep calendar time through a main-power interruption.
DS3231 combines a real-time clock, a quartz resonator and temperature compensation inside one wide SOIC package. It keeps seconds, minutes, hours and calendar information, while two programmable alarms and clock outputs support timed events. No external crystal or crystal load capacitors are needed. A backup supply preserves time when the main rail fails. The selected DS3231SN industrial device covers −40 to +85°C; the clock accuracy is specified over temperature, while the readable temperature value is primarily used for oscillator compensation. This is the sixteen-pin DS3231, not the differently packaged DS3231M. The example uses a 3.3 V host, a 3 V backup cell and pulled-up I²C lines at address 0x68. Read the oscillator-stop flag before trusting an inherited date, then set and validate the calendar when needed. The example clock and drift figures are illustrative, not measurements of a connected device.
Click a lead or use the arrow keys. Top view
32kHz
Function
Temperature-compensated 32.768 kHz output when enabled.
How to connect
Leave open if unused; add a pull-up if used.
Electrical note
EN32kHz controls this output.
VCC
Function
Main operating supply.
How to connect
Use 3.3 V and a local 100 nF bypass.
Electrical note
Recommended 2.3–5.5 V.
INT/SQW
Function
Alarm interrupt or programmable square wave, selected by INTCN.
How to connect
Optional host interrupt with pull-up.
Electrical note
Alarm flags must be cleared in software.
RST
Function
Supply monitor reset output and debounced pushbutton input.
How to connect
Optional pushbutton to GND; no external pull-up required.
Electrical note
Internal 50 kΩ pull-up. This does not reset the calendar.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
NC
Function
Manufacturer requires these unused package connections to ground.
How to connect
Connect to GND.
Electrical note
Despite the NC name, do not leave these pins floating.
GND
Function
Supply and interface reference.
How to connect
Common ground with host and backup cell negative.
VBAT
Function
Maintains the oscillator and calendar when main power is unavailable.
How to connect
Connect a 3 V primary cell, positive here and negative to GND.
Electrical note
2.3–5.5 V; the IC does not charge the cell.
SDA
Function
Bidirectional open-drain data.
How to connect
Host SDA with 4.7 kΩ pull-up to 3.3 V.
SCL
Function
Serial clock input.
How to connect
Host SCL with 4.7 kΩ pull-up to 3.3 V.
Electrical note
Up to 400 kHz; fixed seven-bit address 0x68.
At a glance
Temperature-compensated I²C real-time clock
A compensated oscillator drives the calendar, while the power-control circuit selects the available supply.
Operating profile
DS3231SN#
Electrical and timing limits
Key parameters and their test conditions
- VCC / VBAT
- 2.3–5.5 VConditions / notes: 3.3 V main and 3 V backup in the example
- Clock accuracy, 0–40°C
- ±2 ppmConditions / notes: Specified oscillator conditions
- Clock accuracy, −40–85°C
- ±3.5 ppmConditions / notes: Industrial grade
- I²C rate
- Up to 400 kHzConditions / notes: Fixed address 0x68
- Temperature resolution
- 0.25°CConditions / notes: Signed two-register result
- Temperature accuracy
- ±3°CConditions / notes: Not a precision ambient thermometer
Package details
Follows the selected physical package
- Manufacturer
- Analog Devices
- Part number
- DS3231SN#
- Package
- Wide SOIC-16
- Connections
- 16 pins
- Mounting
- SMD
- Lead pitch
- 1.27 mm
- Package code
- Wide SOIC-16
- Thermal reference
- See operating and package limits
Connections by function
Select a pin to open its function, electrical notes and wiring guidance.
Clock and alarm outputs2 pins
Supply and required ground connections11 pins
Reset monitor1 pins
I²C interface2 pins
Power and retain
Main VCC runs the clock; VBAT maintains time during an interruption.
Compensate the crystal
Temperature is sampled automatically about every 64 seconds.
Read valid time
Check OSF, decode BCD fields and handle the selected hour mode.
±2 ppm corresponds to ±0.1728 seconds per day from the frequency-error term alone. Aging, calibration and conditions still matter.
Pin reference
Select a pin to explore its function and connection.
| Pin | Signal | Type | Function |
|---|---|---|---|
| 32kHz | Open-drain clock output | Temperature-compensated 32.768 kHz output when enabled. | |
| VCC | Main supply | Main operating supply. | |
| INT/SQW | Open-drain interrupt / square wave | Alarm interrupt or programmable square wave, selected by INTCN. | |
| RST | Open-drain reset / button input | Supply monitor reset output and debounced pushbutton input. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| NC | Connect to ground | Manufacturer requires these unused package connections to ground. | |
| GND | Ground | Supply and interface reference. | |
| VBAT | Backup supply | Maintains the oscillator and calendar when main power is unavailable. | |
| SDA | I²C data | Bidirectional open-drain data. | |
| SCL | I²C clock | Serial clock input. |
No pins match. Try a signal name or choose All pins.
Electrical and timing limits
Selected DS3231SN industrial reference
| Parameter | Value | Conditions / notes |
|---|---|---|
| VCC / VBAT | 2.3–5.5 V | 3.3 V main and 3 V backup in the example |
| Clock accuracy, 0–40°C | ±2 ppm | Specified oscillator conditions |
| Clock accuracy, −40–85°C | ±3.5 ppm | Industrial grade |
| I²C rate | Up to 400 kHz | Fixed address 0x68 |
| Temperature resolution | 0.25°C | Signed two-register result |
| Temperature accuracy | ±3°C | Not a precision ambient thermometer |
| Temperature update | About every 64 seconds | Manual conversion also available |
No specifications match. Try a parameter name or a unit.
Frequency accuracy is not a guarantee of total lifetime calendar error.
Calendar register map
Packed BCD, not plain binary
| Parameter | Value | Conditions / notes |
|---|---|---|
| 0x00 / 0x01 | Seconds / minutes | 00–59 |
| 0x02 | Hours | 12-hour or 24-hour format |
| 0x03 | Day of week | 1–7; application chooses the naming convention |
| 0x04 | Date | 1–31 subject to month |
| 0x05 | Month and century bit | Month 1–12 |
| 0x06 | Year | 00–99 |
| Read sequence | Burst from 0x00 | Decode fields and check validity |
No specifications match. Try a parameter name or a unit.
Do not increment a BCD byte as if it were a binary decimal count.
Alarm and square-wave controls
INT/SQW is shared
| Parameter | Value | Conditions / notes |
|---|---|---|
| Alarm 1 | Registers 0x07–0x0A | Includes seconds matching |
| Alarm 2 | Registers 0x0B–0x0D | Minute-resolution matching |
| INTCN = 1 | Alarm interrupt function | Enable A1IE/A2IE as required |
| INTCN = 0 | Square-wave function | RS2/RS1 select frequency |
| Square-wave choices | 1 Hz / 1.024 / 4.096 / 8.192 kHz | Output needs a pull-up |
| A1F / A2F | Latched status flags | Write zero to clear after service |
| 32kHz output | Separate pin 1 | EN32kHz controls enable |
No specifications match. Try a parameter name or a unit.
The reset configuration selects interrupt mode; it does not automatically output a square wave.
Control and status registers
0x0E and 0x0F
| Parameter | Value | Conditions / notes |
|---|---|---|
| EOSC, control bit 7 | 0 enables backup oscillation | With VCC present the oscillator remains enabled |
| BBSQW, bit 6 | Backup square-wave permission | Observe the documented supply conditions |
| CONV, bit 5 | Force temperature conversion | Wait until not busy |
| RS2/RS1, bits 4/3 | Square-wave divider | Used when INTCN is zero |
| INTCN / A2IE / A1IE | Control bits 2 / 1 / 0 | Interrupt selection and enables |
| OSF, status bit 7 | Oscillator stopped / invalid-time warning | Check at startup; clear after setting valid time |
| EN32kHz / BSY / A2F / A1F | Status bits 3 / 2 / 1 / 0 | Preserve unrelated bits on updates |
No specifications match. Try a parameter name or a unit.
Read-modify-write control registers carefully, especially shared alarm flags.
Temperature and aging trim
Calibration support
| Parameter | Value | Conditions / notes |
|---|---|---|
| Temperature MSB | Register 0x11 | Signed integer part |
| Temperature fraction | Register 0x12 bits 7–6 | Quarter-degree fraction |
| Example bytes | 0x19 / 0x40 | +25.25°C |
| Aging register | 0x10, signed eight-bit | Adjusts oscillator trim |
| Positive aging value | Adds capacitance | Slows the oscillator |
| Calibration | Use a reliable frequency/time reference | Do not infer a trim from one noisy sample |
No specifications match. Try a parameter name or a unit.
The temperature sensor is used internally to stabilize timekeeping.
3.3 V host and backup circuit
All required supply connections
| Parameter | Value | Conditions / notes |
|---|---|---|
| VCC2 / GND13 | 3.3 V / ground | Place 100 nF close to the package |
| VBAT14 | 3 V primary cell positive | Cell negative to ground; no charger |
| SDA15 / SCL16 | Host I²C | 4.7 kΩ pull-ups to the host rail |
| NC5–NC12 | Connect every one to ground | Manufacturer requirement |
| RST4 | Optional button to ground | Internal pull-up; do not add an external pull-up |
| 32kHz1 / INT/SQW3 | Optional outputs | Leave open when unused; pull up when used |
No specifications match. Try a parameter name or a unit.
Use the bare-IC pin map; breakout modules may add charging or unrelated circuitry.
Startup and time validation
Reliable host sequence
| Parameter | Value | Conditions / notes |
|---|---|---|
| Apply main power | Initialize I²C at 0x68 | Backup-only first connection has special startup behavior |
| Read status | Inspect OSF | A stopped oscillator can mean invalid time |
| Set time if needed | Write valid BCD calendar fields | Choose hour format explicitly |
| Clear OSF | After establishing correct time | Preserve the other status bits |
| Read coherent calendar | Use a burst transaction | Validate month/day/hour ranges |
| Configure alarms | Write masks then enables | Clear pending flags deliberately |
| Power interruption | Calendar continues from VBAT | Do not assume the rest of the host stays powered |
No specifications match. Try a parameter name or a unit.
First backup-cell connection alone does not start normal timekeeping until VCC or a valid I²C address is applied.
Timestamped logs
Keep dates across host power cycles.
Manufacturer application guideScheduled wake events
Use a pulled-up alarm interrupt.
Manufacturer application guideStand-alone clocks
Read calendar data without an external crystal.
Manufacturer application guideTake it into ProTech
Find DS3231 in the Components Library to place its schematic symbol and connect its pins.
Working clock example available in ProTechOpen ProTech