Page 1
5 Trouble shooting Introduction The DS1307 Real Time Clock developed by one of our designers: Waiman. The module comes fully assembled and pre-programmed with the current time (ok, so it's our current time - MST). The included Lithium coin cell battery (CR1225 41mAh) will run the module for a minimum of 9 years (17 years typical) without external 5V power.
Page 2
Dimensions: 28mm x 25mm x 8mm Application Real time monitoring system Timer Tutorial Connection diagram Wiring instruction GND——GND VCC——5V SDA——A4 SCL——A5 DS——D2 Sample Code Please download and install the Arduino library first. how to install libary http://www.dfrobot.com/image/data/DFR0151/V1.1/Arduino%20library.zip https://www.arduino.cc/en/Guide/Libraries#.UxU8mdzF9H0 Arrow.com. Arrow.com. Downloaded from Downloaded from...
Page 3
#include <Wire.h> #include <DS1307.h> about set time: format: year,month,day,week,hour,min,sec example: 14,03,25,02,13,55,10 2014.03.25 tuesday 13:55:10 String comdata = ""; int mark=0; //store the current time data int rtc[7]; //store the set time data byte rr[7]; //light pin int ledPin = //initial light void setup() DDRC |= _BV(2) | _BV(3);...
Page 4
RTC.set(DS1307_DATE, 12); RTC.set(DS1307_MTH, 2); RTC.set(DS1307_YR, 12); //start rtc time RTC.start(); //RTC.SetOutput(LOW); //RTC.SetOutput(HIGH); //RTC.SetOutput(DS1307_SQW1HZ); //RTC.SetOutput(DS1307_SQW4KHZ); //RTC.SetOutput(DS1307_SQW8KHZ); RTC.SetOutput(DS1307_SQW32KHZ); void loop() int i; //get current time RTC.get(rtc, true); //print current time format : year month day week hour min sec for (i = 0; i < 7; i++) Serial.print(rtc[i]);...
Page 5
while (Serial.available() > 0) comdata += char(Serial.read()); delay(2); mark = 1; //if data is all collected,then parse it if (mark == 1) Serial.println(comdata); Serial.println(comdata.length()); //parse data for (int i = 0; i < comdata.length() ; i++) //if the byte is ',' jump it,and parse next value if (comdata[i] == ',') j++;...
Page 6
= 0; Result Trouble shooting Thank the guy to share this great way to update DS1307 clock through computer, in this way, you could get the precise time. Guide Link http://www.lucadentella.it/en/2013/11/27/rtcsetup/ Download library https://github.com/adafruit/RTClib Download sketch & pc_software https://github.com/lucadentella/RTCSetup More question and cool idea,visit DFRobot Forum ...
Need help?
Do you have a question about the DS1307 and is the answer not in the manual?
Questions and answers