In this tutorial, we will see how we can interface DS3231 RTC module to ARIES v3 board. Real Time Clock (RTC) is an electronic device which is used to provide precise time and date in various applications like GPS, Servers, Data loggers etc. It is powered by an on board lithium battery, which makes RTC work even when the power is off.
DS3231 RTC
The DS3231 RTC module is low cost and communicates over I2C interface having a supply voltage range from 2.3V to 5.5V . It has an in built crystal oscillator and temperature sensor which makes the IC more compact. A secondary EEPROM IC of 32 KB size is also provided with this module. To provide uninterrupted power supply, there is a provision to provide battery also.
Prerequisites
- Windows 10 or above/Linux (64 bit)
- Arduino IDE
- VEGA ARIES Board support package
Components Required
- ARIES v3.0 Board
- USB type C to USB type A cable
- DS3231 RTC Module
- Jumper Wires
Circuit Diagram:
Connections:
RTC | ARIES V3 board |
VCC | 3V3 |
GND | GND |
SCL | SCL-0 |
SDA | SDA-0 |
Procedure
Open and set up the Arduino IDE as described in Getting Started with ARIES v3.0.
- Make sure you have selected ARIES v3 Board from Tools -> Board -> VEGA Processor: ARIES Boards -> ARIES v3
- Select Tools -> Flash Mode -> Enabled
- Select Programmer as VEGA FLASHER from Tools -> Programmer -> VEGA FLASHER
- Also select appropriate port from Tools -> Port -> COM* (ARIES Board)
Now, Open Files -> Examples -> Under Examples for ARIES v3 -> Wire-> RTC-> RTC_SetTime
Libraries
Arduino libraries are an extension of the standard Arduino API and consists of thousands of libraries, both official and contributed by the community. Libraries simplifies the use of complex codes. Every version of Arduino IDE has a library manager for installing Arduino software libraries. The libraries required for this projects are:
- Time
- DS1307RTC
To install the libraries required for this project.
Go to Tools -> Library Manager -> and search with the library names mentioned above
Once you have downloaded the required libraries you can upload the code to ARIES board.
Output
Once the code is uploaded, Open the Serial Monitor at 115200 baud rate and you can see the current time is set as the initial time in your RTC Module.
Output for “RTC_SetTime” program
Now you can run the Read Test program from the path given below.
Open Files -> Examples -> Under Examples for ARIES v3 -> Wire-> RTC-> RTC_ReadTest to view the the updated time as per the current time, in the Serial Monitor.
Output for RTC_ReadTest program can also be viewed in serial monitor with the current updated time.
Output for “RTC_ReadTest” program