DS3231 RTC not working?

So ive been on the lookout for an answer for some time now and ive tried multiple Librarys, Example codes, the A4 + A5 and the extra Sda + Sdl pins. Everthing i try it doesnt work. The red light for Power is on and its hooked up like this right now:

SDA -> A4
SCL -> A5
GND -> GND
VCC -> 5V

I've tried Codes from Librarys that set up time and give out the Information via Serial Monitor in a loop with a 1s delay. Now i got curious and placed a little "Serial.println("hello"); above and below the first rtc command that is in the code.... The serial Monitor only shows the first. It seems to kind of Crash the Arduino or hang up on the command... I dont now if it would be indicated at the Board lights but they all are acting normal... no kind of "shutdown" or "crash" noticable.

Pssst - we can't see your code.

Try this sketch

//https://datasheets.maximintegrated.com/en/ds/DS3231.pdf

#include <Wire.h>
const byte CLOCK_ADDRESS = 0x68;
const byte clockSecond = 0x00;
const byte clockMinute = 0x01;
const byte clockHour = 0x02;
const byte clockDay = 0x03;
const byte clockDate = 0x04;
const byte clockMonth = 0x05;
const byte clockYear = 0x06;
const byte alarm1Seconds = 0x07;
const byte alarm1Minutes = 0x08;
const byte alarm1Hours = 0x09;

const byte clockTempMSB = 0x11;
const byte clockTempLSB = 0x12;

void printTime(boolean date = false);

void setup()
{
  Serial.begin(115200);
  while (!Serial);
  setClock(10, 11, 21, 11, 15, 57); //day, month, year, hour, minute, second
}

void loop()
{
  printTime(true);
}

void setClock(byte date, byte month, byte year, byte hour, byte minute, byte second)
{
  Wire.begin();
  writeByte(clockDate, date);
  writeByte(clockMonth, month);
  writeByte(clockYear, year);
  writeByte(clockHour, hour);
  writeByte(clockMinute, minute);
  writeByte(clockSecond, second);
}

void printTime(boolean showDate)
{
  static byte previousSecond = 0;
  byte currentSecond = readClock(clockSecond);
  if (currentSecond != previousSecond)
  {
    previousSecond = currentSecond;
    Serial.print(bcdToDec(readClock(clockHour)));
    Serial.print(":");
    Serial.print(bcdToDec(readClock(clockMinute)));
    Serial.print(":");
    byte currentSecond = readClock(clockSecond);
    Serial.print(bcdToDec(currentSecond));
    if (showDate)
    {
      Serial.print(" ");
      printDate();
    }
    else
    {
      Serial.println();
    }
  }
}

void printDate()
{
  Serial.print(bcdToDec(readClock(clockDate)));
  Serial.print("/");
  Serial.print(bcdToDec(readClock(clockMonth)));
  Serial.print("/");
  Serial.println(bcdToDec(readClock(clockYear)));
}

void printTemp()
{
  byte msb = readClock(clockTempMSB);
  byte lsb = readClock(clockTempLSB) & 0b11000000;
  lsb = lsb >> 4;
  Serial.print("MSB : ");
  Serial.println(msb);
  Serial.print("LSB : ");
  Serial.println(lsb);
  float temp3231 = ((((short)msb << 8) | (short)lsb) >> 6) / 4.0;
  Serial.println(temp3231);
}

byte readClock(byte clockData)
{
  Wire.beginTransmission(CLOCK_ADDRESS);
  Wire.write(clockData); //start reading here
  Wire.endTransmission();
  Wire.requestFrom(CLOCK_ADDRESS, 1); //get a byte
  return Wire.read();
}

byte decToBcd(byte val)
{
  return ( (val / 10 * 16) + (val % 10) );
}
byte bcdToDec(byte val)
{
  return ( (val / 16 * 10) + (val % 16) );
}

void writeByte(byte address, byte value)
{
  Wire.beginTransmission(CLOCK_ADDRESS);
  Wire.write(address); //start writing here
  Wire.write(decToBcd(value)); //write this
  Wire.endTransmission();
}

Make sure that the baud rate in the Serial monitor matches that of the sketch

Oh i forgot. Im sorry. I used many different Example Scetches from different RTCLibraries that said they would support DS3231 for Arduino Uno.

I also stumbled upon this and someone said it should recognize 0x68 2 times (being the RTC)
Nothing happened except "scanning..." for me in Serial Monitor tho.

#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

You may note that the code above does not use a library

Tried. Sadly the Serial Monitor is completely empty.

I got in mind that the RTC might be faulty but since it has a red glowing Led signaling it gets power i dont really think it is.

Hi @justme80
Have you ever run the I2C scanner to make sure the arduino is finding the I2C and identifying your RTC address?

RV mineirin

Posted an answer reffering to that above. Might be that something is not right tho with that sketch or it is too old.

Here another example i used but didn't work. ^^'

// Arduino DS3232RTC Library
// https://github.com/JChristensen/DS3232RTC
// Copyright (C) 2018 by Jack Christensen and licensed under
// GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html
//
// Example sketch to display the date and time from a DS3231
// or DS3232 RTC every second. Display the temperature once per
// minute. (The DS3231 does a temperature conversion once every
// 64 seconds. This is also the default for the DS3232.)
//
// Set the date and time by entering the following on the Arduino
// serial monitor:
//  year,month,day,hour,minute,second,
//
// Where
//  year can be two or four digits,
//  month is 1-12,
//  day is 1-31,
//  hour is 0-23, and
//  minute and second are 0-59.
//
// Entering the final comma delimiter (after "second") will avoid a
// one-second timeout and will allow the RTC to be set more accurately.
//
// No validity checking is done, invalid values or incomplete syntax
// in the input will result in an incorrect RTC setting.
//
// Jack Christensen 08Aug2013

#include <DS3232RTC.h>      // https://github.com/JChristensen/DS3232RTC
#include <Streaming.h>      // http://arduiniana.org/libraries/streaming/
#include <Wire.h>
#include <time.h>

void setup()
{
    Serial.begin(115200);

    // setSyncProvider() causes the Time library to synchronize with the
    // external RTC by calling RTC.get() every five minutes by default.
    setSyncProvider(RTC.get);
    Serial << F("RTC Sync");
    if (timeStatus() != timeSet) Serial << F(" FAIL!");
    Serial << endl;
}

void loop()
{
    static time_t tLast;
    time_t t;
    tmElements_t tm;

    // check for input to set the RTC, minimum length is 12, i.e. yy,m,d,h,m,s
    if (Serial.available() >= 12) {
        // note that the tmElements_t Year member is an offset from 1970,
        // but the RTC wants the last two digits of the calendar year.
        // use the convenience macros from the Time Library to do the conversions.
        int y = Serial.parseInt();
        if (y >= 100 && y < 1000)
            Serial << F("Error: Year must be two digits or four digits!") << endl;
        else {
            if (y >= 1000)
                tm.Year = CalendarYrToTm(y);
            else    // (y < 100)
                tm.Year = y2kYearToTm(y);
            tm.Month = Serial.parseInt();
            tm.Day = Serial.parseInt();
            tm.Hour = Serial.parseInt();
            tm.Minute = Serial.parseInt();
            tm.Second = Serial.parseInt();
            t = makeTime(tm);
            RTC.set(t);        // use the time_t value to ensure correct weekday is set
            setTime(t);
            Serial << F("RTC set to: ");
            printDateTime(t);
            Serial << endl;
            // dump any extraneous input
            while (Serial.available() > 0) Serial.read();
        }
    }

    t = now();
    if (t != tLast) {
        tLast = t;
        printDateTime(t);
        if (second(t) == 0) {
            float c = RTC.temperature() / 4.;
            float f = c * 9. / 5. + 32.;
            Serial << F("  ") << c << F(" C  ") << f << F(" F");
        }
        Serial << endl;
    }
}

// print date and time to Serial
void printDateTime(time_t t)
{
    printDate(t);
    Serial << ' ';
    printTime(t);
}

// print time to Serial
void printTime(time_t t)
{
    printI00(hour(t), ':');
    printI00(minute(t), ':');
    printI00(second(t), ' ');
}

// print date to Serial
void printDate(time_t t)
{
    printI00(day(t), 0);
    Serial << monthShortStr(month(t)) << _DEC(year(t));
}

// Print an integer in "00" format (with leading zero),
// followed by a delimiter character to Serial.
// Input value assumed to be between 0 and 99.
void printI00(int val, char delim)
{
    if (val < 10) Serial << '0';
    Serial << _DEC(val);
    if (delim > 0) Serial << delim;
    return;
}

You will get nowhere unless an I2C scanner can detect the clock and report its address

I mean im still more of a beginner im sorry but isnt that one Sketch i first replied one of those Scanners?

Just tested another it is stuck at 22:21:09.148 -> I2C Scanner 22:21:09.195 -> Scanning...

Try this scanner. I know that it works

#include <Wire.h>

void setup()
{
  Wire.begin();
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for (address = 1; address < 127; address++ )
  {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");
      nDevices++;
    }
    else if (error == 4)
    {
      Serial.print("Unknown error at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
  delay(5000);           // wait 5 seconds for next scan
}
23:03:21.328 -> I2C Scanner
23:03:21.328 -> Scanning...

I dont know maybe it takes like 10 Minutes to detect but i guess that my RTC that just arrived today already is half dead.... barely lighting its red Power light to trick me. Also got a Fresh battery for it too.

Your RTC should be detected in a few seconds. The scanner should report if no I2C devices are detected

That is.... really weird it doesnt say anything else except those 2 lines above.... after like a Minute it repeats.... Could it be my Arduino crashes?

Try printing the address in the for loop so that you can follow what is going on better

Added Line Serial.println(address); It prints "0"

Serial Monitor:

23:16:53.286 -> 
23:16:53.286 -> I2C Scanner
23:16:53.286 -> Scanning...
23:16:53.286 -> 0

I got some other posts suggesting Pullup resistors but doesnt my arduino have some built in? (Nevermind the Rtc has built in 4.7k 2x)

The fact that the scanner hangs instead of returning "No devices found" is a bad sign.

What does the scanner program give you with nothing connected to the I2C lines. If it hangs, there is a problem with the Arduino. If it says no devices found, then there is most likely a short between SDA and SCL or between either one of them and ground or to 5v.

Check very carefully for solder bridges.

No response... still hangs. What could lead to it hanging ? Literally no connections.

I noticed the Digital Pin ~5 is clogged up with a smal metal piece that came loose sometime ago. The RTC doesnt have and bridges checking the Arduino Uno R3 now.

Edit: Arduino Uno R3 doesnt have any bridges or they are microscopic

What does that mean, please?