DS3231 Real Time Clock RTC Integrated Crystal, 2 Alarms, Extremely Accurate High Precision

DS3231 is a low-cost, high accuracy I²C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. Example DS3231 code & driver are below. Very precise time keeping.

Hello World

Import programDS3231demo

Hello World demo for DS3231 library

Library

Import libraryds3231

Library for DS3231 RTC

Pinout

Datasheet

http://datasheets.maximintegrated.com/en/ds/DS3231.pdf

Notes

The DS3231 is a low-cost, highly accurate I²C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) crystal. The device incorporates a battery input, and maintains high precision timekeeping when main power to the device is interrupted. The integration of the crystal resonator enhances the long-term accuracy of the device as well as reduces the manufacturing part count. The DS3231 is available in commercial (0°C to +70°C) and industrial (-40°C to +85°C) temperature ranges, and is offered in a 16-pin, 300-mil SO package.

The DS3232 variant includes SRAM for the battery back-up of the settings. The DS32B35 has 2K of NVRAM and the DS32C35 has 8K of NVRAM. The DS3231M and the DS3232M use a MEMS resonator which allows the package size to be reduced to half and it resistant to aging, shock and high vibrations.

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 active-low AM/PM indicator. Two programmable time-of-day alarms and a programmable square-wave output are provided. Address and data are transferred serially through an I²C bidirectional bus.

A precision temperature-compensated voltage reference and comparator circuit monitors the status of VCC to detect power failures, to provide a reset output, and to automatically switch to the backup supply when necessary. Additionally, the active-low RST pin is monitored as a pushbutton input for generating a µP reset.

Key Features

  • Two Time-of-Day Alarms
  • Leap-Year Compensation Valid Until 2100
  • Programmable Square-Wave Output Signal
  • Digital Temperature Sensor Output: ±3°C Accuracy
  • Register for Age Trimming
  • Active-Low RST Output/Pushbutton Reset Debounce Input
  • Battery-Backup Input for Continuous Timekeeping
  • Low Power Operation Extends Battery-Backup Run Time
  • 3.3V Operation
  • Underwriters Laboratories® (UL) Recognized
AccuracyTemperature Range
±2ppm (63 sec/year)0°C to +40°C
±3.5ppm (110 sec/year)-40°C to +85°C

Linux driver source code for the RTC DS1307, DS1308, DS1337 to DS1341, DS1388, DS3231

rtc-ds1307.c

Typical applications are for power meters, access control door locks, timecards, DVD/digital recorders, digital camers, GPS, POS devices, medical devices and video games.

Typical Operating Circuit

/media/uploads/phonemacro/typical_application_circuit_ds3231_real_time_clock.jpg

Application Notes

Product Pages

Where to Buy