DS1307 - Strange Battery Fault

Hi, I have made a small module that increments time just fine, but only when there is no battery inserted. As soon as the battery is installed it shows just 0s. Take it out and it starts up again.

The schematic is fine and all connections have been fully checked and tested.

This has been driving me mad for hours now, I have tried 3 fresh batterys straight from the packet.

Thanks

The schematic is fine and all connections have been fully checked and tested.

If that were true it would work. Please post a schematic so we can see what you have done.

There it is.

Phil

Well that is not so much a schematic simply a collection of components with little wiring up information.
You need pull up resistors on pins 5, 6 & 7 as shown on the data sheet.
Is the ground connected to the ground of the arduino?
Have you measured the battery to make sure you haven't misidentified the polarity?

Battery polarity is correct, pull ups have been added on the breadboard and all ground are connected.

Im getting tired now so will have to try again in the morning!

Right, with fresh eyes it appears that when the battery is in and the power is disconnected it does store the time and when the power is reconnected and battery removed it shows the time in the serial monitor again. But as you can see below, while the battery is in it wont show the time in the serial monitor:

12:28:5      15/7/2010
12:28:6      15/7/2010
12:28:7      15/7/2010
12:28:8      15/7/2010  
0:0:0      0/0/2000    <----battery inserted
0:0:0      0/0/2000
0:0:0      0/0/2000
0:0:0      0/0/2000
0:0:0      0/0/2000
0:0:0      0/0/2000    <----battery removed
12:28:15      15/7/2010

Faulty chip maybe? Im using the example sketch from the ds1307 library.

Thanks

What voltage battery are you using?
It could be it is too high causing the chip not to come out of the power mode when supplied with 5V.
The data sheet says it should be between 2 and 3.5V preferably 3v.

Its running at 3.01v. Im thinking a better quality battery may help and I will build a second module with the spare ds1307 to see if the chip is at fault. These batterys are ebay specials.

Im thinking a better quality battery may help

I doubt it, DS1307 draws very little current when in battery mode, if you can read voltage from a multimeter, it should be able to power the chip.

Im just waiting for the etchant to finish its job then will test the second ds1307, I have change the crystal, triple checked board diagram and even changed the filter cap.

It does everything except show the time when the battery is in.

When you "remove the battery" are the battery connectors touching (which would ground the VBAT pin) or is VBAT left floating?

Sorry if this is insulting, but are you SURE you have the battery polarity correct?

Is there anything else connected to the Arduino?

What values did you use for the pullups?

I'll use this theme to say for a problem with the DS1307. I'm using this scheme, already tried 2-3 different examples and it doesn't work. Could the IC be damaged?

Could the IC be damaged?

Possible, sure.

Lefty

I didn't connected the SQW, but as i saw it's not needed... The DS1307 can run without battery power supply, right?

The DS1307 can run without battery power supply, right?

Yes, but you will lose all time/date values when it's powered off.

Lefty

And one more question: should the body of the 32,768 crystal be connected to GND?

And one more question: should the body of the 32,768 crystal be connected to GND?

Not required, but no harm if you do.

Lefty

Polarity is definatly correct, vbat is left floating when the battery is removed.

Like I said, it all seems to work ok(stores time when power is lost, continues ticking away) but when the battery is installed the serial monitor only shows 0s.

I just wired up (on a breadboard) the schematic linked above, using the code from the playground. I cannot reproduce your problem... assuming your wiring is correct, and the code is correct, I can only guess that the chip is bad...

using: Google Code Archive - Long-term storage for Google Code Project Hosting.

Is there a way to check is the DS1307 damaged or working? Before I take another one :slight_smile: