Virtuabotixrtch Arduino | Library [upd]

// print formatted Serial.print(hour); Serial.print(":"); if(minute < 10) Serial.print("0"); Serial.print(minute); Serial.print(":"); if(second < 10) Serial.print("0"); Serial.print(second); Serial.print(" "); Serial.print(month); Serial.print("/"); Serial.print(day); Serial.print("/"); Serial.println(year);

Ensure myRTC.updateTime() is called inside the loop() function.

The classic, most common RTC. It’s cheap, highly functional, and reliable, though slightly less accurate over long periods. virtuabotixrtch arduino library

(Note: Unlike I2C sensors, the DS1302 does not require specific hardware I2C pins (SDA/SCL); you can define the pins in the code.)

| Limitation | Details | |------------|---------| | | Last update ~2014; no support for modern Arduino cores | | No ESP32/STM32 support | Timing assumptions fail on faster MCUs | | Day-of-week bug | Some versions miscompute dayofweek internally | | No alarm/interrupts | Unlike DS3231, DS1302 lacks alarms | | Accuracy | DS1302 drifts significantly (±5–20 min/month) without calibration | | 24-hour mode only | Library forces 24-hour mode; 12-hour mode not supported | // print formatted Serial

The library's simplicity makes it a favorite for a wide array of projects. Here are some common examples found in the community:

The following code sets the RTC and prints the time to the Serial Monitor every second. (Note: Unlike I2C sensors, the DS1302 does not

After installation, you can verify it was successful by navigating to . You should see an entry for the "VirtuabotixRTC" library, which contains example sketches you can explore.

The library is an Arduino library designed to interface with the DS1302 real-time clock (RTC) chip. It was developed by Virtuabotix (a now-defunct hobby electronics company) to provide a simple, memory-efficient way to read and set time on DS1302-based RTC modules. While the library is no longer actively maintained, it remains popular for legacy projects and for use with low-cost DS1302 modules from eBay, Amazon, and AliExpress.