[Time] RX8025 Real-Time Clock Library

The RX8025 is a Precision Real Time Clock (RTC) Module with I2C interface. This is a library (for arduino or cpp) that handles interfacing with the RX8025 module. It is a very easy module that works fine if the module is hooked up correctly (see datasheet if needed -google is your friend-). This Realtime clock is also present on the Seeeduino Stalker and that’s how i use the rtc at this time. It works pretty well; see the example file and .zip i have provided. put the content of the .zip in your /Arduino/Libraries folder.

You can set the correct time of the RX8025 by using the method in the bottom.

Download

Download: RX8025.zip

Example code

This code is also already included in the .zip file

  1. #include <wire.h>
  2. #include <rx8025.h>
  3.  
  4. void setup()
  5. {
  6.   Serial.begin(9600);
  7.   RX8025.init();
  8. }
  9.  
  10. void loop()
  11. {
  12.   int rtc_sec, rtc_min, rtc_hou, rtc_wee, rtc_dat, rtc_mon, rtc_yea;
  13.   delay(1000); // There will be new values every 100ms
  14.  
  15.   RX8025.getRtcTime(&rtc_sec, &rtc_min, &rtc_hou, &rtc_wee, &rtc_dat, &rtc_mon, &rtc_yea);
  16.  
  17.   Serial.print(rtc_dat,DEC);
  18.   Serial.print("/");
  19.   Serial.print(rtc_mon,DEC);
  20.   Serial.print("/");
  21.   Serial.print(rtc_yea,DEC);
  22.   Serial.print(" ");
  23.   Serial.print(rtc_wee,DEC);
  24.   Serial.print(" ");
  25.   Serial.print(rtc_hou,DEC);
  26.   Serial.print(":");
  27.   Serial.print(rtc_min,DEC);
  28.   Serial.print(":");
  29.   Serial.println(rtc_sec,DEC);
  30.  
  31. }
  1. //First define this
  2. unsigned char RX8025_time[7]={0x00,0x52,0x13,0x01,0x11,0x04,0x11 //second, minute, hour, week, date, month, year, BCD format};
  3.  
  4. //Then call this
  5. RX8025.setRtcTime(RX8025_time);

Tim Zaman

MSc Biorobotics. Specialization in computer vision and deep learning. Works at NVIDIA.

You may also like...

1 Response

  1. Ed says:

    Hi,

    The line of code that says: unsigned char RX8025_time[7]={0x00,0x52,0x13,0x01,0x11,0x04,0x11 //second, minute, hour, week, date, month, year, BCD format};

    …comments out the last curly bracket and semi-colon.

    Cheers,

    Ed