DS3231 High-Precision RTC Module with EEPROM & Battery Backup
The DS3231 RTC Module is a high-accuracy real-time clock module designed for Arduino, ESP32, Raspberry Pi and other embedded systems that require reliable date and timekeeping.
At the heart of the module is the DS3231 Extremely Accurate RTC, which integrates a temperature-compensated crystal oscillator (TCXO) to provide significantly better timekeeping accuracy than basic RTC modules.
The module communicates through the standard I²C interface and can maintain the date and time using a backup battery when the main system power is disconnected.
Many common DS3231 module boards also include an AT24C32 I²C EEPROM, providing additional non-volatile memory for storing configuration or small amounts of user data.
Technical Specifications
-
RTC IC: DS3231
-
Product Type: High-Precision Real-Time Clock Module
-
Interface: I²C
-
DS3231 Operating Voltage: 2.3–5.5V
-
Typical Module Supply: 3.3V / 5V
-
RTC I²C Address: 0x68
-
Clock Accuracy: ±2ppm from 0°C to +40°C
-
Clock Accuracy: ±3.5ppm from -40°C to +85°C
-
Time Format: 12-Hour or 24-Hour
-
Calendar: Seconds, Minutes, Hours, Day, Date, Month and Year
-
Leap-Year Compensation: Valid Through 2100
-
Alarms: 2 Programmable Time-of-Day Alarms
-
Temperature Sensor: Integrated
-
Temperature Accuracy: Approx. ±3°C
-
Temperature Resolution: 0.25°C
-
Square-Wave Output: Programmable
-
Backup Battery Support: Yes
-
Optional Module EEPROM: AT24C32 on Common Module Versions
-
EEPROM Capacity: 32Kbit / 4KB
-
EEPROM I²C Address: Typically 0x57 on Common Modules
High-Accuracy Real-Time Clock
Unlike basic RTC devices that depend on an external crystal, the DS3231 integrates a temperature-compensated crystal oscillator.
This helps compensate for frequency changes caused by temperature variations and provides excellent timekeeping accuracy.
Typical accuracy is:
±2ppm from 0°C to +40°C
and:
±3.5ppm from -40°C to +85°C
At ±2ppm, the theoretical clock error is approximately one minute per year, making the DS3231 an excellent choice for projects requiring reliable long-term timekeeping.
Complete Date & Time Tracking
The DS3231 keeps track of:
- Seconds
- Minutes
- Hours
- Day of the Week
- Date
- Month
- Year
It automatically adjusts the date for months with fewer than 31 days and includes leap-year correction through the year 2100.
12-Hour & 24-Hour Modes
The RTC supports both:
12-Hour Mode with AM/PM
and:
24-Hour Mode
allowing the display format to be selected through software.
I²C Communication
The DS3231 communicates using the standard I²C bus, requiring only two communication lines:
-
SDA – Serial Data
-
SCL – Serial Clock
The DS3231 RTC normally uses I²C address:
0x68
This makes it easy to interface with popular microcontrollers and development boards.
Battery Backup
A backup battery allows the DS3231 to continue keeping time when the main system power is disconnected.
When main power returns, the microcontroller can immediately read the current date and time without requiring the clock to be set again.
This is useful for:
- Data Loggers
- Automation Systems
- Digital Clocks
- Scheduled Controllers
- Offline Equipment
- IoT Systems
Two Programmable Alarms
The DS3231 includes two programmable time-of-day alarms.
These can be configured to generate an interrupt at selected times, allowing a microcontroller to perform scheduled operations or wake from a low-power state.
Programmable Square-Wave Output
The RTC can generate programmable square-wave signals at:
- 1Hz
- 1.024kHz
- 4.096kHz
- 8.192kHz
This output can be useful for timing, synchronization and clock-generation applications.
Integrated Temperature Sensor
The DS3231 includes an internal temperature sensor used primarily to compensate the crystal oscillator.
Temperature data can also be read digitally by the microcontroller.
Typical specifications are:
-
Resolution: 0.25°C
-
Accuracy: Approximately ±3°C
It can be useful for basic board/environment temperature monitoring, but it should not replace a dedicated precision temperature sensor when accurate environmental measurement is required.
AT24C32 EEPROM
Many common DS3231 module boards also include an AT24C32 EEPROM.
The EEPROM provides:
32Kbit / 4KB of non-volatile memory
that can be used to store:
- Configuration Settings
- Calibration Values
- Device Parameters
- Small Data Records
- User Preferences
The EEPROM retains its contents even when power is removed.
Arduino, ESP32 & Raspberry Pi Compatible
The DS3231 module can be used with many development platforms, including:
- Arduino UNO
- Arduino Nano
- Arduino Mega
- ESP32
- ESP8266
- Raspberry Pi
- STM32
- PIC
- AVR
- Other I²C-Compatible Controllers
Typical Connections
A common DS3231 module provides:
VCC → Power
GND → Ground
SDA → I²C Data
SCL → I²C Clock
Additional pins may include:
SQW → Square-Wave / Interrupt Output
32K → 32.768kHz Output
Pin availability depends on the specific module version.
Applications
Ideal for:
- Digital Clocks
- Alarm Clocks
- Data Loggers
- Arduino Projects
- ESP32 Projects
- Raspberry Pi Projects
- IoT Devices
- Home Automation
- Scheduled Controllers
- Smart Agriculture
- Robotics
- Industrial Automation
- Attendance Systems
- Access-Control Systems
- Environmental Monitoring
- Offline Systems
- Time-Stamped Sensor Data
DS3231 vs DS1302
Compared with the DS1302, the DS3231 provides several advantages:
DS3231
- High-accuracy TCXO
- I²C interface
- Two programmable alarms
- Integrated temperature sensor
- Excellent long-term accuracy
- Common module versions include EEPROM
DS1302
- Lower-cost basic RTC
- 3-wire serial interface
- Lower timekeeping accuracy
- Suitable for less demanding clock applications
For most projects where accurate timekeeping is important, the DS3231 is generally the better choice.
Important Battery Warning
Many inexpensive DS3231 modules include a charging circuit intended for a rechargeable LIR2032 battery.
A standard CR2032 battery is non-rechargeable and should not be charged.
Before installing a CR2032, verify whether the specific module has an active battery-charging circuit.
If the module is designed to charge the backup cell, use the appropriate rechargeable battery specified for that module or modify/disable the charging circuit where appropriate.
Important Notes
-
The DS3231 communicates using I²C.
-
Default RTC address is 0x68.
- Check SDA and SCL voltage compatibility with your controller.
- The integrated temperature sensor is primarily used for oscillator compensation.
- EEPROM availability depends on the exact module version.
- Backup battery may not be included.
- Check the battery type and charging circuit before installing a coin cell.
- Do not attempt to recharge a standard CR2032 lithium coin cell.
Package Includes
1 × DS3231 High-Precision Real-Time Clock Module
Backup battery is not included.