Problems with RTC module

I have got me a used RTC clock that looks like this one: SparkFun Real Time Clock Module - BOB-12708 - SparkFun Electronics

Sadly the example in the rtclib only shows 2165/165/165 165:165:85 as output.

From my Arduino Uno I wired A4 to SDA and A5 to SCL . Is there a way I can check what I have
made wrong? Or to check if the RTC module is damaged?

Thanks!

Are you running with just a USB cable? I think those numbers might indicate inadequate power. If you are using an LCD, try removing it and sending the time to serial monitor.

bitboxer:
I have got me a used RTC clock that looks like this one: SparkFun Real Time Clock Module - BOB-12708 - SparkFun Electronics

Sadly the example in the rtclib only shows 2165/165/165 165:165:85 as output.

From my Arduino Uno I wired A4 to SDA and A5 to SCL . Is there a way I can check what I have
made wrong? Or to check if the RTC module is damaged?

I've worked with that chip... even made my own little board similar to the SparkFun one. I'm only using the Wire library for I2C and handling all of the clock decoding myself. Your pin connections sound right. You have hooked up Vcc and Gnd to the module, right?

The chip runs fine off USB with a back-lit LCD... I've got that set up on the breadboard now.

If you're using the serial monitor for output, be sure your baud rate matches. (Though I'd expect something less readable.)

You can skip the RTC library and try this code to verify that the module works, then go back and figure out the RTC library. If the time has never been set, uncomment the initialization section in setup(). There's a bunch of sloppy debug code you can uncomment if you want to see the individual pieces as it decodes them.

// experimenting with I2C and the DS1307 RTC

#include <Wire.h>

// address of DS1307: 110 1000 = 0x68
#define RTC 0x68

// SDA pin a4 (DAta)
// SCL pin a5 (CLock)

#define SECONDS 0
#define MINUTES 1
#define HOURS   2
#define WDAY    3
#define MDAY    4
#define MONTH   5
#define YEAR    6

char* dow[] = {
  "", // Sunday is day 1
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
};

void setup() {
  Serial.begin(9600);  // communicate clock info back to the monitor

  Wire.begin(); // join i2c bus (address optional for master)
  // initialize clock...
 // Wire.beginTransmission(RTC);
 // Wire.write(0x00); // send register address to move to
 // Wire.write(0x00); // clear bit 7 to start clock, + 0 seconds
 // Wire.write(0x24); // 29 minutes
 // Wire.write(0x18); // 10 hours
 // Wire.write(0x06); // 5 = Thursday
 // Wire.write(0x20); // 28th
 // Wire.write(0x07); // June
 // Wire.write(0x12); // 12th year (2012)
 // // ... and set seconds to 0 unavoidably
 // Wire.endTransmission();
}

void loop() {
  Wire.beginTransmission(RTC);
  Wire.write(0x00); // send register address to move to
  // then send data if we desire to actually write...
  // otherwise it just updates the pointer for read.
  Wire.endTransmission();

  uint8_t buf[7]; // registers 0x00 to 0x06
  uint8_t idx=0;  // pointer to current array

  Wire.requestFrom(RTC,7); // request all 7 time registers
  while( Wire.available()) {
    buf[idx++] = Wire.read();  // receive byte
  }

  uint8_t b;

  b = buf[SECONDS];
//  Serial.print( b, BIN );
//  Serial.print( " : " );
  uint8_t seconds = (b & 0x0f) + ((b & 0x70) >> 4)*10;
//  Serial.println( seconds );

  b = buf[MINUTES];
//  Serial.print( b,BIN );
//  Serial.print( " : " );
  uint8_t minutes = (b & 0x0f) + ((b & 0x70) >> 4)*10;
//  Serial.println( minutes );

  b = buf[HOURS];
//  Serial.print( b,BIN );
//  Serial.print( " : " );
  uint8_t hours = (b & 0x0f) + ((b & 0x30) >> 4)*10;
//  Serial.println( hours );

//  Serial.println( dow[buf[WDAY]] );

  b = buf[MDAY];
//  Serial.print( b,BIN );
//  Serial.print( " : " );
  uint8_t mday = (b & 0x0f) + ((b & 0x30) >> 4)*10;
//  Serial.println( mday );

  b = buf[MONTH];
//  Serial.print( b,BIN );
//  Serial.print( " : " );
  uint8_t month = (b & 0x0f) + ((b & 0x10) >> 4)*10;
//  Serial.println( month );

  b = buf[YEAR];
//  Serial.print( b,BIN );
//  Serial.print( " : " );
  uint16_t year = 2000 + (b & 0x0f) + ((b & 0xf0) >> 4)*10;
//  Serial.println( year );

  char bufout[100]; // plenty of room for output

  sprintf( bufout, "%02i:%02i:%02i %s %02i/%02i/%i",
           hours, minutes, seconds,
           dow[buf[WDAY]],
           month, mday, year );
  Serial.println(bufout);
  delay(5000);
}

The output of 2165/165/165 165:165:85 indicates that you are reading all ones from the RTC which suggests that it isn't wired up properly.
Run Nick Gammon's I2C Scanner which is at the bottom of this web page:

If that doesn't find anything then you've definitely got a wiring problem or, since it is "used", it's broken.

Pete

The I2C Scanner did not find any device. So I asume that the RTC module is broken :frowning: . I will have to buy a new one.

Just to make sure, you also had power and ground connected?

Pete

Yes, Power and GND was connected. I checked on the RTC Board that the +5V is getting to the chip. I have ordered a brand new one. Looked like the nice present was no present at all :wink: .