DS3231 RTC Corruption

I've been trying to fix my ds3231. The issue was that it was spitting out random numbers for the time and data. I was told on Reddit that this most likely means that the repositories are corrupt and the only way to reset it would be to plug a valid number into every possible repository. Since then I gave up on that because I didn’t see it worth my time so I just bought a pack of 5 new DS3231’s. However even without writing anything onto them ever it’s spitting out the same corrupt numbers. I also tried running code without any DS3231 connected and got the same response. At this point, I think that the Arduinos internal time is corrupt as well. However, after looking around I’m not sure if that’s even a thing that can happen or how I would go about fixing that. As mentioned in my previous post I’m using the library by JChristensen however when troubleshooting I’ve gone through all the libraries that you can find out there. At this point, I’m not even sure if this is a hardware or a software problem. Any help would be greatly appreciated.

If everything is going wrong, then ignore all the libraries you have tried for your DS3231 and just stick with the basic I2C wire commands.

Have a look at #2 of this discussion.

Other than that, tell us which DS3231 module you have and how you connected it up and we may be able to help some more.

I have this one:

This is my schematic:

The problem is almost certainly with the code you haven't posted.

What code have you been using? To make better connections, you can plug that module into A2..A5 (GND, VCC, SDA, SCL) and then just make A2 a digtial output that is low and A3 a digital output that is HIGH to power it up.

The problem is almost certainly with the code you haven't posted.

Or, it could be with the hardware setup, which schematic you haven't shown us.

Sorry for not posing the code directly I thought that people would find it through the GitHub page I linked. It's also my fault for not posting the schematic I forgot that on this post I've been keeping up with two other ones on Reddit and Stack exchange I guess I forgot to post that here.

Time setting code: DS3232RTC/examples/SetSerial at master · JChristensen/DS3232RTC · GitHub
Whole schematic: https://i.stack.imgur.com/rCOVG.png
Just RTC schematic: Alarm-Scheme — ImgBB

I did find a solution, for anyone who's wondering I gave up on the DS3231. It just had too many complications that I don't have the time to deal with. Because I already had an ESP in my project I'm now grabbing the time with the NTP servers instead. For anyone whos curious hears the lib.

NTP ESP lib: GitHub - SensorsIot/NTPtimeESP: Small library for ESP8266 which returns the actual time adjusted by time zone and summer time

I don't think you can call that a solution. If you don't want to use an RTC, fine but not using one is not an option if you need it. :slight_smile: I guess it's not that important to you, but I'm sure it would have been really easy to help you if you had played by the forum guidelines, and provided the information really needed to solve the problem. Many, many people have quickly had RTC issues sorted out here. It's a very common issue. It is such a common part that there also gazillions of tutorials and other resources elsewhere.