Precision Real Time Clock Module RTC DS3231 I2C w/ AT24C32

  • Was  RM28.00 
  • RM14.00

  • Product Code: DS3231
  • Availability: In Stock

RTC DS3231 is a low-cost, extremely accurate I²C real-time clock (RTC), with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The device incorporates a battery input, disconnect the main power supply and maintains accurate timekeeping. Integrated oscillator improved long-term accuracy of the device and reduces the number of components of the production line. The DS3231 is available in commercial and industrial temperature ranges, using a 16-pin 300mil SO package.

RTC maintains seconds, minutes, hours, day, date, month, and year information. Less than 31 days of the month, the end date will be automatically adjusted, including corrections for leap year. The clock operates in either the 24 hours or band / AM / PM indication of the 12-hour format. Provides two configurable alarm clock and a calendar can be set to a square wave output. Address and data are transferred serially through an I²C bidirectional bus.

A precision temperature-compensated voltage reference and comparator circuit monitors the status of VCC to detect power failures, provide a reset output, and if necessary, automatically switch to the backup power supply. In addition, / RST pin is monitored as generating μP reset manually.

Save time and high precision addition, DS3231 also has some other features that extend the system host of additional features and a range of options. The device integrates a very precise digital temperature sensor, through the I²C * interface to access it (as the same time). This temperature sensor accuracy is ± 3 ° C. On-chip power supply control circuit can automatically detect and manage the main and standby power (i.e., low-voltage battery) to switch between the power supply. If the main power failure, the device can continue to provide accurate timing and temperature, performance is not affected. When the main power re-power or voltage value returns to within the allowable range, the on-chip reset function can be used to restart the system microprocessor.

Features:

  • 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
    • Accuracy ±3.5ppm from -40°C to +85°C
    • Digital Temp Sensor Output: ±3°C Accuracy
    • Register for Aging Trim
    • Active-Low RST Output/Pushbutton Reset Debounce Input
    • Two Time-of-Day Alarms
    • Programmable Square-Wave Output Signal
  • With output TTL level signal indication
  • Can be connected directly to the microcontroller output IO port
  • Anti-interference ability
  • Connect the microcontroller to achieve the touch switch function
  • Standard 2.54mm pin to do input and output connections
  • Surrounded by four fixed mounting holes

Specification:

  • Clock chip: High-precision clock chip DS3231
  • Memory chips: AT24C32 (storage capacity 32K)
  • Operating voltage: 3.3 - 5.5V DC
  • Clock Accuracy: 0~40 range, the accuracy 2ppm, the error is about 1 minute; With two calendar alarm clock; Programmable square-wave output
  • Real time clock generator seconds, minutes, hours, day, date, month and year timing and provides valid until 2100 with Leap Year Compensation
  • Chip temperature sensor accuracy: +/- 3ºC
  • IIC bus interface, the maximum transmission speed of 400KHz (working voltage of 5V)
  • Can be cascaded with other IIC device, 24C32 addresses can be shorted A0/A1/A2 modify default address is 0x57
  • Suggest to add a rechargeable battery CR2032 to ensure the clock move normal as system power failure
  • Size: 38mm (length) x 22mm (W) x 14mm (height)
  • Weight: 8g

 

Pin-out:

SCL - I2C clock pin, connect to your microcontrollers I2C clock line. This pin has a 10K pullup resistor to Vin

SDA - I2C data pin, connect to your microcontrollers I2C data line. This pin has a 10K pullup resistor to Vin

BAT - this is the same connection as the positive pad of the battery. You can use this if you want to power something else from the coin cell, or provide battery backup from a different seperate batery. VBat can be between 2.3V and 5.5V and the DS3231 will switch over when main Vin power is lost

32K - 32KHz oscillator output. Open drain, you need to attach a pullup to read this signal from a microcontroller pin

SQW - optional square wave or interrupt output. Open drain, you need to attach a pullup to read this signal from a microcontroller pin

RST - This one is a little different than most RST pins, rather than being just an input, it is designed to be used to reset an external device or indicate when main power is lost. Open drain, but has an internal 50K pullup. The pullup keeps this pin voltage high as long as Vin is present. When Vin drops and the chip switches to battery backup, the pin goes low

Connect DS3231 to an Arduino  (fritzing)

The sketch for this tutorial shows how to request time from the ChronoDot and display it over Serial.

RTClib.h
The libraries are needed for the ChronoDot:  RTClib.h and Wire (Wire comes with the IDE).

Download the RTClib zip file, extract and if necessary rename to "RTClib" before moving a copy into /arduino-1.0.3/libraries/.  Having the correct name is important.

Arduino Sketch
You can find an explanation for each part in the comments.

// Date and time functions using a DS3231 RTC connected via I2C and Wire Lib

#include <Wire.h>
#include "RTClib.h"  // Credit: Adafruit

RTC_DS1307 RTC;

void setup() {
  // Begin the Serial connection 
  Serial.begin(9600);
 
  // Instantiate the RTC
  Wire.begin();
  RTC.begin();
 
  // Check if the RTC is running.
  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running");
  }

  // This section grabs the current datetime and compares it to
  // the compilation time.  If necessary, the RTC is updated.
  DateTime now = RTC.now();
  DateTime compiled = DateTime(__DATE__, __TIME__);
  if (now.unixtime() < compiled.unixtime()) {
    Serial.println("RTC is older than compile time! Updating");
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
 
  Serial.println("Setup complete.");
}

void loop() {
  // Get the current time
  DateTime now = RTC.now();   
 
  // Display the current time
  Serial.print("Current time: ");
  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(' ');
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();
 
  delay(10000);
}

 

Write a review

Note: HTML is not translated!
    Bad           Good

 

Related Products

Tags: RTC