Python DS1307 library for Raspberry Pi

jBli3I just spotted an article over on SwitchDoc Labs blog for accessing the HotPi RTC using python which is pretty cool. Please note that the DS1307 on the HotPi is wired directly into the i2c port and is powered with 3.3V so the application notes regarding the pull up resistors do not apply, you should be able to just use the software immediately with your HotPi.

Here’s the example code they have on their website.

import time
import datetime
import SDL_DS1307

ds1307 = SDL_DS1307.SDL_DS1307(1, 0x68)
ds1307.write_now()

# Main Loop - sleeps 10 seconds, then reads and prints values of all clocks

while True:

print ""
print "Raspberry Pi=\t" + time.strftime("%Y-%m-%d %H:%M:%S")

print "DS1307=\t\t%s" % ds1307.read_datetime()

time.sleep(10.0)

It makes me consider importing this into the HotPi-daemon in some way 🙂

Their github page is here https://github.com/switchdoclabs/RTC_SDL_DS1307

Grab the code and see what you can do!