Setting time of DS3231 connected to a CLUE (CircuitPython)

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
marconfr
 
Posts: 2
Joined: Sat Jan 28, 2023 9:50 am

Setting time of DS3231 connected to a CLUE (CircuitPython)

Post by marconfr »

I've got the DS3231 connected to a clue (with stemma QT)

I was wondering if there is a simple way to synchronise the clock of the DS3231 module with that of a computer (serial ?) or a phone (bluetooth ?) rather than entering it by hand? I've searched the net but haven't found anything yet

Thanks for your help

Code: Select all

import adafruit_ds3231
from adafruit_clue import clue

i2c = board.I2C()
ds3231 = adafruit_ds3231.DS3231(i2c)
ds3231.datetime = time.struct_time((2023, 1, 28, 14, 20, 00, 6, -1, -1))

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Setting time of DS3231 connected to a CLUE (CircuitPython)

Post by mikeysklar »

John Park has an overview for using NTP on networked CircuitPython devices to set the DS3231 clock.

https://blog.adafruit.com/2022/05/27/jo ... uitpython/

You could use your own python script to set it over serial UART with some listening code on the CLUE and a python script on the host computer.

You can start with the UART demo code to get your CLUE talking to the computer.

https://learn.adafruit.com/circuitpytho ... art-serial

User avatar
marconfr
 
Posts: 2
Joined: Sat Jan 28, 2023 9:50 am

Re: Setting time of DS3231 connected to a CLUE (CircuitPython)

Post by marconfr »

Thanks for your answer.
I'll we have a look on UART

Locked
Please be positive and constructive with your questions and comments.

Return to “CLUE Board”