Introduction
After several months "Out of Stock", DS1307 RTC module has a big upgrade. It comes with a Gravity IIC interface, and the size is also reduced to fit miniaturization application. Gravity I2C DS1307 RTC module is a easy-to-use Real Time Clock module. It is cheap and affordable in most applications such as time clock, data logger, etc.. The new version DS1307 RTC module adopts high precision crystal oscillator which reduces time error dramatically. The test conducted shows the time error is only about 1 second in 24 hours (the average time error of Mechanical Watches is about 20s). The module is powered by single cell CR1220 (service life: 3~5 years). It is smaller and keeps EEPROM 4KB ROM to record information related to alarm clocks and events. Besides, you can set the IIC address by resistance adjustment. The Gravity DS1307 RTC module uses Gravity I2C interface and you can plug it on the DFRobot Gravity IO expansion shield directly. Cooperate with Arduino DS1307 library developed by DFRobot, it is easy to realize functions like setting time and time display. It can be widely used in DA (Data Acquisition).
Specification
- Operating voltage: 5V
- Interface: IIC/I2C (Gravity PH2.0-4P Interface & XH2.54 Pins)
- IC Output Data: Hour, Minutes, Seconds, Week, Day, Month, Year
- Leap-year Compensation
- Accurate calendar up to year 2100
- 1Hz Output Pin
- 56 Bytes of Non-volatile memory available to user
- 4KB ROM of EEPROM
- Size: 0.81inch x 1.06inch (22mm x 27mm)
- Weight: 6g
Board Overview

Num | Label | Description |
---|---|---|
1 | VCC | 5V |
2 | GND | GND |
3 | SCL | I2C-Clock |
4 | SDA | I2C-Data |
5 | SQ | SQ |
6 | VCC | 5V |
7 | GND | GND |
8 | SCL | I2C-Clock |
9 | SDA | I2C-SDA |
Tutorial
In this tutorial, you can set and read time.
Requirements
Hardware
- DFRduino UNO (or similar) x 1
- Gravity: I2C DS1307 RTC Module
- M-M/F-M/F-F Jumper wires
Software
- Arduino IDE, Click to Download Arduino IDE from Arduino®
Connection Diagram

Sample Code
Please download DFRobot DS1307 RTC library. How to install Libraries in Arduino IDE
Note: #define updata_flag 0 //1 updata time,0 only show time |
---|
- When flag is 0, the sample code just shows time
- When flag is 1, the sample code only to set time
- Please set time first and modify the value from 1 to 0 to only show time
Expected Results

Appendix: EEPROM IIC Address Setting


FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum. |
---|
More Documents
- DFRobot DS1307 RTC Library
- [Schematic & Layout](https://github.com/DFRobot/DS1307_RTC/raw/master/Schematic & Layout.pdf)
- DFRobot DS1307 RTC Repostory
- Time Synchronization with Computer