Arduino Library =link=: Virtuabotixrtch
The VirtuabotixRTC library is designed for two primary chips:
To use the library, you must connect the DS1302 RTC module to your Arduino. The DS1302 uses a 3-wire serial interface (distinct from I2C or standard SPI). DS1302 Pin Description Arduino Pin (Example) Power Supply (2.0V - 5.5V) 5V or 3.3V GND CLK Serial Clock DAT Serial Data RST (or CE) Reset / Chip Enable
Performance will be slower but functional. virtuabotixrtch arduino library
Mastering Timekeeping with the VirtuabotixRTC Arduino Library
into your module. This ensures that even if your Arduino loses power, the RTC keeps ticking, so you don't have to reset the time every time you reboot. DS1302 vs. DS3231: The VirtuabotixRTC library is designed for two primary
Reads the current time from the DS1302 and updates internal second , minute , hour , dayofmonth , month , year variables.
Its origins can be traced back to a version of the library hosted on the Virtuabotix website. A common direct download source for this library was a URL originally hosted on a Virtuabotix LLC server. This library was specifically designed to work with the DS1302 module, and was shared and used in countless Arduino tutorials and projects around 2015-2018, establishing its place in project tutorials from that era. DS3231: Reads the current time from the DS1302
#include <VirtuabotixRTCH.h>
#include <VirtuabotixRTC.h>
The library is perfect for hobbyist projects using the DS1302 RTC module. It's lightweight, easy to use, and requires only 3 digital pins. Remember to always call updateTime() before reading time variables, and set the initial time using setDS1302Time() only once.
The DS1302 module has 5 main pins that must connect to your Arduino. Unlike I2C devices which restrict you to specific hardware pins (A4 and A5 on the Arduino Uno), the VirtuabotixRTC library allows you to use almost any digital pins for the 3-wire interface. Standard Wiring Table DS1302 Pin Description Recommended Arduino Uno Pin Primary Power (2.0V - 5.5V) 5V or 3.3V GND CLK / SCLK Serial Clock Digital Pin 6 DAT / IO Serial Data input/output Digital Pin 7 RST / CE Reset / Chip Enable Digital Pin 8