ive tested 3 modules:
-one wont keep time at all when 5v is detached so it seems that crystal may be bad.
-two will keep time but wont transmit it until i do the battery ground thing.
MY SHORTCUT SOLUTION:
So as a quick fix i'm powering the clock off of one of the digital ports and in the setup function i cycle it from ground to power before using the clock. This seems to work with several modules and after over 10 minutes of disconnect time.
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
// Here is where i cycle the clock's power
pinMode(4,OUTPUT);
digitalWrite(4,LOW);
delay(10);
digitalWrite(4,HIGH);
delay(10);
// Everything else is from RTClib example
Serial.begin(57600);
Wire.begin();
RTC.begin();;
//RTC.adjust(DateTime(__DATE__, __TIME__));
if (! RTC.isrunning()) {
Serial.println("RTC is NOT running!");
}
}
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);
}