DS3231 / AT24C32 Real-Time Clock (RTC)

DS3231 / AT24C32 Real-Time Clock (RTC) image

View on Amazon

Overview

The DS3231 is a highly accurate I²C real-time clock with an integrated temperature-compensated crystal oscillator, providing precise timekeeping and calendar functions, along with programmable alarms and square-wave output, suitable for applications requiring reliable timekeeping.

About DS3231 / AT24C32 Real-Time Clock (RTC)

The DS3231 is an ultra-accurate I²C real-time clock (RTC) with a built-in temperature-compensated crystal oscillator (TCXO), ensuring stable timekeeping even under temperature fluctuations. It provides leap-year compensation up to 2100 and supports battery backup for uninterrupted operation.

Key Features

  • High-Precision RTC – More accurate than the DS1307.
  • Built-in Temperature Compensation – Ensures consistent timekeeping across temperature changes.
  • Battery Backup Support – Keeps time even during power loss.
  • I²C Communication – Simple integration with ESP32, Arduino, and other microcontrollers.

With its precision and reliability, the DS3231 is perfect for data logging, alarms, scheduling, and real-time event tracking. 🚀

Where to Buy

Get Your DS3231 / AT24C32

DS3231 / AT24C32 Real-Time Clock (RTC)

Starting from

3.50$ per unit

Amazon com
Amazon.com Ships worldwide
Amazon de
Amazon.de Ships to EU
Aliexpress
AliExpress Best value option

💡 Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

Technical Specs

DS3231 / AT24C32 Specifications

Complete technical specification details for DS3231 / AT24C32 Real-Time Clock (RTC)

📊 Technical Parameters

Timekeeping Range Seconds to Years (with Leap-Year Compensation up to 2100)
Operating Voltage 2.3V to 5.5V
Timekeeping Accuracy ±2 ppm from 0°C to +40°C; ±3.5 ppm from -40°C to +85°C
Interface I²C (up to 400 kHz)
Clock Output Frequencies 1 Hz, 1.024 kHz, 4.096 kHz, 8.192 kHz
Alarm Function Two Programmable Time-of-Day Alarms
Temperature Sensor Accuracy ±3°C
Operating Temperature 0°C to +70°C (Commercial); -40°C to +85°C (Industrial)
Pin Configuration

DS3231 / AT24C32 Pinout

The DS3231 pinout includes I2C communication pins (SDA, SCL), power supply (VCC, VBAT), ground, interrupt/square wave output (INT/SQW), 32kHz output, and reset pin. It features a built-in temperature-compensated crystal oscillator (TCXO).

Visual Pinout Diagram

Pinout Diagram Primary
DS3231 / AT24C32 Real-Time Clock (RTC) pinout
8
Total Pins

Pin Types

Power
1
Control
1

Quick Tips

Ultra-accurate

RTC with built-in TCXO (Temperature-Compensated Crystal Oscillator),Accuracy: ±2ppm (0°C to +40°C), ±3.5ppm (-40°C to +85°C),Real-time clock: seconds, minutes, hours, day, date, month, year,Leap year compensation up to 2100

Two

programmable time-of-day alarms,I2C interface with address 0x68,Operating voltage: 2.3V to 5.5V (both VCC and VBAT)

Integrated

temperature sensor (±3°C accuracy),No external crystal required (built-in TCXO),Battery backup with automatic switchover

Pin Descriptions

Pin NameTypeDescriptionNotes
1 VCC
Power

Primary power supply input (2.3V to 5.5V)

Main power source, wide voltage range

2 GND
Ground

Ground connection

Common ground

3 SDA
I2C Data

I2C Serial Data line

Bidirectional data line (requires pull-up)

4 SCL
I2C Clock

I2C Serial Clock line

Clock line (requires pull-up)

5 VBAT
Backup Power

Battery backup input (2.3V to 5.5V)

CR2032 battery for timekeeping during power loss

6 INT/SQW
Output

Interrupt or square wave output

Programmable alarm interrupt or square wave

7 32KHz
Output

32.768 kHz output

Optional 32kHz clock output

8 RST
Control

Reset input/output

Optional reset control (active low)

Connection Guide

Wiring DS3231 / AT24C32 to ESP32

Connect the DS3231 to your ESP32 via I2C (SDA and SCL pins). The module has a wide voltage range (2.3V to 5.5V) and includes a built-in temperature-compensated crystal oscillator for superior accuracy. A CR2032 battery provides backup power.

Visual Wiring Diagram

Wiring Diagram Recommended
DS3231 / AT24C32 Real-Time Clock (RTC) wiring with ESP32
7
Connections

Connection Status

Required
4
Optional
3

Protocol

I2C

Pin Connections

DS3231 / AT24C32 PinConnectionESP32 PinDescription
1 VCC Required
3.3V or 5V

Primary power supply (2.3V to 5.5V)

2 GND Required
GND

Ground connection

3 SDA Required
GPIO21

I2C data line (with 4.7kΩ pull-up)

4 SCL Required
GPIO22

I2C clock line (with 4.7kΩ pull-up)

5 VBAT Optional
CR2032 Battery

Backup battery (3V)

6 INT/SQW Optional
GPIO (optional)

Interrupt/square wave output

7 32KHz Optional
GPIO (optional)

32kHz clock output

I2C

address: 0x68 (same as DS1307, cannot coexist on same bus)

Works

with both 3.3V and 5V (ESP32 uses 3.3V)

Pull-up

resistors (4.7kΩ) required on SDA and SCL

Most

modules include pull-up resistors and CR2032 battery holder

MUCH

more accurate than DS1307 due to TCXO

Built-in

temperature compensation eliminates crystal drift

No

external crystal needed (TCXO integrated)

INT/SQW

can trigger interrupts for alarms

Use

RTClib or DS3231 library for Arduino/ESP32

Best

choice for precision timekeeping applications

Often

includes AT24C32 EEPROM (32KB) on same module

Help & Support

DS3231 / AT24C32 Troubleshooting

Common issues and solutions to help you get your sensor working

Common Issues

Debugging Tips

Code Examples

DS3231 / AT24C32 Programming Examples

Ready-to-use code examples for different platforms and frameworks

Summary

Wrapping Up DS3231 / AT24C32

The ESP32 DS3231 / AT24C32 Real-Time Clock (RTC) is a powerful RTC sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

Best Practices

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Safety First

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.

Ready to Start Building?

Now that you have all the information you need, it's time to integrate the DS3231 / AT24C32 into your ESP32 project and bring your ideas to life!