dr-mod/pico-solar-system

ds3231

condor13 opened this issue ยท 9 comments

I got it working a few months ago and all was good..i updated to the new release uf2. Updated the py scripts. Not able to get it working again. ds3231 inst defined. Using a Pico (no wifi) and a generical DS3231 board wired to i2c (pin 20 and 21).
Tried rshell on ubuntu and Thony on windows.
The REPL comands worked, no errors :)

Traceback (most recent call last):
File "main.py", line 218, in
File "main.py", line 90, in main
File "main.py", line 188, in set_time
"NameError: name 'ds3231' isn't defined"

Any ideas?
Thanks

i am having this same problem, i have tried a bunch of stuff and nothing worked. any ideas?

You can use a Pico W instead, as that avoids the need for an RTC

i am having this same problem, i have tried a bunch of stuff and nothing worked. any ideas?

Hi, could you confirm that the ds3231.py is present on you Pico?

You could check it via rshell:

rshell
ls /pyboard/

If it's there let's test it in the interactive mode through REPL:

rshell
repl

import ds3231
rtc = ds3231.ds3231()
rtc.read_time()

Got it working.
Wont boot to main.py after a few days but I think its a dead battery on my DS.
I changed:

def set_time():
try:
import wifi_config
set_time_ntp(wifi_config)
except ImportError:
ds3231
ds = ds3231.ds3231()
set_internal_time(ds.read_time())

to

def set_time():
import ds3231
ds = ds3231.ds3231()
set_internal_time(ds.read_time())

as i`m not using a PICO W.
Also @Hudson-com you can check with i2c scan to see if its connected :)

lol. k.

Added the missing import to the code, thanks @ExperiMentor

Thank you so much

when i try to run it with the new main.py code i am getting this error:

Traceback (most recent call last):
File "", line 218, in
File "", line 90, in main
File "", line 190, in set_time
File "", line 80, in set_internal_time
OverflowError: overflow converting long int to machine word

am i missing something or doing something wrong?