Skip to main content

DS3231 High Accuracy RTC (Real Time Clock) for Raspberry Pi

The High Accuracy Pi RTC is based on the clock chip DS3231. The DS3231 is a low-cost, extremely accurate I2C realtime clock (RTC). It provides an RTC for Raspberry Pi via the I2C interface. With the clock source from the TCXO(temperature compensated crystal oscillator), the RTC maintains seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator. The clock provides two programmable time-of-day alarms and programmable square-wave output. The INT/SQW pin either generates an interrupt due to alarm condition or outputs a square-wave signal and the selection is controlled by the bit INTCN.

If you want to retain the time infomation even when the Raspberry Pi is powered off, you need to insert a 3V CR1225 lithium cell into the battery holder. And if you are looking for an RTC for your Arduino project, please also take a look at our blog Arduino RTC Tutorial: Using DS1307 RTC with Arduino to easily get started.

Version

Product VersionChangesReleased Date
High Accuracy Pi RTC (DS3231)InitialSep 2018
note
    The battery is not included.

Features

  • Support Raspberry Pi 2/ 3 B/B+/4/Zero
  • Suport seconds,minuutes,hours,day of week,month, year
  • Support 24-hour or 12-hour format with AM/PM indicator
  • Low-Power Consumption
  • Two Time-of-Day Alarms
  • Fast (400kHz) I2C Interface

Specification

ItemValue
Operating Voltage3.3V
Operating Temperature0℃ to +70℃
Accuracy±2ppm from 0°C to +40°C
InterfaceI2C
I2C Address0x68
SizeL: 25mm W: 25mm H: 8mm
Weight4.2g
Package sizeL: 85mm W: 75mm H: 25mm
Gross Weight15g

Typical applications

Any applications need Real Time on Raspberry.

Get Started

Platforms Supported

ArduinoRaspberry Pi

Materials required

Raspberry PiHigh Accuracy Pi RTC(DS3231)
Get One NowGet One Now
note

Please plug the USB cable gently, otherwise you may damage the port. Please use the USB cable with 4 wires inside, the 2 wires cable can't transfer data. If you are not sure about the wire you have, you can click here to buy.

Pin Out

note
  • The chip itself supports the alarm function, we also reserved the relevant hardware interface, but our software library does not include this function(S/INT pin), you need to carry out related software development.

  • RX/TX is not used in this module, but the 6x2 header takes up the RX/TX pin of the Raspberry Pi, so we bring the RX/TX out and come with a 2pin header.

Install

The driver we provide only applied for Raspbian Jessie/Stretch.

tip

If you do not know how to use a raspberry pi, please check here before start.

  • Step 1. Driver Installation

Tap the following command in your terminal

git clone https://github.com/Seeed-Studio/pi-hats.git

When the download finish, tap the following command in your terminal

cd pi-hats
sudo ./install.sh -u rtc_ds3231
  • Step 2. Power off Raspberry Pi
sudo shutdown -h now
  • Step 3. Insert the HAT to Raspberry Pi

Please make sure plug the pin 1 of this hat into the pin 1 of raspberry GPIO, just like the picture above.

  • Step 4. Power up Raspberry Pi

Usage

Now you can use the command to check whether the driver is installed successfully.

./install.sh -l

If you want to uninstall the driver you can use the command below:

sudo ./install.sh -u

Now let's see what the RTC module can do:

Read hardware clock and print result

sudo hwclock -r

Set the system time from the hardware clock

sudo hwclock -s

Set the hardware clock from the current system time

sudo hwclock -w

More usage

hwclock --help

Schematic Online Viewer

Resources

Project

This is the introduction Video of this product

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...