I am trying to set up a simple dosing pump setup for my reef tank and I am using an Arduino UNO connected to three 24V relays to control the pumps. I am then using a DS3231 RTC off of that that connects with an I2C LED screen.
I am using the RTC module in case the Arduino looses power I want it to be able to keep the time as it would be catastrophic if it dosed too much into the tank and kill everything. I installed the "uRTCLib" library by Naguissa to read the date and time. I was able to get it working sporadically using the following code:
#include "Arduino.h"
#include "uRTCLib.h"
// uRTCLib rtc;
uRTCLib rtc(0x68);
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup() {
Serial.begin(9600);
delay(3000); // wait for console opening
URTCLIB_WIRE.begin();
// Comment out below line once you set the date & time.
// Following line sets the RTC with an explicit date & time
// for example to set January 13 2022 at 12:56 you would call:
rtc.set(0, 56, 12, 5, 13, 1, 22);
// rtc.set(second, minute, hour, dayOfWeek, dayOfMonth, month, year)
// set day of week (1=Sunday, 7=Saturday)
}
void loop() {
rtc.refresh();
Serial.print("Current Date & Time: ");
Serial.print(rtc.year());
Serial.print('/');
Serial.print(rtc.month());
Serial.print('/');
Serial.print(rtc.day());
Serial.print(" (");
Serial.print(daysOfTheWeek[rtc.dayOfWeek()-1]);
Serial.print(") ");
Serial.print(rtc.hour());
Serial.print(':');
Serial.print(rtc.minute());
Serial.print(':');
Serial.println(rtc.second());
Serial.print("Temperature: ");
Serial.print(rtc.temp() / 100);
Serial.print("\xC2\xB0"); //shows degrees character
Serial.println("C");
Serial.println();
delay(1000);
}
It was supposed to output looking like this:
but it looked like this after I update the time/date information:
Any help would be appreciated!

