Go Down

Topic: Tiny RTC (DS1307) counting 8 seconds every second.  (Read 61 times) previous topic - next topic

galyn

Im trying to set time on my Tiny RTC module and besides I cant set time on it, it is counting 8 seconds every second. Im using an Arduino Uno, and Im conecting Vcc(DS1307) to 5v(Arduino, testing purposes only), GND to GND, SDA to A4 and SCL to A5. My module has a battery that is OK (3V). I dont know if this is useful information but I have an square wave on SQW of aproximately 32500Hz. I beg for some help because im getting crazy haha.

The module Im using is like this:


and the code I had been using to try to set it on time is the following:

Quote
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(__DATE__, __TIME__));
Serial.begin(9600);
}
void loop(){
DateTime now = RTC.now();
 
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
delay(1000);
}
And this is what the Arduino writes on the serial:
Quote
2021/10/10 20:40:18
2021/10/10 20:40:26
2021/10/10 20:40:34
2021/10/10 20:40:42
2021/10/10 20:40:50
2021/10/10 20:40:58
2021/10/10 20:40:2
2021/10/10 20:40:10
2021/10/10 20:40:18
.
.
.
and so on...
Can someone tell me what im doing wrong please? 
>:(

Nick_Pyner

Since you get approx 32500 at the SQW output, it is probably 32768, which is not surprising and suggests it working. You do no appear to have succeeded in setting the time. It might pay to fix that first.
http://bildr.org/2011/03/ds1307-arduino/

Go Up