1

Here I have made a standalone ATmega328p clock without any RTC module using the breadboard ATmega328p , LCD I2C , and some buttons which I would like to turn on for atleast an year (supposed to be without any reset or power-interrupts).

I am powering my ATmega using an old mobile charger (5v , 500mA) of a old broken Android.

However I am not using any millis() or something alike these in the clock code,

So how long will my clock run if is it supposed to be online 24/7

Should I reset it sometimes? If yes , when, after how many days should I reset it?

And do I need a coolant system for it? (I guess not)

Thanks for your precious time .

3
  • 1
    I like to enable the watchdog timer inside the ATMega328, so that, if my code ever hangs, the mcu will reset itself.
    – Gerben
    Commented Nov 13, 2020 at 14:26
  • @Gerben, can u please give me the board manager link for bootloading 8mhz internal clock in Atmega328p u Commented Nov 19, 2020 at 18:11
  • 1
    You can use the bootloader used for the 8Mhz 3.3V Arduino Pro mini, but alter the fuse settings so it uses the internal oscillator, instead of a crystal. I hope that helped. Otherwise, create a new question so everyone can help you, instead of just me.
    – Gerben
    Commented Nov 20, 2020 at 13:51

1 Answer 1

3

So how long will my clock run if is it supposed to be online 24/7

Until you turn it off or a stray neutrino corrupts the flash memory, or the flash memory degrades (20-100 years or so depending on temperature).

Should I reset it sometimes? If yes , when, after how many days should I reset it?

No.

And do I need a coolant system for it? (I guess not)

No. Not unless it's in a sealed container with no ventilation and a hot environment.

However

Your RTC-less "clock" will probably not be particularly accurate, unless you have some external source of time (NTP, GPS, etc) as the Arduino's internal timing is not very accurate, and built on a breadboard it's even less so due to excess stray capacitance.

7
  • My standalone ATmega clock runs 1 min slower than original clock (till yet), I have used 5 buttons for fixing them manually. If I don't touch it for 5-7 days, will the time of ATmega run more slowly or will continue this 1 minute difference from RTC in future? Commented Nov 13, 2020 at 12:14
  • Yes. It will do one of those. That's as accurate as I can be. Only time will tell.
    – Majenko
    Commented Nov 13, 2020 at 12:15
  • 2
    I can't be clear. There is no answer. The clock will either run fast (gain time), run slow (lose time) or run the same (keep time). It is impossible to know what until you actually run the clock and measure the time. It is far more likely to drift over time that be the real time, but will it run fast or slow? That's not possible to know without measuring it.
    – Majenko
    Commented Nov 13, 2020 at 12:24
  • 1
    Interesting. Atmel's flash-based "ATmega" microcontrollers typically promise retention times of 20 years at 85 °C (185 °F) and 100 years at 25 °C (77 °F). I didn't know that.
    – Gerben
    Commented Nov 13, 2020 at 14:24
  • 1
    Two additional points if I may. First, don't expect two Arduinos to run at the same speed, particularly if they are clocked by a resonator rather than a crystal. Second, avoid all dynamic memory allocation since unless carefully organised you will eventually have a fragmented heap and things will no longer work as you intend. Commented Nov 13, 2020 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.