Another alternative is the Maxim DS3231 (or its SPI relative, the DS3234). I love this chip, it is so cool. The integrated, temperature-compensated crystal makes it very accurate (±2ppm from 0°C to +40°C), and it will operate on 3.3V. This addresses all of my gripes with the DS1307. But it is more expensive, nearly $9 from Mouser in single quantities as I write this, where the DS1307 is about half that. (Yes, I know DS1307s can be had for significantly less from other sources.) But the DS3231 is harder to find at discount prices, and is only available in a surface-mount package if that makes a difference to you.
Enter the Microchip MCP79412. It operates off a crystal similar to that used by the DS1307, so the basic accuracy is about the same. But, it can be calibrated by setting an internal register. It will operate down to 1.8V. And while it does require a few more external passive components than the DS1307, it costs only $1.23 in single quantities. I popped for ten and paid $0.98 per copy. Again, it is only available as a surface-mount component.
The MCP79412 has some other cool tricks up its sleeve as well, including alarms, tracking power outages, and EEPROM in addition to SRAM. I've detailed these in the table below.
To summarize, I've been tinkering with the MCP79412 on and off for the last couple months and have come to like it quite well. I designed a breakout board for it (pictures below) and wrote an Arduino library to support it. I've only used three of the ten chips so far, but they have all operated well within the ±20ppm spec of the crystal I chose. One unit seems to be within 2ppm, and so hardly needs trimming.
If you are also using this chip, or would be interested in it, I'd love to hear from you!
PS: For a comprehensive example using the MCP79412, see my Power Outage Logger project.
|Real-Time Clock Comparison|
|On-Chip Calibration||±127 ppm||N/A|
|Alarms||Dual alarms (single output)||N/A|
|Power Fail/Restore Timestamps||Yes||N/A|
|Unique ID||64-bit ID||N/A|
|Battery-Backed SRAM||64 bytes||56 bytes|
|Vcc||1.8 - 5.5V||4.5 - 5.5V|
|I2C Interface Clock Frequency||400 kHz (Vcc ≥ 2.5V)||100 kHz|
|Square-Wave Output||1, 4096, 8192 or 32,768 Hz||1, 4096, 8192 or 32,768 Hz|
|MCP79412 RTC Breakout Board, Top|
|MCP79412 RTC Breakout Board, Bottom|