Is there a package or library for controlling the DS3231 on the Raspberry Pi
Ask QuestionAsked todayActive todayViewed 7 times1
I’ve just obtained a DS3231 real time clock (RTC), and added it to my RPi 3b. It seems to work as far as keeping time, but I wanted more.
I’d like to be able to set alarms to trigger the INT/SQW pin on the chip, but I’ve been unable to find any way to do that with the toolset in RPi. I’ve probably overlooked something – how should I go about this?packagesrtctimekeepingshared-librariesds3231ShareEditFollowCloseFlagasked 4 hours agoSeamus12k22 gold badges1515 silver badges3535 bronze badges
- I played with DS3231 some three years ago. I found the drivers around then had too limited, (and only minimal functions like many other drivers). So I DIYed my own python library. Fast forward 3 years, now I am playing with Pico and plan to port my old package such as MCP23017, ADS1115 etc to Pico. In case you and other newbie readers are interested to know me the hobbyist developer learned how to do the job, I am writing an answer below. Comments and counter suggestions welcome. Cheers. – tlfong01 32 mins ago
- I remember 3 years ago the DT3231 libraries then were written in C/C++, me python guy found it hard to append more functions. But if you can now find any python package and wish to add more functions, my little DIY functions and design notes might help you modify any existing python or C/C++ packages. – tlfong01 17 mins ago Edit
1 Answer
Question
How to write a Rpi4B/Pico Thonny Python program to talk to the DS3231 RTC (Real Time Clock) to do things such as the following:
- Detect interrupts,
- Trigger on chip square wave signals.
Answer
- I have searched my 3 year old posts (over 50) in rpi.org.forum to refresh my memory on how I messed around with DS3231, listening to its interrupts, and program/trigger the on chip 32kHz square signals etc.
- My old posts are messily scattered in a couple of forums and intermingled with other I2C devices such as MCP23017 IOX and ADS1115 ADC. Porting to Pico is a good opportunity for me to tidy them up.
/ to continue, …
References
(1) Search query: DS3231 tlfong01 Record – found 54 matches
(2) Python Program to Ping DS3231 and MCP23017
(3) DS3231 Python Programming Code
(4) DS3231 python Write Register Example
(5) DS3231 Old Posts Reference Links
(7) DS3231 driver vs dit programming
(8) DS3231 read register functions
(10) DS3231 python programming design notes
(11) DS3231 python programming design notes
(12) DS3231 python programming design notes
/ to continue, …
Appendices
/ to continue, …
ShareEditDeleteFlagedited 8 secs agoanswered 22 mins agotlfong013,62133 gold badges77 silver badges2222 bronze badgesAdd a comment
Categories: Uncategorized