DS1307 rtc stoped working

Hi everybody!

I’m currently working on a project, where I want to run an Arduino with several Sensors for a few weeks. I also keep track of the current time with the DS1307 rtc. It all worked fine until I tried to include a sleeping mode a few hours ago. Now the rtc isn’t working properly, it tells me that “RTC is NOT running!”. I tried a few solutions (checked the wiring of the rtc, tried to undo the changes of the bit of code i introduced) but so far nothing worked… I hope you have some better ideas.

Here is the sleeping mode code:

// **** INCLUDES *****
#include “LowPower.h”

void setup()
{
// No setup is required for this library
}

void loop()
{
// Enter power down state for 8 s with ADC and BOD module disabled
LowPower.powerDown(SLEEP_1S, ADC_OFF, BOD_OFF);

// Do something here
// Example: Read sensor, data logging, data transmission.
}

And the test code for the rtc i’m now using:

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

#include <Wire.h>
#include “RTClib.h”

DS1307 rtc;

void setup () {
Serial.begin(57600);
#ifdef AVR
Wire.begin();
#else
Wire1.begin(); // Shield I2C pins connect to alt I2C bus on Arduino Due
#endif
rtc.begin();

if (! rtc.isrunning()) {
Serial.println(“RTC is NOT running!”);
// following line sets the RTC to the date & time this sketch was compiled

}
}

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(3000);
}

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png

Have you googled arduino rtc sleep mode

What model Arduino are you using?

Thanks.. Tom... :slight_smile:

Hi Tom,

thanks for the quick answer. Sorry, I'll do better when i post code again :wink:
I'm using an arduino uno. The circuit isn't the problem, it worked perfectly fine the last weeks, until now... (I also checked the I2C address, it's 0x68 (as it should be)). I googled for the last few hours, but nothing useful came up...

Hi,

It all worked fine until I tried to include a sleeping mode a few hours ago

Well how are you powering the RTC, it should be powered by your supply, and have a backup battery?

Tom... :slight_smile:

I'm using this shield:

and I power my arduino with my laptop. I also put the 3V battery in the socket

Hi,
It may be that the I2C link does not re-establish on wakeup.

google. arduino I2c in sleep mode

Tom.... :slight_smile:

Thanks for your help! For some reason removing the battery and restarting my laptop solved the problem :slight_smile: