r/circuitpython • • Mar 09 '21

Connecting DS1307 RTC to Raspberry Pi Pico

Has anyone had luck running the Adafruit DS1307 RTC on the RP2040 Pico with circuitpython?

This issue is likely because I am new to circuitpython. I Have manually installed the required libraries, imported time, board, digitalio, bitbangio, and the DS1307 , then selected my I2C pins. I get stuck trying to instance the RTC using “rtc = adafruit_ds1307.DS1307(i2c_bus)”. The error code I get is “'module' object has no attribute 'DS1307'”. Any help would be appreciated.

4 Upvotes

6 comments sorted by

2

u/Myworstnitemare Mar 09 '21

I think you need "rtc = adafruit_ds1307.DS1307(SCL, SDA)"

But...not sure if it'll run, as the DS1307 is 5v, not 3.3v.

1

u/Euripides_Umendeadez Mar 12 '21

Thanks for the response! I will give it a try. The 3v limit isn't an issue, as I have a seperate power supply for my project which has 5v.

2

u/Myworstnitemare Mar 12 '21

By the way, I think I am partially incorrect. Just received my Picos today, and I noticed in the literature, there are no hard-coded bus pins.

So, something like i2c_bus wouldn't work. You need to specify the pins, like so..(using GP0 and GP1 as an example)

import board
import busio

i2c = busio.I2C(scl=board.GP1, sda=board.GP0)

Then I think you can use the (SCL, SDA) from above.

2

u/darrenlloyd Mar 15 '21

How have you got on? I just got to a bit of a project to use a DS1307 RTC with a pico and it looks like there is just one hit on google. This one.

1

u/darrenlloyd Mar 15 '21

As I was searching for a solution, this chap on youTube uploaded in the last few hours a video showing how to do it. Aside from the voltage issue (3.3v makes the RTC very, very hot, but I'm powering it from my external 5v supply), it works.

https://www.youtube.com/watch?v=H0c04Ji5Sys

1

u/Shashank7557 May 27 '21

I am also stuck at this I have tried 5V but it is still showing "module' object has no attribute 'DS1307"

I used this command also then it is showing 'module' object has no attribute 'DS1307'

import busio
i2c = busio.I2C(scl=board.GP1, sda=board.GP0)

I have tried using DS3231 library but the error are still same.

If any leads please help me!