DS3231 RTC Module with Arduino Leave a comment

About DS3231 RTC Module:

It is a precise I2C based Real-Time Clock module which is integrated with a temperature compensated crystal oscillator(TCXO) and a crystal. An onboard battery is present on the module to maintain accurate timekeeping when the main power of the module is interrupted. It also consists of 32KbEEPROM and a 10-bit temperature which has a resolution of 0.25 degree Celsius.

Pinout of DS3231 RTC Module

Features of DS3231 RTC Module:

  • Operating voltage: 2.3-5.5 volt
  • Time Format: HH:MM:SS
  • Date Format: YY-MM-DD
  • Low power consumption
  • On-board battery backup

Components Needed fr this Project:

  • Arduino UNO
  • DS3231 RTC Module
  • Jumper wires 
  • Coin Cell

Pin Connection of DS3231 RTC Module with Arduino

  • VCC-5v
  • GND-GND
  • CLK/SCL-A5
  • DAT/SDA-A4

Circuit Diagram of DS3231 RTC Module with Arduino

Arduino Code for DS3231 RTC Module

#include "DS3231.h"
DS3231  rtc(SDA, SCL);
void setup()
{
  Serial.begin(115200);
  rtc.begin();
  
 //uncomment bellow code to set dat, day and time 
  //rtc.setDOW(MONDAY);    
  //rtc.setTime(13,2,2);     
  //rtc.setDate(2,5,2019);
}
void loop() { 
 
 Serial.print("Time:  ");
 Serial.print(rtc.getTimeStr());
 Serial.print("Date: ");
 Serial.print(rtc.getDateStr());
 delay(1000); 
}

Download DS3231 Library from: www.rinkydinkelectronics.com

Replace #include “DS3231.h” with #include <DS3231.h>

Leave a Reply