19
\$\begingroup\$

I am looking at a schematic for the wifi D1 mini data logger shield that I'm using right now. In this part of the schematic, a coin cell battery powers the RTC. I see R5 is jumpered across the positive and negative terminals of the battery. I identified R5 to be 2MΩ, so it obviously isn't shorting the circuit. But that leaves the question, what is its purpose?

Note: There is a sideways 1 above the battery symbol that looks like a minus sign. Don't be fooled!

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ Nobody answered "planned obsolescence"? \$\endgroup\$ – Thomas Weller Aug 18 at 16:16
25
\$\begingroup\$

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.

\$\endgroup\$
  • 2
    \$\begingroup\$ Would a better solution not be an SPDT actuated by the battery's presence? \$\endgroup\$ – Adam Barnes Aug 16 at 12:45
  • 6
    \$\begingroup\$ @AdamBarnes: I would think it would be practical and useful to construct a socket that would short the contacts when no battery is inserted; such a design could eliminate the need for reset buttons on many products which could otherwise get into a perma-gitched state on a battery swap where VBatt fell enough to land them in a near-zero-current-draw perma-glitched state but not enough that installing a fresh battery would trigger a power-on reset. \$\endgroup\$ – supercat Aug 16 at 16:09
  • 2
    \$\begingroup\$ Yes, but what does a resistor cost compared to a special batter holder, even if you ignore the cost of the engineering and testing time involved? "Better Wednesday than perfect." \$\endgroup\$ – mickeyf_supports_Monica Aug 16 at 23:20
  • \$\begingroup\$ @supercat you're actually for sure right on that - mickeyf's comment regarding cost isn't particularly sensible here, I think, as the battery in use is a coin cell, so the contacts merely need to be slightly springy curved pieces of metal. \$\endgroup\$ – Adam Barnes Sep 3 at 16:14
8
\$\begingroup\$

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.

\$\endgroup\$
  • 3
    \$\begingroup\$ Wouldn't a small capacitor work just as well for EMC noise? If it was more than a few microfarads, it would also keep the circuit alive when you changed the battery. I've seen (a few) battery-powered clocks that do this. \$\endgroup\$ – Thor Lancaster Aug 17 at 5:30
  • \$\begingroup\$ @ThorLancaster Yes, that is entirely possible. Given that the word "shield" is used, an extra capacitor could've been deemed too expensive. \$\endgroup\$ – Dmitry Grigoryev Aug 18 at 23:10
5
\$\begingroup\$

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.

\$\endgroup\$
4
\$\begingroup\$

That's bizarre. There is nothing in the DS1307 datasheet which suggests that any such resistor is required.

While 2 MΩ is a large resistance, it's still low enough that the current through the resistor (~1.5 µA) will be orders of magnitude higher than the data-retention current of the DS1307 (10 - 100 nA). This may significantly reduce the life of the battery; I'd advise removing the resistor.

\$\endgroup\$
  • 1
    \$\begingroup\$ Re read page 6, specifically the description of pin 3. This states it must be grounded in the absence of a battery, \$\endgroup\$ – Warren Hill Aug 16 at 7:28
  • 4
    \$\begingroup\$ @WarrenHill No, the spec says that Vbat must be grounded If a backup supply is not required, which I read as "the battery will never be there", not "the battery may be missing" \$\endgroup\$ – Dmitry Grigoryev Aug 16 at 8:23
  • \$\begingroup\$ I advise removing the battery. \$\endgroup\$ – richard1941 Aug 30 at 15:27
  • \$\begingroup\$ @richard1941 😄 \$\endgroup\$ – Soldersmoke Sep 8 at 14:00
0
\$\begingroup\$

I suspect this increases the decay speed when the battery is removed that is required for some reason. Low power consuming logic FET switches tend to draw a bit more micro power in the linear region and this RTC chip is known to be a good power miser such that when voltage is removed, it uses a capacitor as a power source from a separate pin. (Have you read the data-sheet yet?)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.