Reply to topic  [ 8 posts ] 
High Accuracy DS3231 RTC & EEPROM (HCMODU0094) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 670
Post High Accuracy DS3231 RTC & EEPROM (HCMODU0094)
Image


Image

The I2C real time clock module (HCMODU0094) is based on the Maxim high accuracy DS3231 real time clock controller. Using an internal temperature compensation crystal oscillator this RTC IC is able to provide extremely high accurate time keeping. The module includes an on-board battery backup and maintains accurate timekeeping when main power to the device is interrupted. The RTC maintains seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator. Two programmable time-of-day alarms and a programmable square-wave output are provided. Address and data are transferred serially
through an I2C bidirectional bus. A precision temperature-compensated voltage reference and comparator circuit monitors the status of VCC to detect power failures, to provide a reset output, and to automatically switch to the backup supply when necessary.

Included on this module is an Atmel 24C32 32K (4096 x 8) serial I2C EEPROM which allows the module to be used as a simple data logger storing up to 4K of 8 bit data.


If you plan to use this module with a standard Arduino then you can take advantage of our exclusive library (HCRTC) to quickly integrate this module into your own Arduino project. The library also provides the ability to read and write to the included EEPROM.


Features (RTC):

● Highly Accurate RTC Completely Manages All Timekeeping Functions
• Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the Week, and Year, with Leap-Year Compensation Valid Up to 2100
• Accuracy ±2ppm from 0°C to +40°C
• Digital Temp Sensor Output: ±3°C Accuracy
• Register for Aging Trim
• Two Time-of-Day Alarms
• Programmable Square-Wave Output Signal
● Simple Serial Interface Connects to Most Microcontrollers
• Fast (400kHz) I2C Interface
● Battery-Backup Input for Continuous Timekeeping
• 2.3V to 5.5V Operation
● Operating Temperature Ranges: 0°C to +70°C


Features (EEPROM):

• Low-Voltage and Standard-Voltage Operation – 2.7 (VCC = 2.7V to 5.5V)
• Internally Organized 8192 x 8
• 2-Wire Serial Interface
• Schmitt Trigger, Filtered Inputs for Noise Suppression
• Bidirectional Data Transfer Protocol
• 100 kHz (1.8V, 2.5V, 2.7V) and 400 kHz (5V) Clock Rate
• 32-Byte Page Write Mode (Partial Page Writes Allowed)
• Self-Timed Write Cycle (10 ms max)
• High Reliability – Endurance: 1 Million Write Cycles – Data Retention: 100 Years




Image

Image




Image

Code:
/* FILE     HCRTC_Example.cpp
   DATE:    23/12/13
   VERSION: 0.2
   AUTHOR:  Andrew Davies

This is an example of how to use the Hobby Components RTC library to read and
write to and from the DS3231 real time clock & 24C32 EEPROM (HCMODU0094).

You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/


/* Include the wire library */
#include "Wire.h"
/* Include the Hobby Components RTC library */
#include <HCRTC.h>

/* Define the I2C addresses for the RTC and EEPROM */
#define I2CDS3231Add 0x68
#define I2C24C32Add  0x57

/* Example string to write to EEPROM */
char ExampleString[] = "Hobby Components";

/* Used in example as an index pointer */
byte index;

/* Create an instance of HCRTC library */
HCRTC HCRTC;


void setup()
{
  Serial.begin(9600);
 
  /* Use the RTCWrite library function to set the time and date.
     Parameters are: I2C address, year, month, date, hour, minute, second,
     day of week */
  HCRTC.RTCWrite(I2CDS3231Add, 13, 4, 24, 14, 21, 0, 3);
}

void loop()
{
  /************* Example write to EEPROM ***************/ 
 
  /* Initiate a write sequence.
     Parameters are: I2C address, EEPROM start location */
  HCRTC.EEStartWrite(I2C24C32Add, 32000);
 
  for (index = 0; index < sizeof(ExampleString); index++)
  { 
    /* Sequentially write example data to the EEPROM */
    HCRTC.EEWriteByte(ExampleString[index]);
  }
  /* End the write sequence */
  HCRTC.EEEndWrite();
 
  /* Wait for cached data to finish writing */
  delay(10); 
 
 
  /************* Example read from EEPROM ***************/ 
 
  /* Initiate read sequence.
     Parameters are: I2C address, EEPROM start location */
  HCRTC.EEStartRead(I2C24C32Add, 32000);
 

  for (index = 0; index < sizeof(ExampleString); index++)
  {
    /* Sequentially read data from EEPROM and output it to the UART */
    Serial.write(HCRTC.EEReadByte(I2C24C32Add));
  }   
  Serial.println();
   
 
  /* Continuously read the current time and date from the RTC */
  while(true)
  {
    /* Read the current time from the RTC module */
    HCRTC.RTCRead(I2CDS3231Add);
   
    /* Output the information to the UART */
    Serial.print(HCRTC.GetDay());
    Serial.print("/");
    Serial.print(HCRTC.GetMonth());
    Serial.print("/");
    Serial.print(HCRTC.GetYear());
    Serial.print(" ");
   
    Serial.print(HCRTC.GetHour());
    Serial.print(":");
    Serial.print(HCRTC.GetMinute());
    Serial.print(":");
    Serial.print(HCRTC.GetSecond());
    Serial.print(" DOW:");
    Serial.println(HCRTC.GetWeekday());
   
    /* Now output the same thing but using string functions instead: */
    Serial.print(HCRTC.GetDateString());
    Serial.print(" ");
    Serial.println(HCRTC.GetTimeString());
   
    /* Wait a second before reading again */
    delay(1000); 
  }
}





Image


Arduino Library:
The HCRTC library can be found within the software section of this forum here


Datasheets:
Attachment:
DS3231.pdf

Attachment:
24C32.pdf


You do not have the required permissions to view the files attached to this post.


Tue Jan 12, 2016 4:40 pm
Profile

Joined: Tue Sep 08, 2015 1:10 pm
Posts: 2
Post Re: High Accuracy DS3231 RTC & EEPROM (HCMODU0094)
Hi guys,
I'm having trouble with the HCRTC sketch.
I'm getting an error saying that HCRTC.h doesn't exist. Please see screenshot.jpg attached.
Image
Many thanks in advance for any advice you can give

Seamus


Fri Jun 17, 2016 4:43 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 706
Post Re: High Accuracy DS3231 RTC & EEPROM (HCMODU0094)
It looks like the library files are in the wrong place. The two files that end in .h and .cpp need to be put in the following location:

My Documents\Arduino\libraries\HCRTC\

If any of these folders don't exist just create them. After you have moved them there you will also need to restart your Arduino IDE.

Alternatively you should be able to install the library by selecting Sketch->Include Library->Add .Zip library in your Arduino IDE. Then just point it to the HCRTC.zip (must be in its zipped form) file. It should then automatically unzip the files and put them in your Library folder.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Sat Jun 18, 2016 7:58 am
Profile

Joined: Tue Sep 08, 2015 1:10 pm
Posts: 2
Post Re: High Accuracy DS3231 RTC & EEPROM (HCMODU0094)
Thanks for that it solved my problem! I'm very new at this and learning fast with help from people like yourself!

Seamus


Sat Jun 18, 2016 8:14 am
Profile

Joined: Thu Jul 09, 2015 11:28 am
Posts: 1
Post Re: High Accuracy DS3231 (HCMODU0094) remove red led
Hi, the red led is very bright for my project, .
Is there a way to switch it off?

If not, will removing it effect the operation of the RTC??

Thanks
Mik


Fri Mar 03, 2017 11:59 am
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 706
Post Re: High Accuracy DS3231 RTC & EEPROM (HCMODU0094)
The power LED is connected across the 5V supply so I'm afraid there is no way to turn it off. The only other thing I can suggest to avoid having to desolder it is to use a permanent marker pen or tape to cover it.

If you do want to permanently disable it then you may want to consider removing the black surface mount resistor (marked 102) next to it instead as it is less delicate.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Fri Mar 03, 2017 3:36 pm
Profile

Joined: Sun Aug 27, 2017 5:05 pm
Posts: 3
Post Re: High Accuracy DS3231 RTC & EEPROM (HCMODU0094)
Hi

I was looking on Amazon for an RTC for an Arduino project, I noticed that there were a few reviews of this model with warnings about battery charging see below, is this a genuine issue?

Does this come with a CR2032(non-rechargeable battery) or LIR2032(rechargeable battery)?

Is there a charging circuit built in?

Should the charging circuit be disabled as described below?

Thanks in advance

Simon

Quote:
Fine RTC for Arduino but also a ***WARNING***: The device is specified to operate in range 2.3V to 5.5V but has the design flaw that it FORCE CHARGE the CR2032 battery when in operation! Operation the device at 5v the 3v battery swollen up after a while and there is a high risk for explosion! But no matter what operation voltage a CR2032 battery shall NEVER be attempted charged! A solution is to remove the diode from the circuit or to cut the PCB trace between the diode and resistor 201 on the board. In this circuit a CR2032 battery will last forever anyway, so there is absolute no reason to try to recharge it!


Sun Aug 27, 2017 6:04 pm
Profile
Site Admin

Joined: Sun Aug 05, 2012 4:15 pm
Posts: 706
Post Re: High Accuracy DS3231 RTC & EEPROM (HCMODU0094)
Thanks for bringing this to our attention. I've had the modules temporally taken off sale whilst we check the stock. We'll put the back on sale as soon as we confirm the correct battery (LIR2032) has been fitted. To answer your questions:

Quote:
Does this come with a CR2032(non-rechargeable battery) or LIR2032(rechargeable battery)?


The module should be shipped with a rechargeable LIR2032.


Quote:
Is there a charging circuit built in?


Yes it has a basic charging circuit consisting of a 200R resistor and diode that will charge the battery at about 22mA (~0.5C) when powered via a 5V supply dropping to about 1mA (~0.2C) when fully charged .


Quote:
Should the charging circuit be disabled as described below?


If you are using it with a CR2032 then charging circuit should be disabled. This can be done by removing the diode or the 200 Ohm resistor. Both are located near the SCL pin.

_________________
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.


Tue Aug 29, 2017 9:16 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: Baidu [Spider] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD