Virtuabotixrtc.h Arduino Library ((free)) Jun 2026

delay(60000); // Log every minute

delay(1000);

Once upon a time in the digital world of Arduino, there was a tiny, ticking heartbeat known as the DS1302 Real-Time Clock virtuabotixrtc.h arduino library

The DS1302 is an integrated circuit that acts like a digital wristwatch for microcontrollers. Unlike the standard internal clock of an Arduino—which resets whenever power is lost—the DS1302 often features a and a dedicated crystal oscillator. This hardware ensures that the device maintains accurate time (seconds, minutes, hours, days, months, and years) even when the main system is powered down. Functionality of virtuabotixRTC.h

This straightforward API allows a novice to get an RTC working within minutes. A typical usage pattern involves calling updateTime() in every iteration of loop() , then reading the public variables for display or logic decisions. delay(60000); // Log every minute delay(1000); Once upon

Serial.print("Logged: "); Serial.println(temperatureC);

void setup() Serial.begin(9600);

This tiny board usually has 5 pins:

The library allows you to set the initial time, update the clock's internal variables, and retrieve individual time components like seconds, minutes, hours, and the date. Functionality of virtuabotixRTC

One of the most subtle aspects of VirtuabotixRTC.h is its handling of BCD vs. binary. The DS1302 stores time natively in BCD: for example, 42 seconds is stored as 0x42 (binary 01000010), not 0x2A (binary 00101010).

This is a very common issue when working with cheap DS1302 modules. Users have reported that their clock runs five times faster than normal. This is almost always due to a faulty or low-quality 32.768kHz quartz crystal on the RTC module. The best solution is to or upgrade to a DS3231 module.