Comments on: Guide for Real Time Clock (RTC) Module with Arduino (DS1307 and DS3231) https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 05 Nov 2024 02:21:13 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Johnny https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-980740 Tue, 05 Nov 2024 02:21:13 +0000 http://randomnerdtutorials.com/?p=27399#comment-980740 hi Guys

im working on a timer using ds1307 but im facing a problem when i set the start time lets say to 23:00 & stop time to 00:05

here is the code to turn on
if ((out1TimeControl) == 0 && (settingsDisplay1) == 0) {
if ((out1OffTimeSetHours) < out1OnTimeSetHours) {
if ((tm.Hour) >= out1OnTimeSetHours && (tm.Minute) >= out1OnTimeSetMinutes) {
out1TimeControl = 1;
}
}
}

im looking for idea to turn off please

thanks

]]>
By: Kees https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-863969 Wed, 04 Oct 2023 21:18:48 +0000 http://randomnerdtutorials.com/?p=27399#comment-863969 Little correction:
The line (16:32:00 at Wednesday 4th of October 2023) had to be
(16:32:00 at Monday, the 9th of October 2023)

]]>
By: Kees https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-863850 Wed, 04 Oct 2023 14:50:21 +0000 http://randomnerdtutorials.com/?p=27399#comment-863850 Hi Rui and Sara,

Thank you for publishing the example using a RTC.
I just have bought a RTC module and connected it as you show in the schematics.
The layout is the same as the model you have showed in the schematics.
I have put no battery in the module for now. It is continuously connected and the power is up.
I am using a Nano using the same connections (A4 and A5) as the Uno.
Then I copied today the raw code (written by John Boxall from http://tronixstuff.com) as the sketch from your page.
I changed the line “setDS3231time(30,42,16,5,13,10,16);” for the initial time (16:32:00 at Wednesday 4th of October 2023) as
sec=0, minutes=32, hours=16, day (Monday)=2, date=9, month October=10, year=23
as follows: setDS3231time(0,32,16,2,9,10,23);
Then I uploaded this sketch and opened the Serial Monitor and saw this as result:

23:10:09 1/1/0 Day of week: Sunday
23:10:10 1/1/0 Day of week: Sunday
23:10:11 1/1/0 Day of week: Sunday
23:10:12 1/1/0 Day of week: Sunday
23:10:13 1/1/0 Day of week: Sunday

The year is used as hours etc, it looks as all is in reverse order. Always 1/1/0 Day of week:Sunday

I have also used your I2C scanner, downloaded from your page about the OLED display SSD1306 to determine the Address of this RTC
with this output in the Serial Monitor:

Scanning…
I2C device found at address 0x57
I2C device found at address 0x5F
I2C device found at address 0x68
done

I believe it is address 0x68.
In your I2C sketch I have looked but can not find where the other two addresses are coming from.

]]>
By: vicfret https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-768253 Mon, 11 Jul 2022 10:08:53 +0000 http://randomnerdtutorials.com/?p=27399#comment-768253 hi rui i want to interface the ds3231 with esp8266 ow do i go about it

]]>
By: Zaga https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-764386 Thu, 23 Jun 2022 11:20:41 +0000 http://randomnerdtutorials.com/?p=27399#comment-764386 Buy another DS3231 – your unit must be faulty.
These units are amazingly accurate – I have quite a few running for years!!
Check if the temperature in your unit does not exceed the temperature as per spec – this might affect it by a few seconds per month!
Not the extract below…

Retain the time in the Real Time Clock
If you don’t want to reset the time every time the RTC is turned off, you should do the following:

after setting up the time, you should comment the function that sets the time and upload the code again.
comment-the-code

This is a very important step to set up the time in your RTC. If you don’t do this, everytime your RTC resets, it will display the time that you’ve set up previously and not the current time.

]]>
By: Larry https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-764233 Wed, 22 Jun 2022 17:27:26 +0000 http://randomnerdtutorials.com/?p=27399#comment-764233 I see that there is nearly full consensus that this code works for setting and keeping the time even when disconnected from power. I have done this and many other “ideas” from various people on the web and my DS3231 clocks never keep the correct time if I unplug it from power with a battery in it. I have wasted hours taking out and replacing batteries, restarting, etc. etc. etc. Yes, etc. So, what I do now is put in two buttons to manually advance the hour and/minute settings when my clock starts up. All I need are the clock times so this works well for my clocks and I never have to worry again about the RTC keeping the correct time. No need to respond, I have given up on having my RTC’s retain the correct time.

]]>
By: Luc Verville https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-574885 Fri, 19 Mar 2021 16:04:06 +0000 http://randomnerdtutorials.com/?p=27399#comment-574885 Hi Rui and Sara, and congratulations always for your instructive and interesting guides.
I have tested this scketch on a ESP-32 and it works great.

Can u Add this for Temperature on DS3231on your exemple ?? Maybe this help.

//——————————————————————————————-
// Routine pour Lire la Température dans le DS3231
// Par: Luc Verville
// Mars 21
// Rev :1.0
//————————————————————————————————

void showTemperature() {
uint8_t lsb;
int8_t msb;
Wire.beginTransmission(DS3231_I2C_ADDRESS);
Wire.write(0x11); //Temperature registers (11h-12h) get updated automatically every 64s
// Wire._I2C_WRITE(DS3231_TEMPERATUREREG);
Wire.endTransmission();

Wire.requestFrom(DS3231_I2C_ADDRESS, 2);
msb = Wire.read(); // msb = bcdToDec(Wire.read());
lsb = Wire.read(); // lsb = bcdToDec(Wire.read());

// Serial.print(“Temperature : “); Serial.print ((float)msb + (lsb >> 6) * 0.25f ); Serial.print(” C “);
// Serial.print (( 1.8 * ((float)msb + (lsb >> 6) * 0.25f) + 32)); Serial.println(” F”);

}

]]>
By: Brian S https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-545476 Mon, 25 Jan 2021 04:09:30 +0000 http://randomnerdtutorials.com/?p=27399#comment-545476 Awesome! I am currently working on building a seven segment 4 digit clock using the uno, ds3231, and 114 ws2812b leds. I wanted to build a large display. I’m new at all of this so I’m hoping to find enough info to make it work. Thanks!

]]>
By: Marek Sukup https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-530870 Sat, 19 Dec 2020 07:24:47 +0000 http://randomnerdtutorials.com/?p=27399#comment-530870 Hello Rui,
I would like to ask how is possible to set time by buttons. Is there any way how to do it? I want to build wall clock and sometimes is necessary correct time settings.

]]>
By: Donald Garber https://randomnerdtutorials.com/guide-for-real-time-clock-rtc-module-with-arduino-ds1307-and-ds3231/#comment-513375 Mon, 02 Nov 2020 21:16:26 +0000 http://randomnerdtutorials.com/?p=27399#comment-513375 In reply to JoeBar.

Good question, so our rtc will update despite DST changes.

]]>