Why ZenRTC? Many DS3231 modules trigger OSF and cause time jumps when the coin cell sags or boards brown out. ZenRTC hardens your setup by clearing flags, validating time, and persisting a last‑known‑good epoch in NVS.
- Auto‑detects OSF and invalid time; clears flags safely
- Sanity checks time (range & large jump detection)
- Clamps wild jumps back to last‑known‑good
- Optional seed from build time on first invalid boot
- Simple API; Arduino‑compatible; ESP32 only
Arduino IDE
- Download/clone this repo as
ZenRTC. - Place it under your Arduino
libraries/folder. - Restart Arduino IDE → File → Examples → ZenRTC → Basic.
PlatformIO
- As a project library: copy
ZenRTC/to your project’slib/folder. - Or use
lib_depswith a VCS URL.
#include <ZenRTC.h>
ZenRTC rtc;
void setup(){
Serial.begin(115200);
rtc.begin(true);
}
void loop(){
ZenRTC::DateTime dt;
if (rtc.now(dt)) {
Serial.printf("%04u-%02u-%02u %02u:%02u:%02u\n", dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second);
}
delay(1000);
}MIT © 2025 NexByteIO