RTC not working PLZ Help..........................

Hi, i tried to run an RTC with arduino uno. I tried the code from RTC lib. it self.The Serial moniter reads.
“DS1307RTC Read Test” and then noting is printed on the screen. I connected the A4 pin to SDA and A5 to SCL.
The code which i tried is:

#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>

void setup() {
  Serial.begin(9600);
  while (!Serial) ; // wait for serial
  delay(200);
  Serial.println("DS1307RTC Read Test");
  Serial.println("-------------------");
}

void loop() {
  tmElements_t tm;

  if (RTC.read(tm)) {
    Serial.print("Ok, Time = ");
    print2digits(tm.Hour);
    Serial.write(':');
    print2digits(tm.Minute);
    Serial.write(':');
    print2digits(tm.Second);
    Serial.print(", Date (D/M/Y) = ");
    Serial.print(tm.Day);
    Serial.write('/');
    Serial.print(tm.Month);
    Serial.write('/');
    Serial.print(tmYearToCalendar(tm.Year));
    Serial.println();
  } else {
    if (RTC.chipPresent()) {
      Serial.println("The DS1307 is stopped.  Please run the SetTime");
      Serial.println("example to initialize the time and begin running.");
      Serial.println();
    } else {
      Serial.println("DS1307 read error!  Please check the circuitry.");
      Serial.println();
    }
    delay(9000);
  }
  delay(1000);
}

void print2digits(int number) {
  if (number >= 0 && number < 10) {
    Serial.write('0');
  }
  Serial.print(number);
}

Please Help THANKYOU IN ADVANCE…

Have you got pullups on the I2C lines?

The Serial moniter reads.
“DS1307RTC Read Test” and then noting is printed on the screen

Not even the row of dashes?

The library I use for that particular clock is ds1307new. I’m not sure where I uploaded it from but I tend to recall I had to remove the ds1307 before using it. It was worth the trouble though as this one worked straight straight away. ( credited to Peter Schmelzer )

DS1307new_v1.24.zip (18.8 KB)

Thanx for all the replies . AWOL yah it does print the line of dashs after it. Sorry i didnt mention that.

I bought a ready made circuit board of Bhassa.

I do not believe that your module is being seen on the i2c bus. You can confirm that by running the i2c scanner code. You should see the address 0X68 for the ds1307. I did a Google search for a Bhasa ds1307 and it references the presence of pull up. If the scanner does not find the module, check the wiring, you may have a defective jumper.

// I2C Scanner
// Written by Nick Gammon
// Date: 20th April 2011

#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

Thanyou for all your replies. Cattledog i tried the I2C scanner but the Serial Monitor reads I2C scanner. Scanning ... I waited for all most half an hour but didnt get any thing beyond that.......Any suggestions please....... R their any chances of my RTC module being damaged??? Or my Arduino Uno being damaged..... KenF i tried the library given by u but both the codes are not running with my RTC..Please suggest me Thankyou in advance......

Bourbon--

Do you have 5v and ground hooked to the module as well as SDA/SCL. The module only maintains its internal time with the battery, and will not be recognized on the bus without power.

Until you can see address 0x68 on the scanner , do not worry about ds1307 libraries or the code.

Please verify that you have power, ground, sda, scl hooked up, and and the wires are all good. Do the solder joints on the module pin header look good? Can you attach a photgraph of your set up. It's more likely that you have a bad connection than a bad module or arduino. Do you have any other i2c device you can test?

Do you have pullups on the I2C lines?

Bourbon

Can you confirm that you are using this module.
http://www.bhashatech.com/breakout-boards/86-i2c-rtc-breakout.html

The description of this module indicates pull ups.

Yes, Cattledog i am using the same type of module. I have attached the photo of my connections and the one downloaded from internet.

wiring rtc.jpg

This is how i made the connections.

PQRS.jpg

Bourbon:
This is how i made the connections.

Do you have a multimeter and are able to measure voltages?

If so, could you take out the battery cell and measure the voltage of the CR2032 lithium cell? And also the Arduino voltage between GND and the 5V line?

If not: Did you try if the I2C scanner can detect the address of your RTC while the CR2032 cell is not inserted in the breakout board?

The suggestion by jurs to try without the battery is a good one.

The spliced wires are not ideal, and it would be best if they are soldered and not twisted together. If you have a multimeter you should measure the continuity from connector to connector in case there is a defective crimp end.
If you have one piece female/female jumper wires you should use them.

It looks like the power indicator on the module is lit. Can you turn the four wire plug upside down and so the wire pair used for the signal and power are swaped? Then switch over the pair at the controller headers, and this might help you test the wires.

Why is your ATmega328 chip painted over with white out ?

Thankyou for all your replies.I tried connecting RTC with arduino without the CR2032 lithium cell.The results didnt change the serial monitor still reads "I2C scanner. Scanning ...".
While the arduino was connected to pc i tried to remove the A4 and A5 pins. Expecting the serial moniter to read 0 devices found but it didnt. It was still reading "I2C scanner. Scanning ...".
Please help......Thankyou in advance....

Do you have your serial monitor set for NEWLINE for line endings ?

Bourbon:
Please help......Thankyou in advance....

It's hard to tell from the distance what's going wrong with your RTC module.

If I should make a guess: The module once fell down to the ground and in the moment of impact the crystal oscillator on the board got damaged, so that the crystal oscillator will not be working any more. This component is a little bit sensitive to shock.

Best equipment to check if the RTC clock crystal is working would be an oscilloscope. But an oscilloscope is most likely not what a hobbyist has available - I also don't have one.

Has anybody found out if it would be possible to use an Arduino for the reason of checking a clock crystal on an RTC module if it is working or not?

While the arduino was connected to pc i tried to remove the A4 and A5 pins. Expecting the serial moniter to read 0 devices found but it didnt. It was still reading "I2C scanner. Scanning ...".

You are correct, when I disconnect everything from A4/A5 this is the result

I2C scanner. Scanning ...
Done.
Found 0 device(s).

The only place for the Gammon scanner sketch to hang like you are seeing is at Wire.begin(), (which also calls twi._init) or at Wire.beginTransmission() or Wire.endTransmission(). (The hang is most likely caused by Wire.endTransmission()) There may be something wrong with the Wire library for the code to hang like that. Wire comes with the IDE, and twi is within the utility folder of that library.

Before deciding that the Bhasa "Uno" is defective I would reload the IDE. There may be another source to download the wire library and the associated utilities, but I don't know the link.

Edit-- If the reinstall of the IDE does not fix the problem, it is possible that A4 or A5 is defective, possible shorted to ground. You can test the pins by trying to turn on an led with them.

Allas i made it.... I threw the Bhassa RTC and bought all the individual components and it worked very fine.
THANKYOU EVERYONE FOR YOUR KIND SUPPORT.
THANKYOU