DS3231 Battery Backup Stopped working

Hi

I made a clock with a mini weather station using a Arduino Nano, an DS3231 RTC, a DHT22 and displayed everything on a 20x4 LCD via an I2C interface. Everything worked perfectly when I was prototyping.

I then decided to make it permanent and moved it over to a Pro Mini, soldering everything to stripboard. When I was done, everything worked fine, except the DS3231 no longer kept time after a power loss. I double checked all my connections and obviously the code isn’t the problem.

The DS3231 has a battery cell in it, but it should be noted that I didn’t remove it while soldering and afterwards the open circuit voltage of the CR2032 was 3.6V, well above the normal spec. So, I replaced the cell with a new one and it still can’t keep time after a power loss.

The RTC keeps time without a problem when powered. So I’m wondering if I messed up the battery back up while soldering and if there’s no way to fix it.

I’m happy to post my code, if it would help.

Post a wiring diagram, let’s what you have. Might simply be missing pullup resistors on SCL & SDA for example.

When you say it no longer kept time, do you mean it reverted back to 1/1/1900, or whatever, or that it lost some time, or that you just couldn’t read the time?

Are you using the ZS-042 module for the DS3231? If so, you might try disabling the “charging” circuit - remove either the diode or the resistor.

The battery positive terminal should be connected to pin 14 of the DS3231, and of course the negative terminal to ground.

If the RTC is just losing an amount of time equal to the power outage, it could be that the EOSC bit in the Control register isn’t right. If that bit is high, the oscillator will stop when you switch to battery power.

Anyway, here’s the ZS-042 schematic.

1 Like

@ShermanP, on power loss, the date and time resets to 00:00:00 01/01/2108, whether there is a battery cell in or not. So I can read the time without a problem, it just resets when there is no external power to the module.

I am not sure what module I am using, it simply says DS3231, but it looks almost exactly like the ZS-042. Here’s a link to the product page from where I purchased it. https://www.robotics.org.za/DS3231-MOD It does specify a CR2032, but it could be wrong, because the 3.6V I measured on the cell.

I shall try desoldering the resistor or diode.
Update: I desoldered the diode and it made no difference.

@CrossRoads I have attached a diagram. It’s not exactly as I have it in my project, but I did remove the RTC and put it back the breadboard with a Nano for debugging. The time and date is being printed to the serial monitor and it has the same problem of resetting on power loss.

image

When power is turned off, do you measure about 3V on pin 14 of the DS3231 chip?

Do you really mean 01/01/2108? If so, I think we need to see your code.

There is always the possibility that you just have a bad DS3231 module. But that’s usually not the case.

Yes, I really mean 01/01/2018. The image shows the serial monitor output after connecting power.

When I prototyping on a breadboard for weeks, it worked without a problem. It didn’t give me some weird date, or reset the date and time after a power loss. It just started doing this after I soldered everyhting on to stripboard. I guess I must have inadvertently broke it then.

My code is below.

#include <Wire.h> // Library for I2C communication
#include “RTClib.h” // RTC Library from JeebLab
DS3231 rtc; // For DS3231 RTC
DateTime now;
int H, M, S, DD, MM, YY, Day;

void setup() {
// rtc.adjust(DateTime(DATE, TIME));
Serial.begin(9600); //setting the baud rate at 9600
Serial.println(“Start”);
}

void loop() {
now = rtc.now();
H = now.hour();
M = now.minute();
S = now.second();
DD = now.day();
MM = now.month();
YY = now.year();
Day = now.dayOfWeek();

if (H<10){Serial.print(“0”);} // Places a 0 in front when a number is less than 2 digits
Serial.print(H);
Serial.print(":");
if (M<10){Serial.print(“0”);} // Places a 0 in front when a number is less than 2 digits
Serial.print(M);
Serial.print(":");
if (S<10){Serial.print(“0”);} // Places a 0 in front when a number is less than 2 digits
Serial.print(S);

Serial.print(" ");

if (DD<10){Serial.print(“0”);} // Places a 0 in front when a number is less than 2 digits
Serial.print(DD);
Serial.print("/");
Serial.print(MM);
Serial.print("/");
Serial.println(YY);

delay(1000);
}

Hi,
Can you please post pictures of your stripboard project please?

Thanks… Tom… :grinning: :+1: :coffee: :australia:

Update: I did a continuity check between pin 14 and the postive terminal of the battery holder (with the cell out) and found there is no continuity.

I don’t know how, since it’s a PCB trace, but I must have broken the continuity. I can’t see any physical damage though.

Update: I soldered a wire between pin 14 and positive battery terminal. Battery backup works again!

Thanks everyone, especially @ShermanP for the assistance.

I would, but it a mess right now. I desoldered various connections and have extra wires hanging off trying to fault find.

On the image I read 2108 and not 2018.

2018 was a typo. My hands can’t even believe the 2108. Lol

Suggestion: use the Adafruit library, in the example

I read this

rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

that is a bit different than yours.