They are also known as A5 (SCL) and A4 (SDA). On the Arduino boards with the R3 layout, the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. Note that each Arduino Board has different I2C pins which should be connected accordingly. Now we are remaining with the pins that are used for I2C communication. Start by connecting VCC pin to the 5V output on the Arduino and connect GND to ground. Wiring DS3231 RTC module to Arduino UNOĬonnections are fairly simple.
SDA is a serial data pin for I2C interface. SCL is a serial clock pin for I2C interface. This can further be used as an interrupt due to alarm condition in many time-based applications. SQW pin outputs a nice square wave at either 1Hz, 4kHz, 8kHz or 32kHz and can be handled programmatically. So, you need not worry about power outages, your MCU can still keep track of time.ģ2K pin outputs the stable(temperature compensated) and accurate reference clock. The built-in power-sense circuit continuously monitors the status of VCC to detect power failures and automatically switches to the backup supply. The DS3231 incorporates a battery input, and maintains accurate timekeeping when main power to the device is interrupted. However, the DS3231 is much more accurate, as it comes with an internal Temperature Compensated Crystal Oscillator(TCXO) which isn’t affected by temperature, making it accurate down to a few minutes per year at the most.ĭS1307 is still a great value RTC and serves you well, but for projects that require more accurate time-keeping, DS3231 is recommended. This usually results with the clock being off by around five or so minutes per month. The main difference between the DS3231 and DS1370 is the accuracy of time-keeping.ĭS1307 comes with an external 32kHz crystal for time-keeping whose oscillation frequency is easily affected by external temperature. It’s highly immune to the external temperature changes. To avoid such slight drifts in crystal, DS3231 is driven by a 32kHz temperature compensated crystal oscillator (TCXO). This change in frequency can be negligible but it surely adds up. But the problem with these crystals is that external temperature can affect their oscillation frequency.
Most RTC modules come with an external 32kHz crystal for time-keeping. Temperature Compensated Crystal Oscillator(TCXO) The other cool feature of this board comes with SQW pin, which outputs a nice square wave at either 1Hz, 4kHz, 8kHz or 32kHz and can be handled programmatically. It also provides two programmable time-of-day alarms. The clock operates in either the 24-hour or 12-hour format with an AM/PM indicator. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year (valid up to 2100). The chip maintains seconds, minutes, hours, day, date, month, and year information.