Python library for RTC DS3231

  • Hi all,

    I wrote a python library for the DS3231, it should work with th DS1307 too because the i2c address and the registrers are the same. Just follow the steps on the readme file to put it working.

  • @jorgegarciadev thank you for this! :) I am getting the following error and would appreciate it if you can assist...

    Test SDL_DS3231 Version 1.0 - SwitchDoc Labs

    Program Started at:2017-07-02 14:12:09

    Raspberry Pi= 2017-07-02 14:12:09
    Traceback (most recent call last):
    File "", line 37, in <module>
    print("DS3231=\t\t%s" % ds3231.read_datetime())
    File "/root/ds3231/", line 155, in read_datetime
    return datetime((century - 1) * 100 + self._read_year(),
    File "/root/ds3231/", line 132, in _read_year
    return _bcd_to_int(self._read(self._REG_YEAR))
    File "/root/ds3231/", line 97, in _read
    returndata = self._i2c.readBytes(self._addr, data, 1)
    IOError: I2C transaction failed.

  • Did this get fixed?

  • @austin-Sandford not entirely. I was able to get it to read and write to RTC but not the eeprom or get temperature. I changed line 25 from i2c-1

    ds3231 = SDL_DS3231.SDL_DS3231(1, 0x68)

    to i2c-0

    ds3231 = SDL_DS3231.SDL_DS3231(0, 0x68)

Log in to reply

Looks like your connection to Community was lost, please wait while we try to reconnect.