SwitchDoc Labs DS3231 Real Time Clock Module / EEPROM for Arduino and Raspberry Pi

Содержание

DS3231 Raspberry Pi DS3231 Module Test Jig

connected to a 3.3V or 5.0V I2C bus. It contains a Maxim DS3231 high accuracy temperature compensated Real Time Clock and an AT24C32 32Kbit EEPROM organized as 4096 8 bit words of non-volatile storage. 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, the internal temperature sensor of the DS3231 and the AT24C32 EEPROM device.

I2C address 0x68 is the DS3231 and 0x56 is the AT24C32. Note that on some of the new revision boards the AT24C32 address is 0x57.

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 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:

Real Time Clocks

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:

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.

After downloading the drivers from github, run this command:

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.

3 Comments

It dosen’t work under python3.
Here is an error:
Test SDL_DS3231 Version 1.0 SwitchDoc Labs

Program Started at:2015-07-15 08:44:07

—————
—————
Test the AT24C32 EEPROM
—————
writing first 10 addresses with random data
address = 0 writing value=61
Traceback (most recent call last):
File “testSDL_DS3231.py”, line 46, in
ds3231.write_AT24C32_byte(x, value)
File “/home/pi/ds3231/ds3231/SDL_DS3231.py”, line 211, in write_AT24C32_byte
self._bus.write_i2c_block_data(self._at24c32_addr,a1,[a0, value])
TypeError: integer argument expected, got float

The software is not Python 3 compliant. If you do a port to Python 3, please let us know and we will post it!

I took a look at the problem on your page. What version of the Arduino IDE are you using? Is this a problem with the 1.6 version? I’ve seen other issues. We are still using 1.5.

The error looks like a compiler problem and not a board or device problem.

Note that the device should still work with VDD at 3.3V. What are your pull-ups connected to on the I2C bus?


Источник: www.switchdoc.com