DS3231 Real-Time Clock: Battery drains back to Arduino when no power

Hi,

I'm building a project (garden irrigation system and weather station with data logger) that uses a DS3231 clock to provide accurate timing over a long period of time. This is the DS3231 that I have.

I particularly wanted to use the battery-backup facility in the clock as mains power to the project will occasionally be removed (like when the power-breaker in the garden trips out after I cut the mains cable with the hedge trimmer when I'm not concentrating - again :frowning: ).

However, having set up the prototype, it seems that when mains is removed from the project, the battery in the DS3231 then keeps powering the Arduino (and all the other stuff, like an LCD display). This happens for a minute or so until (I guess) that the battery is drained.

Have any others experienced this?

I was thinking that I should insert a diode in the VCC supply to the clock to stop it draining power back to the Uno when there's no mains power connected. Does this seem sensible? If so, any advice on what spec I should use for the diode would be much appreciated.

Thanks in advance for any advice!

Peter

How do you know that the backup battery is actually powering the Arduino when mains power is removed?

See this thread about the LIR2032 battery and the charging circuit. I have several of these ZS-042 boards and some of the LIR2032 batteries were dead on receipt and the rest failed at some later time. I have now modified all of them by removing the diode and using a CR2032 as described in that thread.

Pete

Hi Pete,

Thanks for the quick response.

That's a really good question! I assumed it was that as I couldn't see anything else in the project that could hold enough charge to keep the system running (LCD backlight, relays firing etc) for such a length of time. There are no big capacitors etc. As a former research scientist, I really should have tested my hypothesis. I'll take the clock out of the project (it's just plugged in) and see if it still happens. I'll post the answer.

Thanks also for the link to the other thread. I'll have a read of that. I had seen a lot of posts on the subject while trying to find an answer to my original question, but couldn't really bear to think about exploding batteries!

Peter

If you want to operate this RTC safely, it is essential to break the connection from Vcc on the RTC board.
But rather than removing the diode, I would remove the resistor, which is in series with Vcc and the diode.

The diode is very close to the chip and thus it is easier to remove the resistor to break the ciruit and get you on the safe side. A CR2032 will last about 2 years in your RTC.

Ooops. Yes, I misspoke (miswrote?). I removed the resistor, not the diode.

I used the info in this webapge to remove the resistor.

Pete

Hi again,

Well, it's Sunday afternoon, and I've done some more testing. There seem to be two separate issues I'm grappling with:

(1) The battery in the RTC "back-powering" the Arduino and all its peripherals.

In response to Pete (el_supremo)'s question, I unplugged the RTC from the board and everything switches off immediately when I remove the mains power to the project.

If I plug the RTC in again, I get the same issue: the project keeps running for a time after power-off; a time which seems to be dependent on how long the RTC had been powered by VCC from the Uno (i.e. how much charge is in the battery). This says to me that my initial hunch that the RTC battery was back-powering the Uno was correct.

Interestingly, when the unit is completely unplugged from the board, the red power LED is still illuminated. Is that correct?

(2) The issue with charging the battery in the RTC.

I've been through the suggested threads, but I must admit that I'm not sure I've found the answer! My take-home from the threads is ...

If the RTC comes with a non-rechargeable battery, then you must disconnect the charging circuit, so as not to blow everything up. I get that.

However, the RTC I have came with a rechargeable LIR2032 battery. I'm powering the RTC from the Uno's 5V VCC supply. I can't see anything definitive in the threads that says this is a problem. Am I mistaken in this?

Thanks again,
Peter

I think there is something else going on, like perhaps a solder bridge. I have the ZS-0452 in my local project and, if I remove mains power, the lights go out - immediately. I recall all the discussion about batteries and charging, etc., and I understood that, if ZS-042 comes with the LIR2032 it is supposed to have, that is the end of the story and we just get on and use it.

  • back powering
    That hasn't happened with any of the DS3231 I have (all from Banggood).

  • LIR2032
    As I mentioned, my experience has been that even if they work when you first get them, they will fail, usually after just a few months. Then when you need one to be working during a power failure, the date/time is zero when power returns.

Removing the resistor and using a CR2032 might not help with the DS3231 you have. The back-powering suggests there's something amiss with that board - maybe the diode is in backwards :). Get another DS3231 (or two).

Pete

Hi Pete and Nick,

I thought I’d post a couple of pictures for your edification. One shows the RTC with the battery still in it (and charged) with its LED on. In the other, I took the battery out so I could get a better photo of it.

I thought I had spotted a stray solder spatter (from me) next to the SDL text at the pin end, but it turns out just to be some slight contouring on the board where the battery holder was soldered in on manufacture.

I think I’ll just order a couple more from Banggood. It won’t break the bank and will save my and your time. If I find the fault, I’ll post the answer in case anyone else has the same problem.

Thanks again,

Peter

Something else worth checking - put a voltmeter on the battery when you remove main power - what does the battery voltage do? Not sure which "red led" you are referring to in post #5, but if it is on the RTC board when it is unplugged, that is suspicious.

Hi Mikey,

Thanks, I’ll try that when I’m next on the project.

And yes, the red LED is the one on the RTC board. See the second image on post #8.

Peter

Without seeing the schematic of the RTC, I'm not sure, but the LED being on with it disconnected from the power is highly suspicious that the diode is not working correctly. If I was designing that RTC, I would expect the LED and current limit resistor to be on the power side of the diode, not the battery side so that the LED was only on when power was applied to the board, not running on battery power. I would check continuity with an ohm meter across the diode - first one way then the other (reversing the leads). It should be quite high in one direction. Many years ago, I had an issue like that with a Z-80 board. Took us a while to find it - on a double sided board, there was a void in the board material itself and several pins got shorted together when the through hole plating went through the void to connect the pins. Not visible from a careful inspection of the board, only an ohmmeter showed the issue.

opentelemark:
I think I'll just order a couple more from Banggood.

Sounds a good idea, that's where I get mine. Like el Supremo, I found the LIR2032 doesn't last too long. I assumed it was down to a cheapo battery rather than the board, and not too surprised, considering the price.

Update: Bought a new DS3231 (not Banggood: out of stock). Everything now fine.

Grrr. :slight_smile:

Thanks, all, for your help.

Makes me even more suspicious that there was a problem with the diode that isolates the power from the battery.

Although this thread is a bit old, the topic is up to date. Maybe it is of interest or maybe in the future...

I had the same problem today. A DS3231 board (ZS-042 labeled) drives voltage at the VCC pin after external VCC disconnected. The onboard LED ist lighting and after some time the battery is empty.

The problem cause the IC DS3231 itself. If powered from Battery it drives out a voltage on his VCC pin (pin 2) and therefore on the board VCC pin. For test purposes i separeted the IC-Pin from PCB and soldered a diode between pin and PCB and the bug was gone.

I replaced the IC with an other one from an board of the same delivery all works fine.

So the IC is the reason and you have to throw away this garbage and take a new board.