{"id":20586701,"url":"https://github.com/sparkfun/qwiic_i2c_py","last_synced_at":"2025-10-09T00:42:37.796Z","repository":{"id":54686550,"uuid":"193163346","full_name":"sparkfun/Qwiic_I2C_Py","owner":"sparkfun","description":"Python package to support multi platform I2C bus integrations","archived":false,"fork":false,"pushed_at":"2025-04-08T16:21:07.000Z","size":677,"stargazers_count":22,"open_issues_count":5,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T17:29:06.957Z","etag":null,"topics":["python","python3","qwiic","sparkfun","sparkfun-python"],"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/sparkfun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2019-06-21T21:43:23.000Z","updated_at":"2025-03-21T10:58:55.000Z","dependencies_parsed_at":"2023-01-20T07:03:16.754Z","dependency_job_id":"d5cf7761-aae3-4fe3-a958-24f7df876301","html_url":"https://github.com/sparkfun/Qwiic_I2C_Py","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2FQwiic_I2C_Py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2FQwiic_I2C_Py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2FQwiic_I2C_Py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2FQwiic_I2C_Py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sparkfun","download_url":"https://codeload.github.com/sparkfun/Qwiic_I2C_Py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961916,"owners_count":21190105,"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":["python","python3","qwiic","sparkfun","sparkfun-python"],"created_at":"2024-11-16T07:12:38.020Z","updated_at":"2025-10-09T00:42:32.767Z","avatar_url":"https://github.com/sparkfun.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Qwiic I2C Python Package](docs/images/i2c-gh-banner-py.png \"qwiic IC Python Package\" )\n\nSparkfun Qwiic I2C - Python Package\n==============\n\n![PyPi Version](https://img.shields.io/pypi/v/sparkfun_qwiic_i2c)\n![GitHub issues](https://img.shields.io/github/issues/sparkfun/qwiic_i2c_py)\n![License](https://img.shields.io/github/license/sparkfun/qwiic_i2c_py)\n![X](https://img.shields.io/twitter/follow/sparkfun)\n\nPython package to support multi platform I2C bus integrations for the SparkFun [qwiic ecosystem](https://www.sparkfun.com/qwiic)\n\nThis package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)\n\nNew to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).\n\n## Contents\n\n* [Supported Platforms](#supported-platforms)\n* [Dependencies](#dependencies)\n* [Documentation](#documentation)\n* [Installation](#installation)\n\n### Supported Platforms\nSee the [MicroPython Downloads Page](https://micropython.org/download/?vendor=Sparkfun) for more boards compatible with MicroPython.\n| Python | Platform | Boards |\n|--|--|--|\n| Python | Linux | [Raspberry Pi](https://www.sparkfun.com/raspberry-pi-5-8gb.html) , [NVIDIA Jetson Orin Nano](https://www.sparkfun.com/nvidia-jetson-orin-nano-developer-kit.html) via the [SparkFun Qwiic SHIM](https://www.sparkfun.com/sparkfun-qwiic-shim-for-raspberry-pi.html) |\n| MicroPython | Raspberry Pi - RP2, ESP32 | [SparkFun RP2040 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2040.html), [SparkFun RP2350 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2350.html), [SparkFun ESP32 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-esp32-wroom-usb-c.html)\n|CircuitPython | Raspberry Pi - RP2, ESP32 | [SparkFun RP2040 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2040.html), [SparkFun RP2350 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-rp2350.html), [SparkFun ESP32 Thing+](https://www.sparkfun.com/sparkfun-thing-plus-esp32-wroom-usb-c.html)\n\n\u003e [!NOTE]\n\u003e The listed supported platforms and boards are the primary platform targets tested. It is fully expected that this package will work across a wide variety of Python enabled systems. \n\nDependencies \n---------------\nThe Raspberry Pi/Single Board Computer Linux driver of this package is dependent on \n[smbus](https://pypi.org/project/smbus/)\n\nDocumentation\n-------------\nThe SparkFun qwiic I2C module documentation is hosted at [ReadTheDocs](https://qwiic-i2c-py.readthedocs.io/en/latest/index.html)\n\n# Installation \n\nThe first step to using this package is installing it on your system. The install method depends on the python platform. The following sections outline installation on Python, MicroPython and CircuitPython.\n\n### Python \n\n#### PyPi Installation\n\nThe package is primarily installed using the `pip3` command, downloading the package from the Python Index - \"PyPi\". \n\nNote - the below instructions outline installation on a Linux-based (Raspberry Pi) system.\n\nFirst, setup a virtual environment from a specific directory using venv:\n```sh\npython3 -m venv ~/sparkfun_venv\n```\nYou can pass any path instead of ~/sparkfun_venv, just make sure you use the same one for all future steps. For more information on venv [click here](https://docs.python.org/3/library/venv.html).\n\nNext, install the qwiic package with:\n```sh\n~/sparkfun_venv/bin/pip3 install sparkfun-qwiic-i2c\n```\nNow you should be able to run any example or custom python scripts that have `import qwiic_i2c` by running e.g.:\n```sh\n~/sparkfun_venv/bin/python3 example_script.py\n```\n\n### MicroPython Installation\nIf not already installed, follow the [instructions here](https://docs.micropython.org/en/latest/reference/mpremote.html) to install mpremote on your computer.\n\nConnect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.\n```sh\nmpremote mip install github:sparkfun/qwiic_i2c_py\n```\n\n### CircuitPython Installation\nIf not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.\n\nEnsure that you have the latest version of the SparkFun Qwiic CircuitPython bundle. \n```sh\ncircup bundle-add sparkfun/qwiic_py\n```\n\nFinally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.\n```sh\ncircup install --py qwiic_i2c\n```\n\nExamples\n---------------\nThis package is used extensively by the python modules for the SparkFun qwiic ecosystem. References to the modules can be found in the [sparkfun-python github topic](https://github.com/topics/sparkfun-python) or in the [drivers directories of Qwiic Py](https://github.com/sparkfun/Qwiic_Py/tree/main/qwiic/drivers).\n\nGeneral package use examples:\n\n```python\n# Import the package\nimport qwiic_i2c\n\n# Get the default I2C bus\nmy_bus = qwiic_i2c.get_i2c_driver()\n\n# Linux (Raspberry Pi) - Specify I2C bus index\nmy_bus = qwiic_i2c.get_i2c_driver(iBus = 1)\n\n# MicroPython and CircuitPython - Specify SDA and SCL pins, and frequency\nmy_bus = qwiic_i2c.get_i2c_driver(sda=0, scl=1, freq=100000)\n\n# Perform scan of I2C bus\nscan_list = my_bus.scan()\nprint(\"Bus scan:\", scan_list)\n\n# Check if a device with the specified address is connected\nping_result = my_bus.ping(device_address)\nprint(\"Device is connected:\", ping_result)\n\n# Read one byte from the specified address\nread_data = my_bus.read_byte(device_address, register_address)\nprint(\"Read byte:\", read_data)\n\n# Read one word (2 bytes) from the specified address\nread_data = my_bus.read_word(device_address, register_address)\nprint(\"Read word:\", read_data)\n\n# Read several bytes from the specified address\nread_data = my_bus.read_block(device_address, register_address, num_bytes_to_read)\nprint(\"Read block:\", read_data)\n\n# Write one byte to the specified address\nmy_bus.write_byte(device_address, register_address, write_data)\n\n# Write one word (2 bytes) to the specified address\nmy_bus.write_word(device_address, register_address, write_data)\n\n# Write several bytes to the specified address\nmy_bus.write_block(device_address, register_address, write_data)\n```\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cdn.sparkfun.com/assets/custom_pages/3/3/4/dark-logo-red-flame.png\" alt=\"SparkFun - Start Something\"\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkfun%2Fqwiic_i2c_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparkfun%2Fqwiic_i2c_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkfun%2Fqwiic_i2c_py/lists"}