DS1307 - Strange Battery Fault

You wouldnt believe how much I hate RTCs at the moment :smiley:

Here are the 2 boards I have used, plus the breadboard version I did:

Sorry about the PDFs, they're the easiest to export.

The DS1307 needs a voltage present on the battery pin in order to work correctly. If you decide to use it without a battery bring the 3,3V output of the arduino to pin 3. In this case it would work correctly but it would loose time when turned off.

If you do not want to loose time when power is turned off. Leave the battery in place and enjoy life.

PS. ground plane traces too close to the crystal connections or traces, can cause extra capacitance and affect the functionality of the crystal

That's just it... I wired a spare chip up and it worked the same with or without the battery... not sure if the time keeping was accurate, but it was reporting the time. It just didn't retain memory as would be expected.

The DS1307 needs a voltage present on the battery pin in order to work correctly. If you decide to use it without a battery bring the 3,3V output of the arduino to pin 3. In this case it would work correctly but it would loose time when turned off.

Are you sure of that? From a Maxium data sheet for the DS1307 I found the following:

Backup Supply Input for Any Standard 3V Lithium Cell or Other Energy Source. Battery
voltage must be held between the minimum and maximum limits for proper operation.
Diodes in series between the battery and the VBAT pin may prevent proper operation. If a
backup supply is not required, VBAT must be grounded. The nominal power-fail trip point
(VPF) voltage at which access to the RTC and user RAM is denied is set by the internal
circuitry as 1.25 x VBAT nominal. A lithium battery with 48mAh or greater will back up the
DS1307 for more than 10 years in the absence of power at +25°C.

I realize that, and read that myself before I wired it up. I still have the circuit on the bb so I'll run another test.

The problem is kind of a non-issue since the whole point of the rtc is to keep time in the event of a power outage, so when will the device be in operation without a battery installed?

Could it be that it's the loss of Vbat that is causing the DS1307 to stop? Causing the crystal/oscilator to be disabled.

I've had similar issues while breadboarding. The batterycompartment does not fit with the breadboard, and could disconnect if I'm not carefull. In these situations I've seen that the time returned from the chip has been 0:0:0 1/1/2000. When power to Vbat is restored, the time returned is correct again, without the need to set or start the RTC again.

One way to test this is starting the cirquit without Vbat connected from startup. Then there will be no problem at all(since there is no battery that disconnects).

So my conclusion is that this is'nt a issue in the resulting cirquit. If I don't need the battery backup I'll ground the Vbat(according to the datasheet). Then there won't be a battery that disconnects. And, if I need battery backup, the issue with the breadboard won't exist in the finished cirquit.

Hi, its when the battery is in that theres a problem, it wont read out the time. After testing it, it seems fine with no battery inserted(almost like VBAT is grounded, but it definatly isnt). If there is a battery in then hell breaks loose.

The crystal and ground plane issue is a small issue for now, I'll sort that when I can read the time :smiley:

Right, leaving for the hospital in 45 mins. Tried Arduino IDE 18, tried a new chip, crystal and resistors on a new breadboard with a new battery, and still the same.

Tried with another Arduino board and still the same, it has to be something glaringly obvious, it always is when I put this much effort in.

Does anyone in the UK have an RTC setup I can borrow for a day or 2 to test?

Cheers, Phil

I realize this probably isn't relate to the OP's problem but for the sake of the side discussions in this thread, let me repeat the datasheet quote that lefty posted:

If a
backup supply is not required, VBAT must be grounded.

Having spent several weeks screwing around with partially-operable DS1307 circuits back when I first tried one, I can say for sure that if you leave VBAT floating or cause it to become floating (i.e. disconnect it) while the chip is "running" (i.e. power is applied to Vin), you will get odd behavior. If you are going to run the circuit without a battery, ground the VBAT pin!

thegeekway, can you snap a photo of your circuit and/or post an image of the exact schematic you made those boards in the PDFs from?

Could you post pictures of your setup please?

I feel that we are getting to the point where someone says "pics or it did'nt happen". :slight_smile:

Taking photo now, schematic and pdf of board are further back in the thread.

Here's how I hooked mine up, using the schematic and code from an earlier post of mine in this thread:

For the record... I have NO DOUBT that the datasheet is correct, and would never ever deviate from its recommendations, I am simply trying my best to reproduce the behaviors experienced by people in this thread.

Please note, the solder connections are all good, throughly checked, I didnt drill the holes as it was a rush job :slight_smile:

If you are referring to my photo, it is a long breadboard, I assure you the power and ground buses are connected, top and bottom (no horizontal breaks on any of them..)

Right, after a light bulb moment, I finally got this working. Im now going grey and feel stupid.

I was running the board from the FTDI adapters power, which the ds1307 didnt like when in battery mode. So I soldered in a DC jack and tried with an external supply and it now fully works, silly me :smiley:

Thanks for the answers!