{"id":15023429,"url":"https://github.com/adafruit/adafruit_circuitpython_ds1307","last_synced_at":"2025-08-10T22:05:05.575Z","repository":{"id":13237970,"uuid":"73965885","full_name":"adafruit/Adafruit_CircuitPython_DS1307","owner":"adafruit","description":"CircuitPython drivers for the DS1307 realtime clock.","archived":false,"fork":false,"pushed_at":"2025-06-17T16:12:04.000Z","size":582,"stargazers_count":7,"open_issues_count":0,"forks_count":9,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-07-29T01:58:00.743Z","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:12:39.000Z","updated_at":"2025-06-17T15:26:10.000Z","dependencies_parsed_at":"2023-02-11T23:45:18.594Z","dependency_job_id":"d34c0d99-c43f-4e48-9cb8-b9bd741f415a","html_url":"https://github.com/adafruit/Adafruit_CircuitPython_DS1307","commit_stats":{"total_commits":100,"total_committers":19,"mean_commits":"5.2631578947368425","dds":0.8,"last_synced_commit":"1a048bc711163e3f9cfe6f13488a45153497c5f8"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/adafruit/Adafruit_CircuitPython_DS1307","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_DS1307","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_DS1307/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_DS1307/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_DS1307/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adafruit","download_url":"https://codeload.github.com/adafruit/Adafruit_CircuitPython_DS1307/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit_CircuitPython_DS1307/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269794095,"owners_count":24476740,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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:03.465Z","updated_at":"2025-08-10T22:05:05.566Z","avatar_url":"https://github.com/adafruit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nIntroduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-ds1307/badge/?version=latest\n    :target: https://docs.circuitpython.org/projects/ds1307/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_DS1307/workflows/Build%20CI/badge.svg\n    :target: https://github.com/adafruit/Adafruit_CircuitPython_DS1307/actions/\n    :alt: Build Status\n\n.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\n    :target: https://github.com/astral-sh/ruff\n    :alt: Code Style: Ruff\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,\ntime stamping, timers and alarms, etc. The DS1307 is the most popular\nRTC - but it requires 5V power to work.\n\nThe DS1307 is simple and inexpensive but not a high precision device. It may\nlose or gain up to two seconds a day. For a high-precision, temperature\ncompensated alternative, please check out the\n`DS3231 precision RTC \u003chttps://www.adafruit.com/products/3013/\u003e`_.\nIf you do not need a DS1307, or you need a 3.3V-power/logic capable RTC\nplease check out our affordable\n`PCF8523 RTC breakout \u003chttps://www.adafruit.com/products/3295\u003e`_.\n\n.. image:: ../docs/_static/3296-00.jpg\n    :alt: DS1307\n\nDependencies\n=============\nThis driver depends on:\n\n* `Adafruit CircuitPython \u003chttps://github.com/adafruit/circuitpython\u003e`_\n* `Bus Device \u003chttps://github.com/adafruit/Adafruit_CircuitPython_BusDevice\u003e`_\n* `Register \u003chttps://github.com/adafruit/Adafruit_CircuitPython_Register\u003e`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit 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-ds1307/\u003e`_. To install for current user:\n\n.. code-block:: shell\n\n    pip3 install adafruit-circuitpython-ds1307\n\nTo install system-wide (this may be required in some cases):\n\n.. code-block:: shell\n\n    sudo pip3 install adafruit-circuitpython-ds1307\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-ds1307\n\nUsage Notes\n===========\n\nOf course, you must import the library to use it:\n\n.. code:: python3\n\n    import board\n    import adafruit_ds1307\n    import time\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:: python\n\n    import board\n\nNow, to initialize the I2C bus:\n\n.. code:: python\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:: python\n\n    rtc = adafruit_ds1307.DS1307(i2c)\n\nTo set the time, you need to set ``datetime`` to a `time.struct_time` object:\n\n.. code:: python\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:: python\n\n    t = rtc.datetime\n    print(t)\n    print(t.tm_hour, t.tm_min)\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs \u003chttps://docs.circuitpython.org/projects/ds1307/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_DS1307/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_ds1307","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_ds1307","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2Fadafruit_circuitpython_ds1307/lists"}