Help with RTC

Some time ago I bought this

http://www.ebay.com/itm/I2C-DS1307-Real-Time-Clock-Module-For-Arduino-Tiny-RTC-2560-UNO-R3-New-/271028224375?pt=LH_DefaultDomain_0&hash=item3f1a8a8177.

After testing it, I put it in my parts bin for a planned project that never happened. Now I am thinking using it with my Raspberry Pi. It seems straight forward except for the pin labeled DS. I combed the net for a schematic with no result. I'm hoping you experts can shed some light on this.

Hopefully Jim

I wonder why it has a 24C32N 4Kx8 Serial EEPROM that they don't bother to mention.

As near as I can figure the DS line doesn't do anything. It might have been a hold-over from a design using the DS1302 which had a Chip Enable pin.

Judging by this:

It isn't connected to anything other than the header on the other side.

Thanks to both Nick and John. After seeing the schematic, I OHMed it out. Your both absolutely right!

Jim

It IS connected, to the center (data) pin of the empty three pin device location in the corner. That's where you can put a DS18B20 temperature sensor and talk to it with OneWire. The schematic shows a 3.3k pull-up resistor for the OneWire bus but I suspect that would have been in the empty R7 location next to the crystal.

Hi,

I also have this RTC module. I have wired it to an arduina mega adk r3. The wiring is correct, and I'm trying to use the library from the adafruit tutorials.

I have managed to set the time on the RTC, but I have some problem with it now.

Here is my code:

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

    Serial.print(" since 1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");
    delay(3000);
}

My problem is that the RTC seems like it has stopped ticking, here is the output from it:

2013/2/23 21:48:58
since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58

Do you have any idea, what could be my problem?

Thank You!

csabee:
I have managed to set the time on the RTC, but I have some problem with it now.

Here is my code:

Is that the code, or just a snippet? If the former, no, it's a snippet. Probably lifted from the example included in the DS1307 library. If you use the whole thing, you will probably get a result.

I found the following more useful. It doesn't use a clock library

//Arduino 1.0+ Only
//Arduino 1.0+ Only

#include <LiquidCrystal_I2C.h>
#include "Wire.h"
#define DS1307_ADDRESS 0x68

LiquidCrystal_I2C lcd(0x27,20,4);  

void setup(){
  Wire.begin();
  Serial.begin(9600);
  lcd.init();  
    delay(1000);
 lcd.clear();
      lcd.backlight();  //Backlight ON if under program control
      lcd.setCursor(0,0); 
  // Print a message to the LCD.
 lcd.print("Today it is");
 
}

void loop(){
  printDate();
  delay(1000);

}

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
  return ( (val/16*10) + (val%16) );
}

void printDate(){

  // Reset the register pointer
  Wire.beginTransmission(DS1307_ADDRESS);

  byte zero = 0x00;
  Wire.write(zero);
  Wire.endTransmission();

  Wire.requestFrom(DS1307_ADDRESS, 7);

  int second = bcdToDec(Wire.read());
  int minute = bcdToDec(Wire.read());
  int hour = bcdToDec(Wire.read() & 0b111111); //24 hour time
  int weekDay = bcdToDec(Wire.read()); //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(Wire.read());
  int month = bcdToDec(Wire.read());
  int year = bcdToDec(Wire.read());


  lcd.setCursor(10,1);
    switch (weekDay)                      // Friendly printout the weekday
  {
    case 1:
      lcd.print("MONDAY    ");
      Serial.print("MON  ");
      break;
    case 2:
      lcd.print("TUESDAY    ");
      Serial.print("TUE  ");
      break;
    case 3:
      lcd.print("WEDNESDAY    ");
      Serial.print("WED  ");
      break;
    case 4:
      lcd.print("THURSDAY    ");
      Serial.print("THU  ");
      break;
    case 5:
      lcd.print("FRIDAY    ");
      Serial.print("FRI  ");
      break;
    case 6:
      lcd.print("SATURDAY    ");
      Serial.print("SAT  ");
      break;
    case 7:
      lcd.print("SUNDAY     ");
       Serial.print("SUN  ");
      break;
  }

  Serial.print(monthDay);
  Serial.print("/");
  Serial.print(month);
  Serial.print("/");
  Serial.print(year);
  Serial.print(" ");
  Serial.print(hour);
  Serial.print(":");
  Serial.print(minute);
  Serial.print(":");
  Serial.println(second);

   lcd.setCursor(10,2);
  
  lcd.print(monthDay);
  lcd.print("/");
  lcd.print(month);
  lcd.print("/");
  lcd.print(year);
  lcd.print("    ");
  
  lcd.setCursor(0,3);
  lcd.print(hour);
  lcd.print(":");
  lcd.print(minute);
  lcd.print(":");
     if ((second) < 10)
  {
    lcd.print("0");
  };
   lcd.print(second);

  lcd.print("         ");
}

Hi,

Yes, it is a snippet from my code, and most of it is from the example. I've just only posted the setup() and loop() parts of it.

I need to use the library from adafruit, since I will need to store the unix time (I mean the number of elapsed seconds from 1970 jan 1.).

Thanks

I got my hands on an other RTC module which is the same type, but it was working! So my problem was at all time that the original RTC was broken :frowning:
Crap. But I don't know what could gone wrong in it? The eeprom or the IC maybe, but nothin other stuff.