https://github.com/octaprog7/librtc
A library for MicroPython that allows you to control a real-time clock (RTC). DS3231, PCF8563.
https://github.com/octaprog7/librtc
i2c micropython rtc time
Last synced: about 2 months ago
JSON representation
A library for MicroPython that allows you to control a real-time clock (RTC). DS3231, PCF8563.
- Host: GitHub
- URL: https://github.com/octaprog7/librtc
- Owner: octaprog7
- License: mit
- Created: 2024-12-01T10:22:01.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-15T13:02:54.000Z (over 1 year ago)
- Last Synced: 2025-02-15T13:35:24.595Z (over 1 year ago)
- Topics: i2c, micropython, rtc, time
- Language: Python
- Homepage:
- Size: 3.75 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libRTC
A library for MicroPython that allows you to control a real-time clock (RTC).
Currently contains ds3231mod, PCF8563mod modules for controlling the DS3231 and PCF8563 RTCs respectively.
## Preparation
Simply connect the board with the RTC to an Arduino, ESP or any other board with MicroPython firmware.
Connection pins:
1. VCC
2. GND
3. SDA
4. SCL
Attention! The DS3231 supply voltage is 3.3V or 5V! If you are using a CR2032 Li-Ion backup battery,
power the DS3231 board only from 3.3V! If the supply voltage is greater than 3.3 V,
the CR2032 Li-Ion battery will eventually become unusable due to the charging circuit located on the board.
Load the MicroPython firmware into the NANO board (ESP, etc.), and then the files: main.py, ds3231mod.py, PCF8563mod.py and
the entire sensor_pack_2 folder. Then open main.py in your IDE and run it.
## Selecting RTC in the program code
Set clock_ds3231 to 0 if you have a board with DS3231.
Set clock_ds3231 to 1 if you have a board with PCF8563.
# Control interface
Described by methods of the IRTC, IRTCwAlarms classes. Naturally, there are also unique methods.
# Accuracy of the clock 'running'
Depends on:
* the quality of the quartz resonator.
* fluctuations in ambient temperature.
* the age of the quartz crystal - over time, the resonant frequency decreases slightly.
P.S. Don't forget about the 'quality' of the voltage supplying the RTC!
## For soldering enthusiasts
* in the folder hardware/rtc_bq32000, there is a project of the RTC board based on BQ32000, created in KiCad 8.0.8.
* in the folder hardware/rtc_mcp7940, there is a project of the RTC board based on MCP7940, created in KiCad 8.0.8.
# Photos
## Breadboard

## RTC interrupt handled

# Tests: Real Time Clock – DS3231 / PCF8563 / MCP79400 / DS1307
https://www.switchdoc.com/2014/12/benchmarks-realtime-clocks-ds3231-pcf8563-mcp79400-ds1307/