Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
This is an Arduino Library that has deep support for Real Time Clock modules.
Supported RTC chip sets
Full support including burst mode use and charging settings
Full support including squarewave output pin and memory access
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.
Full support including squarewave output pin, alarms, and memory access.
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 Epoch time formats. It also supports 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.