DS3231 RTC module not displaying to serial monitor

Hey all, hope your doing great. So I've been having issues with these RTC modules, I'm just trying to make a simple clock project, but when I connect the RTC module it works for a bit, then just randomly stops working. Im using the simple RTCLIB library. This is my second RTC module I've bought, so idk if all these are faulty, or I'm doing something completely wrong. Thanks in advance if you can help. :slight_smile:

Also I scanned the i2c addresses, but it just continued saying "Scan in progress..." and nothing shows up.

#include "RTClib.h"

RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

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

#ifndef ESP8266
  while (!Serial); // wait for serial port to connect. Needed for native USB
#endif

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    while (1) delay(10);
  }

  if (rtc.lostPower()) {
    Serial.println("RTC lost power, let's set the time!");
    // When time needs to be set on a new device, or after a power loss, the
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }

  // When time needs to be re-set on a previously configured device, the
  // following line sets the RTC to the date & time this sketch was compiled
  // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  // This line sets the RTC with an explicit date & time, for example to set
  // January 21, 2014 at 3am you would call:
  // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}

void loop () {
    DateTime now = rtc.now();

    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();

    Serial.print(" since midnight 1/1/1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");

    // calculate a date which is 7 days, 12 hours, 30 minutes, 6 seconds into the future
    DateTime future (now + TimeSpan(7,12,30,6));

    Serial.print(" now + 7d + 12h + 30m + 6s: ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();

    Serial.print("Temperature: ");
    Serial.print(rtc.getTemperature());
    Serial.println(" C");

    Serial.println();
    delay(3000);
}

Here is a photo of my breadboard layout.

Also a photo of it working. (before it stopped working)

I do not immediately see something wrong with your code or your wiring.

If you upload again, does it work again for a bit? Based on below probably not.

That is worrying. As is the below
image

That looks like a damaged microcontroller. And it's close to the I2C bus so might explain your problem.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the IDE 1.x category.

Hey! Thanks for the reply. The stuff on the microcontroller was actually flux residue :sweat_smile: My bad. So microcontroller isn't broken. And I just tried it again, and nothing happens. So no idea what is it, I've tried everything I can think of

First, disconnect the i2c leads to the rtc and see if the scanner hangs with "Scan in progress..." or reports no devices.

If it hangs, there is an issue with the Arduino.

If it reports no devices, then there is an issue with the rtc. Typically there is some sort of short between sda and scl or between one of them and ground. Check carefully.

I will try that now! Thank you. Hang tight.

Maybe a bad breadboard or wires

Try female wires or solder

1 Like

Interesting. It just hangs on "Scanning..."


Change places of the circuits on the breadbord and use other holes, or change breadboard.

If you pull the Nano from the breadboard and run the scanner, you can isolate the problem to the Nano if it still hangs.

:sweat_smile: well, I'm tossing that other board out. Lol thank you. It works now, pretty sure it was breadboard.

1 Like

So is this. It looks like a hairline solder short
image
Also looks like way, way too much heat was applied to the pins.

another view...
image

The stuff on the microcontroller was actually flux residue :sweat_smile: My bad. So microcontroller isn't broken.

You will never see that much burnt residue on a properly soldered connection. The residue itself isn't the problem. It's that it probably means there was too much heat and/or improper solder flow. You may have toasted some of the vias so they don't make a reliable connection to the traces.

Nanos are relatively cheap. You should always have more than one, so you can swap in situations like this.

ohhh! to much heat? damn, never thought about that. i'll keep that in mind for my next solders lol Thanks for the tip!

Issues not resolved, it seems to work sometimes, and then other times it doesn't. I'm completely lost with this, I've tried on 3 different Nanos. And multiple different library's. Including different breadboard. Anybody have any ideas? (mostly using RTCLib) fYI this is my second RTC module. Other one does the same thing

I even went as far as taking the RTC and nano out of bread board and connecting them together. still same scenario.


This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.