Why is the battery jumpered to a resistor in this schematic?

I don't know what this shield looks like, but I'm going to guess that the battery is removable/replaceable. Is that the case?

Did it come with a battery, or was it up to you to provide it?

The DS1307 has a little quirk in that it requires that Vbat be grounded when there is no backup battery connected. R5 is meant to pull Vbat down to ground in the absence of a backup battery. Without that resistor, the DS1307 would not function correctly if one were to try and use it without a battery installed and powered via the ESP mainboard/VCC.

From the DS1307's data sheet:

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

Now, is it a good solution to this requirement? ...Not really. For a 48mAh 3V cell, this will reduce the best possible backup time to 3 years, and the drain will occur even when the DS1307 is running off VCC.

However, I can definitely understand their reasoning. It's a shield, it is aimed at a fairly wide audience and they probably just made the decision that it would be better if the DS1307 worked in every possible usage case rather than keep time for a decade.

That said, as long as you aren't planning on using it without a backup battery installed, you can simply remove it and eliminate that source of drain on the battery.


I think R2 is there to cover the following case:

When Vcc falls below Vbat, the device switches into a low-current battery-backup mode.

If no battery is present, Vbat can pick up EMC noise if not grounded. Should that noise generate a voltage above Vcc, the IC may erroneously switch to battery-backed mode, and since there is no battery, data loss could occur.

If the use case is such that the battery is almost always present, and battery life is important, I would consider omitting such resistor. That is, unless the probability of the EMC glitch while the battery is being replaced is so high that you're ready to trade 90+% of the battery lifespan for the extra safety.

However, if the device is expected to run without battery, the resistor should be there. Battery life will be less important in such a case because it can be removed when not needed, while the probability of an EMC glitch will become significant.

Also note that the typical operation circuit from the datasheet doesn't include such a resistor. I assume this is because the "typical operation" is considered to be the case where the battery is only removed to be replaced with a new one.


Actually there is a need for the resistor. The datasheet states on page 6 that if the device is being powered by VCC, Vbat pin must be grounded.

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

The resistor is placed in order to ground the Vbat pin when the battery is not used.