Introduction
DS3231 is a low-cost, extremely accurate I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The device incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted. The DS3231 highly accurate Real Time Clock which can maintain hours, minutes and seconds, as well as, day, month and year information. Also, it has automatic compensation for leap-years and for months with fewer than 31 days. The module can work on either 3.3 or 5 V which makes it suitable for many development platforms or microcontrollers. The battery input is 3V and a typical CR2032 3V battery can power the module and maintain the information for more than a year. The DS3231 real time clock module keeps track of the time even when the module is not powered. It has a built-in 3V battery which keeps updating the time. We will get the time and date from the RTC module using the library functions and then we will compare this time with the alarm time that we have set in the code.
Specification
- 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 - 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 - Low Power Operation Extends Battery-Backup Run Time - 3.3V Operation
Pin Datasheet
*Power Pins: - VCC – this is the power pin. Since the RTC can be powered from 2.3V to 5.5V power, you do not need a regulator or level shifter for 3.3V or 5V logic/power. To power the board, give it the same power as the logic level of your microcontroller – e.g. for a 5V micro like Arduino, use 5V - GND – common ground for power and logic *I2C Logic pins: - 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 *Other Pins: - 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