MD_DS3231 Real Time Clock Library  1.3
Library to control DS3231 high precision clock with alarms
Arduino DS3231 Library

The Maxim DS3231 Real Time Clock IC

The DS3231 is a low-cost, extremely accurate I2C real time clock (RTC) with an integrated temperature compensated crystal oscillator (TCXO) and crystal.

Microprocessor interface is exclusively through an I2C bidirectional bus.

The device

  • incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted.
  • maintains seconds, minutes, hours, day, date, month, and year information.
  • automatically adjusts dates for months with fewer than 31 days, including corrections for leap year.
  • operates in either the 24-hour or 12-hour format with an AM/PM indicator.
  • includes two programmable time-of day alarms.
  • has and frequency programmable square-wave output.

Precision is maintained through a temperature-compensated voltage reference and comparator circuit monitors the status of Vcc to detect power failures and to automatically switch to the backup supply when necessary.

This library features access to all on-chip features

  • Read and write clock time registers
  • Read and write alarm registers and controls
  • Read/write clock and alarm registers as RAM
  • Control of square wave generator (on/off & frequency)
  • Control of clock features (Square Wave type and on/off, 12/24H, day of week, etc)

If you like and use this library please consider making a small donation using PayPal


Software Overview


Revision History

Dec 2018 version 1.3.0

  • Memory footprint reduced contributed by blemasle (Pull request #9)

Dec 2018 version 1.2.5

  • Fixes contributed by blemasle (issue #8)
    • In packAlarm, the DD/DY condition was reversed
    • packAlarm BCD encoded the hour to early
    • When using 12H clock mode, pm indicator was overwritten by packAlarm and writeTime. Additionally, can now use both 5PM and 17 format

Jun 2018 version 1.2.4

  • Fixed compiler warnings
  • Added overloaded constructor for ESP8266

Apr 2018 version 1.2.3

  • Small fixes to code

Feb 2017 version 1.2.2

  • Fixed text in header file

May 2017 version 1.2

  • Removed deprecated language features warnings for examples
  • Additional comments for examples

Apr 2016 version 1.1

  • Fixed bug when setting time in 12 hour mode
  • Added now() and isrunning() methods for compatibility with MD_DS1307 library

Aug 2015 version 1.0

  • Initial version created from basic MD_1307 Library

Copyright

Copyright (C) 2015 Marco Colli. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA