{"id":15023619,"url":"https://github.com/adafruit/adafruit_circuitpython_pcf8523","last_synced_at":"2025-04-10T02:28:34.219Z","repository":{"id":13238099,"uuid":"73966213","full_name":"adafruit/Adafruit_CircuitPython_PCF8523","owner":"adafruit","description":"Adafruit CircuitPython drivers for the PCF8523 realtime clock.","archived":false,"fork":false,"pushed_at":"2025-01-16T19:02:22.000Z","size":596,"stargazers_count":11,"open_issues_count":0,"forks_count":17,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-04-02T23:13:37.835Z","etag":null,"topics":["circuitpython","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adafruit.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-16T22:17:24.000Z","updated_at":"2025-03-24T15:58:49.000Z","dependencies_parsed_at":"2024-11-13T12:21:48.717Z","dependency_job_id":"1b2fde90-68c6-496c-a545-c76d051cf98e","html_url":"https://github.com/adafruit/Adafruit_CircuitPython_PCF8523","commit_stats":{"total_commits":127,"total_committers":21,"mean_commits":"6.0476190476190474","dds":0.8346456692913385,"last_synced_commit":"56effc694285edb452b5e19eaeb93caa9b557ee7"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_PCF8523","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_PCF8523/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_PCF8523/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_PCF8523/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adafruit","download_url":"https://codeload.github.com/adafruit/Adafruit_CircuitPython_PCF8523/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248143942,"owners_count":21054849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuitpython","hacktoberfest"],"created_at":"2024-09-24T19:59:15.164Z","updated_at":"2025-04-10T02:28:34.188Z","avatar_url":"https://github.com/adafruit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nIntroduction to Adafruit's PCF8523 Real Time Clock (RTC) Library\n================================================================\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-pcf8523/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/pcf8523/en/latest/\n    :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n    :target: https://adafru.it/discord\n    :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_PCF8523/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_PCF8523/actions/\n    :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n    :alt: Code Style: Black\n\nThis is a great battery-backed real time clock (RTC) that allows your\nmicrocontroller project to keep track of time even if it is reprogrammed,\nor if the power is lost. Perfect for datalogging, clock-building, time\nstamping, timers and alarms, etc. Equipped with PCF8523 RTC - it can\nrun from 3.3V or 5V power \u0026 logic!\n\nThe PCF8523 is simple and inexpensive but not a high precision device.\nIt may lose or gain up to two seconds a day. For a high-precision,\ntemperature compensated alternative, please check out the\n`DS3231 precision RTC. \u003chttps://www.adafruit.com/products/3013\u003e`_\nIf you need a DS1307 for compatibility reasons, check out our\n`DS1307 RTC breakout \u003chttps://www.adafruit.com/products/3296\u003e`_.\n\n.. image:: _static/3295-00.jpg\n    :alt: PCF8523 Breakout Board\n\nDependencies\n=============\n\nThis driver depends on the `Register \u003chttps://github.com/adafruit/Adafruit_CircuitPython_Register\u003e`_\nand `Bus Device \u003chttps://github.com/adafruit/Adafruit_CircuitPython_BusDevice\u003e`_\nlibraries. Please ensure they are also available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`a library and driver bundle \u003chttps://github.com/adafruit/Adafruit_CircuitPython_Bundle\u003e`_.\n\nInstalling from PyPI\n====================\nOn supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from\nPyPI \u003chttps://pypi.org/project/adafruit-circuitpython-pcf8523/\u003e`_. To install for current user:\n\n.. code-block:: shell\n\n    pip3 install adafruit-circuitpython-pcf8523\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n    sudo pip3 install adafruit-circuitpython-pcf8523\n\nTo install in a virtual environment in your current project:\n\n.. code-block:: shell\n\n    mkdir project-name \u0026\u0026 cd project-name\n    python3 -m venv .venv\n    source .venv/bin/activate\n    pip3 install adafruit-circuitpython-pcf8523\n\n\nUsage Notes\n===========\n\nBasics\n------\n\nOf course, you must import the library to use it:\n\n.. code:: python3\n\n    import time\n    from adafruit_pcf8523.pcf8523 import PCF8523\n\nAll the Adafruit RTC libraries take an instantiated and active I2C object\n(from the `board` library) as an argument to their constructor. The way to\ncreate an I2C object depends on the board you are using. For boards with labeled\nSCL and SDA pins, you can:\n\n.. code:: python3\n\n    import board\n\nNow, to initialize the I2C bus:\n\n.. code:: python3\n\n    i2c = board.I2C()\n\nOnce you have created the I2C interface object, you can use it to instantiate\nthe RTC object:\n\n.. code:: python3\n\n    rtc = PCF8523(i2c)\n\nDate and time\n-------------\n\nTo set the time, you need to set datetime` to a `time.struct_time` object:\n\n.. code:: python3\n\n    rtc.datetime = time.struct_time((2017,1,9,15,6,0,0,9,-1))\n\nAfter the RTC is set, you retrieve the time by reading the `datetime`\nattribute and access the standard attributes of a struct_time such as ``tm_year``,\n``tm_hour`` and ``tm_min``.\n\n.. code:: python3\n\n    t = rtc.datetime\n    print(t)\n    print(t.tm_hour, t.tm_min)\n\nAlarm\n-----\n\nTo set the time, you need to set `alarm` to a tuple with a `time.struct_time`\nobject and string representing the frequency such as \"hourly\":\n\n.. code:: python3\n\n    rtc.alarm = (time.struct_time((2017,1,9,15,6,0,0,9,-1)), \"daily\")\n\nAfter the RTC is set, you retrieve the alarm status by reading the\n`alarm_status` attribute. Once True, set it back to False to reset.\n\n.. code:: python3\n\n    if rtc.alarm_status:\n        print(\"wake up!\")\n        rtc.alarm_status = False\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs \u003chttps://docs.circuitpython.org/projects/pcf8523/en/latest/\u003e`_.\n\nFor information on building library documentation, please check out `this guide \u003chttps://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1\u003e`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n\u003chttps://github.com/adafruit/Adafruit_CircuitPython_PCF8523/blob/main/CODE_OF_CONDUCT.md\u003e`_\nbefore contributing to help this project stay welcoming.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_pcf8523","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_pcf8523","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_pcf8523/lists"}