I keep seeing stuff about this: https://www.arduino.cc/reference/en/libraries/rtcvars/ when looking for storage for a few variables that survive turning off and on, but then it is only on ESP8266.

The thing I am trying to understand is what it has to do with the RTC.. Other RTCs don't seem to have this arbitrary storage ability. Is the RTC in an ESP8266 nothing like any other RTC? Or is this really just some other storage on the chip? And what is the storage technology itself? If I am using an arduino uno, or just at avr chip, is there any unit I can attach that is or isn't part of an RTC with the same storage properties? Or does every RTC have this ability, and just need somebody to write the library?

According to this https://forum.arduino.cc/t/save-data-in-nonvolatile-memory/140801/2, the RTC memory of the the ESP8266 can be written to an infinite number of times, whereas an SD card will wear out if you update a value on it every second (like for a counter).

What technology is this "RTC memory" using that I can attach to my avr project?

  • 1
    the RTC memory of esp8266 is cleared if the module is without power. its content is preserved on reset.
    – Juraj
    Commented Jan 20, 2022 at 12:30
  • oh. I misunderstood. I thought there was a clock battery in there that kept it going. but I guess a nodemcu doesn't have a built in clock battery. thanks.
    – Alex028502
    Commented Jan 20, 2022 at 13:48
  • since SD cards wear-level, and a 4gb card is as cheap as any, it would take a really really long time to wear one out just by writing a number once a second.
    – dandavis
    Commented Jan 22, 2022 at 3:04
  • >>> 4000000000 / 60 / 60 / 24 / 365 126.83916666666667 good point
    – Alex028502
    Commented Jan 22, 2022 at 7:39
  • and I guess it'll keep writing my byte 8 bit number to the same byte until it wears out and then move on to the next one.
    – Alex028502
    Commented Jan 22, 2022 at 7:42

1 Answer 1


Some RTC chips contain a small amount of battery-backed SRAM ("NVRAM" - Non-Volatile RAM) which you can use for whatever you like. This is just ordinary RAM which is powered by the small battery that keeps the RTC running.

Not all do, though, so check the specs for your chosen RTC chip.

For example, the DS1302 has:

31 x 8 Battery-Backed General-Purpose RAM

That's 31 bytes of storage you can use for what you like.

Conversely the DS3231 doesn't have any spare RAM at all.


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.