Grove RTC (1307) and Arduino Nano IOT33

Hi folks – grateful for any assistance on this.

So with an Arduino Nano IOT33, on a Grove Shield, hooked up to the I2C port, the output is not at all what it’s supposed to be.

I’m running the bare bones basic example:

#include <Wire.h>
#include "DS1307.h"

DS1307 clock;//define a object of DS1307 class
void setup()
{
	Serial.begin(9600);
	clock.begin();
	clock.fillByYMD(2013,1,19);//Jan 19,2013
	clock.fillByHMS(15,28,30);//15:28 30"
	clock.fillDayOfWeek(SAT);//Saturday
	clock.setTime();//write time to the RTC chip
}
void loop()
{
	printTime();
}
/*Function: Display time on the serial monitor*/
void printTime()
{
	clock.getTime();
	Serial.print(clock.hour, DEC);
	Serial.print(":");
	Serial.print(clock.minute, DEC);
	Serial.print(":");
	Serial.print(clock.second, DEC);
	Serial.print("	");
	Serial.print(clock.month, DEC);
	Serial.print("/");
	Serial.print(clock.dayOfMonth, DEC);
	Serial.print("/");
	Serial.print(clock.year+2000, DEC);
	Serial.print(" ");
	Serial.print(clock.dayOfMonth);
	Serial.print("*");
	switch (clock.dayOfWeek)// Friendly printout the weekday
	{
		case MON:
		  Serial.print("MON");
		  break;
		case TUE:
		  Serial.print("TUE");
		  break;
		case WED:
		  Serial.print("WED");
		  break;
		case THU:
		  Serial.print("THU");
		  break;
		case FRI:
		  Serial.print("FRI");
		  break;
		case SAT:
		  Serial.print("SAT");
		  break;
		case SUN:
		  Serial.print("SUN");
		  break;
	}
	Serial.println(" ");
}

But the output I get is:

45:165:85 165/165/2165 165*
45:165:85 165/165/2165 165*
45:165:85 165/165/2165 165*
45:165:85 165/165/2165 165*
45:165:85 165/165/2165 165*
45:165:85 165/165/2165 165*

This output doesn’t make sense, of course, and the code is exactly the example.

So … am I looking at bad hardware? Incompatibility with the Arduino Nano? Other?

Try to set the date of the RTC and then run. Sometimes we need to set these RTCs before the first use.

But…the code literally does that:

clock.begin();
clock.fillByYMD(2013,1,19);//Jan 19,2013
clock.fillByHMS(15,28,30);//15:28 30"
clock.fillDayOfWeek(SAT);//Saturday
clock.setTime();//write time to the RTC chip

Oh I see. Sometimes the coin cell battery voltage drop creates problems. Do you have a multimeter? If yes, plz measure if the coin cell battery has 3V.

So it turns out the problem is that I’m an idiot.

IF you put the coin cell in upside down, you will see the same behavior I observed above!

When I turned the coin cell right side up…the problem disappeared.