Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

DS3231 real-time clock (RTC) module

DS3231 real-time clock module (ZS-042): pins, 0x68 + 0x57 EEPROM addresses, RTClib, and why a CR2032 can be overcharged on this board.

I2C

Community draft — report a mistake

CategoryTiming
InterfaceI2C
Voltage2.3–5.5 V
Typical price₹150

3.3 V or 5 V? The module pulls SDA/SCL up to its own VCC. On a 3.3 V board, power it from 3.3 V — the DS3231 keeps excellent time at 3.3 V.

The DS3231 is a temperature-compensated real-time clock: it keeps the date and time while your board is off, running from a coin cell. It is far more accurate than the older DS1307, which makes it the right choice for timers, data loggers and irrigation schedules.

The coin-cell trap. The common blue ZS-042 board has a resistor and diode that try to charge the backup cell. That is fine for a rechargeable LIR2032 but bad for an ordinary CR2032, which must never be charged. With a CR2032, remove the charging resistor (or the diode) — or fit an LIR2032 instead.

The same board carries an AT24C32 EEPROM at 0x57 you can use for a few kilobytes of settings. The SQW pin can wake a sleeping microcontroller on an alarm.

Pinout

PinWhat it does
32K32.768 kHz square-wave output (optional)
SQWAlarm interrupt / programmable square wave (open-drain)
SCLI2C clock
SDAI2C data
VCCSupply, 2.3–5.5 V
GNDGround

I2C address:0x680x57

Library

RTClib by Adafruit
Arduino IDE → Library Manager → search the name above. Each guide lists the exact version we compile against.

Use it with

Common errors

Time resets to 2000-01-01 after power loss

The backup cell is flat or missing. Fit a fresh coin cell (and see the charging note below before you use a CR2032).

Two I2C addresses show up

Normal: 0x68 is the DS3231 and 0x57 is the AT24C32 EEPROM on the same board.

Clashes with an MPU6050

Both answer at 0x68. Pull the MPU6050’s AD0 pin high to move it to 0x69.

Time drifts by minutes a month

You probably have a DS1307 or a fake DS3231. A genuine DS3231 is temperature-compensated and drifts about a minute a year.

↑↓ to move · Enter to open