RTC slows down after a few minutes and doesn't keep the correct time pace

Dabi_Aljv

Jan 31, 2025
2
Joined
Jan 31, 2025
Messages
2
Hello everyone.

I'm working on an automatic irrigation system using Arduino Mega 2560, TFT screen ILI9488, RTC module DS3231 and a KY-023 joystick module in a physical assembly (schematics are shown below).
1738286731322.png
Everything works fine. The problem is that the RTC doesn't keep the correct time. When the system is switched on, after a few minutes it starts to get delayed by seconds. The more time it is on, the more delay it gets. I'll leave the code I used here. It's a long code, mainly because of the screen part (it's also in Spanish, as it's my first language, you could ask some AI to translate the comments for you, sorry for that).

I would be very grateful for your help. Thanks in advance.
 

Attachments

  • Programador_de_Riego_ATmega328p.ino
    50.6 KB · Views: 5

Bluejets

Oct 5, 2014
7,374
Joined
Oct 5, 2014
Messages
7,374
You will find the ds3231 is an accurate device.
Suggest you build a basic circuit with just the ds3231 and the arduino, upload some basic code and verify via the serial monitor.
Also read intro at top of the forum pages.
 

Bluejets

Oct 5, 2014
7,374
Joined
Oct 5, 2014
Messages
7,374
If a dry cell is fitted to the ds3231 without disabling the charge circuit, that too could be loading the supply voltage to the point of failure.
 

Delta Prime

Jul 29, 2020
2,987
Joined
Jul 29, 2020
Messages
2,987
Either it is a bad crystal oscillator
The 32 kHz TCXO is embedded in the module.
Using the DS3231 can be a better solution as somebody has already suggested
Nobody suggested anything, that is what the thread starter:
( is not using )so…you got a point there!(AI) :mad:
Everything works fine
It would probably work better if you connected the DS3231.
Pin(1) Is your 32kHz output .
Schematic is incomplete.
Please provide a link to where you have acquired your information.
 
Last edited:

Dabi_Aljv

Jan 31, 2025
2
Joined
Jan 31, 2025
Messages
2
The 32 kHz TCXO is embedded in the module.

Nobody suggested anything, that is what the thread starter:
( is not using )so…you got a point there!(AI) :mad:

It would probably work better if you connected the DS3231.
Pin(1) Is your 32kHz output .
Schematic is incomplete.
Please provide a link to where you have acquired your information.
Everything is well connected. The 32khz pin is not necessary here and SQW is not used because I don't use interruptions in this program (I've already researched this and realized that using interruptions is the best way to operate the DS3231 module, so I'm working on it).

 
Last edited:

Delta Prime

Jul 29, 2020
2,987
Joined
Jul 29, 2020
Messages
2,987
I've already researched this and realized that using interruptions is the best way to operate the DS3231 module, so I'm working on it).
Very good something was lost in translation.Schematics are a universal language in electronics.
I know you will be successful, update your schematic. Update your code, if you have any questions, please do not hesitate to ask. :)
 

Delta Prime

Jul 29, 2020
2,987
Joined
Jul 29, 2020
Messages
2,987
I have no problem....the op does
This is true you are a wealth of information. Thank you for your contributions. I was not addressing you. :)
But I did have to take you off my ignore list just for this moment.
 
Top