What is in this product?
The Switch Doc Labs DS3231 Real Time Clock Module contains two devices, both connected to a 3.3V or 5.0V I2C bus. It contains a Maxim DS3231 high accuracy temperature compensated Real Time Clock. According to tests done at SwitchDoc Labs (seen below), the DS3231 is the clear winner with a measured accuracy of less than 0.3PPM (Parts Per Million) or in other words, losing or gaining less than 0.026 seconds per day. The software supports both the DS3231 timekeeping functions and the internal temperature sensor of the DS3231.
Note the DS3231 board no longer includes an external EEPROM.
Downloads
The SwitchDoc Labs python based software for the Raspberry Pi product is located here.
The Arduino based software is located here.
Benchmark Results
SwitchDoc Labs DS3231/AT24C32 Module. SwitchDoc Labs has run months of performance and validation tests on this DS3231 Module and compared it to other Real Time Clocks. We selected the DS3231 because of it's superior accuracy. We are measuring the results in PPM (Parts Per Million). For example, losing 1 second per day is a drift of 11.5 PPM while 1 PPM is a drift of 0.0864 seconds per day. The PPM (Parts Per Million) measured error is shown on the graph below: [caption id="attachment_808" align="aligncenter" width="800"]
3.4 Million Second Test - PPM.The DS3231 is the clear winner. The jagged lines are on the graph because we are only able to detect integer second errors because all three real time clocks only show seconds. The Raspberry Pi has better resolution, but we round it off in order to do reasonable comparisons with the RTC data. Here is the summary data in table form: The table of results is below:
Device | Test Length (Seconds) | Measured PPM | Specification PPM |
DS1307 | 292,869 | 15 PPM | 23 PPM |
DS3231 | 3,432,851 | < 0.3 PPM | 2 PPM |
PCF8563 | 3,432,851 | 24 PPM | 29 PPM |
MCP79400 | 3,432,851 | 4 PPM | Not given directly |
Additional results for other Real Time Clocks are benchmarked here and in the definitive article in Raspberry Pi Geek Magazine Issue 7 and 8.
Raspberry Pi Verification
After you hook up your SwitchDoc Labs DS3231 Module to the Raspberry Pi (3.3V, GND, SCL, SDA), run the following command:
pi@MouseAir2 ~/RTCEval/SDL_DS3231 $ sudo i2cdetect -y 1
The results should be similar to this. 0x68 is the DS3231 and 0x56 is the AT24C32. Note that on some of the new revision boards the AT24C32 address is 0x57.
0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- 56 -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
After downloading the drivers from github, run this command:
pi@MouseAir2 ~/RTCEval/SDL_DS3231 $ sudo python testSDL_DS3231.py
pi@MouseAir2 ~/RTCEval/SDL_DS3231 $ sudo python test*.py
Test SDL_DS3231 Version 1.0 - SwitchDoc Labs Program Started at:2014-12-21 02:01:23 ----------------- Raspberry Pi= 2014-12-21 02:01:25 DS3231= 2014-12-21 02:01:25 DS3231 Temp= 21.75 Raspberry Pi= 2014-12-21 02:01:35 DS3231= 2014-12-21 02:01:35 DS3231 Temp= 21.75 Raspberry Pi= 2014-12-21 02:01:45 DS3231= 2014-12-21 02:01:45 DS3231 Temp= 21.75
Why use a Real Time Clock?
A realtime clock is necessary for any project requiring accurate time keeping especially when you don't always have an Internet connection. The Arduino only has a software based time clock for time keeping. If it powers off, it is gone. A Raspberry Pi being sent up in a balloon or a Pi working in the remote caribbean, like Project Curacao. The Raspberry Pi keeps pretty good time, but only if it is connected to the Internet. The Pi uses an Internet service called NTP to set the clock on power up if the Internet is available. It then calls the NTP servers (some are actually hosted by the National Institute of Standards and Technology (NIST) and linked to their atomic clocks). You aren't going to get atomic clock accuracy using NTP, but it is pretty good.