Skip to content
Michael Miller edited this page Jul 28, 2023 · 15 revisions

Please consider donating to the cause.
Donate

For quick questions and support:

Overview

This is an Arduino Library that has deep support for Real Time Clock modules.

Please see the FAQ for common questions and answers.

Supported RTC chip sets

DS1302

Full support including burst mode use and charging settings

DS1307

Full support including squarewave output pin and memory access

DS3231

Full support including squarewave output pin and alarms. Memory access to at24cXX that is often included on modules is also supported through a separate object.

DS3232

Full support including squarewave output pin, alarms, and SRAM memory access.

DS3234

Full support including squarewave output pin, alarms, and memory access.

PCF8563 / BM8563

Full support including squarewave output pin, alarm, and timer.

There are several examples that will help you get started. They range from simple to complex and are always a good reference.

Connecting the Devices

The RTC devices expose either i2c, SPI, or a ThreeWire interface. I2c uses two digital connections labeled SDA and SCL. SPI uses four digital connections labeled MISO, MOSI, CLK, CS (SS). ThreeWire uses three digital connections labeled SCLK(CLK), IO (DAT), CE (RST). These need to be connected to the PINs exposed by your Arduino board labeled the same way. This varies from board to board so you will need to consult the Arduino reference documents for which pins are the SDA and SCL.

For ESP8266, I2C default to SDA = GPIO04 (D2) and SCL = GPIO05 (D1); but check with your specific board.

For ESP8266, SPI default to MISO = GPIO12 (D6), MOSI = GPIO13 (D7), and CLK = GPIO14 (D5); with CS (SS) set to any open pin; but check with your specific board.

The RTC devices also require power. Make sure that VCC is connected to the proper voltage that your device requires. DS1307 requires 5v while the DS1302, DS3231 and DS3234 can use either 3.3v or 5v. The GND must be connected to the Arduino GND even if you are not powering the RTC from the Arduino voltage pins.

This object will be used to get and set the date and time. It supports being constructed with various time formats from strings to standard NTP and UNIX time formats. It also supports read only access to individual date and time value for year, month, day, hour, minute, and seconds.

This object will be used to get the temperature from the RTC module if it supports it.

This object will expose the features of the DS1302 RTC chip including a ThreeWire support class.

This object will expose the features of the DS1307 RTC chip including access to the onboard memory.

This object will expose the features of the DS3231 RTC chip including access to the two alarm features.

This object will expose the features of the at24cxx eeprom chip that is often included on the DS3231 modules.

This object will expose the features of the DS3232 RTC chip including access to the two alarm features and SRAM memory.

This object will expose the features of the DS3234 RTC chip including access to the two alarm features.

This object will expose the features of the PCF8563/BM8563 RTC chip including access to the alarm and timer features.

This object will manage user defined alarms with specific date and time start with a repeating period. It also manages a software RTC on the microcontroller.