DS3231 RTC on ZS-042 module - if low power is important

It has been mentioned from time to time that the popular DS3231 RTC module (aka the ZS-042 module) has to be modified for low power use - disable the "charging circuit", remove the power indicator LED or its resistor. But going beyond that, I ran across a video by Ed Mallon which says the DS3231 idles at a much lower current when powered from the chip's Vbat pin instead of its Vcc pin. There's no explanation of why that should be the case, but I've confirmed it's true.

When nothing is happening on I2C, I measure 90uA on the Vcc line at 3.3V, or 125uA at 5V. That's with the SDA, SCL, INTSQW and 32K pins all high, so none of that current is being sunk through the pullup resistors. But if Vcc is not powered, the coin cell battery takes over, and the current there drops to 1.25uA, with a small blip every 10 seconds, which I assume is the temperature correction thing. The thing is - everything still works normally, including the alarm interrupt and I2C.

Mallon takes advantage of this by literally lifting the Vcc pin (pin 2), and using the charging circuit for power, which is already connected to the Vbat pin (pin 14), The battery is still there too, but he cuts that trace and inserts a diode from the coin battery to pin 14 to protect the battery from what may be 5V charging current. I've attached the original ZS-042 circuit, and Mallon's modified version.

This is all fine, but I have a problem with the reduced battery life the diode voltage drop would produce if the device is going to spend any significant time on coin battery power. And his mod seems a bit fiddly to me. But if you never switch to coin battery power, even when sleeping, you get very low idle current, and that current is provided by the main project battery, not the coin cell, and in that case the battery diode drop wouldn't make any difference.

I've also attached an alternate mod circuit that doesn't require any pin lifting or added diodes, just cutting traces. The Vcc header pin on the module would be powered from a GPIO pin, which would be raised only when you need to do something with the RTC. At all other times, including when sleeping, the GPIO would be switched to output low, or to input mode with no pullup resistors. You would also have to disable any pullup resistors that might be enabled on the processor's I2C lines. And of course the charging circuit would need to be disabled, as would be needed even with no mod at all.

If the alarm function on INTSQW is going to be used, then the connection of that pin to its pullup resistor would also need to be cut. That's because the pullup resistor is connected to Vcc, which wouldn't be pulling up if the GPIO is not high. So instead you would enable the processor's internal pullup resistor on the interrupt line. This would require cutting the trace from the top resistor of RP1 to the via right next to it.

The alternate mod would have the I2C heavy lifting current provided by the main project battery, but at all other times the coin cell would be powering the chip. But of course that's only at 1.25uA, so the coin cell would still last a long time. And there would be no diode drop in the battery line.

The alternate mod would be particularly appropriate if the INTSQW pin is going to somehow power up the processor when the alarm triggers - you would almost certainly have to disconnect the INTSQW pullup resistor anyway, and the RTC would be on the coin cell battery anyway when the processor is powered down.

The large difference between powering from Vcc and powering from Vbat matches what the datasheet says, but I just hadn't been looking for that, particulary since it doesn't make much sense to me. Either Vcc should also idle at 1.25uA, or some functions should be disabled on Vbat. But it seems everything still works on Vbat, so it's puzzling what's drawing that additional 89uA when idling on Vcc.

This concerns the alternate circuit in my original post with repect to using the ZS-042 with Arduinos such as the Uno, Nano and Pro Mini.

I've experimented some with the Arduino Wire.h library for I2C. It appears that Wire.h enables the internal pullup resistors on SDA and SCL when you give the Wire.begin() instruction. If you then drop the ZS-042 module's Vcc pin to ground, you will be drawing current through those pullup resistors, through the 4.7K pullup resistors on the module, to the Vcc rail, which is now at ground. So before bringing Vcc low, you would want to disable the internal pullup resistors to minimize current flow. That could be done with the Wire.end() instruction, which turns off I2C and disables the resistors on the port pins. Or you could reverse the enabling of pullup resistors immediately after Wire.begin():

Wire.begin();
digitalWrite(SDA,LOW);
digitalWrite(SCL,LOW);

Also, as stated in the original post, when using the INTSQW pin to wake up the MCU, it's necessary to disable the pullup resistor on INTSQW on the ZS-042 module if you are going to bring the module's Vcc line low while sleeping. Otherwise, INTSQW will never go high because it has in effect a pulldown resistor to ground when Vcc is low. Instead, you would enable the internal pullup resistor on the MCU wakeup pin. Attached is a picture showing the trace to cut (or you can cut the resistor pin if you can get to it) to disable the INTSQW pullup resistor.

Not to diminish what is a lot of information that I will digest later, but I'm wondering why modifications are necessary, when the battery on that module can be projected to last 10 years, even when not relieved of duty by power from the microprocessor?

From what I've seen, a typical implementation has the DS3231 powered through the Vcc pin all the time, which never draws less than 90uA. Ed Mallon's solution was to re-route the Vcc header to the Vbat pin, where current drops to about 1uA, but all functionality remains. My alternative was to just power down Vcc except when you need to communicate with the module, but that involves dealing with the pullup resistors on the module board, and modifying your code. It's going to be fiddly either way.

None of this matters if current draw doesn't matter. But if the project is battery powered, it may make a difference in how long the main battery lasts.

But in any case something needs to be done with the charging circuit that still comes populated on most ZS-042 modules. You can't be trying to charge the primary lithium battery usually found on this module.