{"id":20587613,"url":"https://github.com/sparkfun/qwiic_sgp40_py","last_synced_at":"2026-04-21T05:34:21.118Z","repository":{"id":137300855,"uuid":"376053008","full_name":"sparkfun/qwiic_sgp40_py","owner":"sparkfun","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-19T17:35:22.000Z","size":6413,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-19T18:35:16.772Z","etag":null,"topics":["circuitpython","micropython","python","sparkfun","sparkfun-python"],"latest_commit_sha":null,"homepage":"http://docs.sparkfun.com/qwiic_sgp40_py/","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":"2021-06-11T14:35:39.000Z","updated_at":"2025-03-19T17:35:26.000Z","dependencies_parsed_at":"2023-11-17T21:28:51.844Z","dependency_job_id":"905ab7b1-97b1-412a-87e5-66f2f093115d","html_url":"https://github.com/sparkfun/qwiic_sgp40_py","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/sparkfun/qwiic_sgp40_py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_sgp40_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_sgp40_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_sgp40_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_sgp40_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sparkfun","download_url":"https://codeload.github.com/sparkfun/qwiic_sgp40_py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_sgp40_py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32079059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","micropython","python","sparkfun","sparkfun-python"],"created_at":"2024-11-16T07:18:11.281Z","updated_at":"2026-04-21T05:34:21.113Z","avatar_url":"https://github.com/sparkfun.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Qwiic SGP40 Python Package](docs/images/sgp40-gh-banner-py.PNG \"qwiic SGP40 Python Package\" )\n\n# SparkFun Qwiic SGP40 - Python Package\n\n![PyPi Version](https://img.shields.io/pypi/v/sparkfun_qwiic_sgp40)\n![GitHub issues](https://img.shields.io/github/issues/sparkfun/qwiic_sgp40_py)\n![License](https://img.shields.io/github/license/sparkfun/qwiic_sgp40_py)\n![X](https://img.shields.io/twitter/follow/sparkfun)\n[![API](https://img.shields.io/badge/API%20Reference-blue)](https://docs.sparkfun.com/qwiic_sgp40_py/classqwiic__sgp40_1_1qwiic__sgp40_1_1_qwiic_s_g_p40.html)\n\nThe SparkFun Qwiic SGP40 Air Quality Sensor Breakout Boards provide a simple and cost effective solution for adding air quality sensing to your project. Implementing a SparkFun Qwiic I2C interface, these sensors can be rapidly added to any project with boards that are part of the SparkFun Qwiic ecosystem.\n\nThis repository implements a Python package for the SparkFun Qwiic SGP40. This package works with Python, MicroPython and CircuitPython.\n\n### Contents\n\n* [About](#about-the-package)\n* [Installation](#installation)\n* [Supported Platforms](#supported-platforms)\n* [Documentation](https://docs.sparkfun.com/qwiic_sgp40_py/classqwiic__sgp40_1_1qwiic__sgp40_1_1_qwiic_s_g_p40.html)\n* [Examples](#example-use)\n\n## About the Package\n\nThis python package enables the user to access the features of the SGP40 via a single Qwiic cable. This includes reading the volatile organic compound (VOC) index, perform a self-test, and more. The capabilities of the SGP40 are each demonstrated in the included examples.\n\nNew to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).\n\n### Supported SparkFun Products\n\nThis Python package supports the following SparkFun qwiic products on Python, MicroPython and Circuit python. \n\n* [SparkFun Air Quality Sensor - SGP40](https://www.sparkfun.com/sparkfun-air-quality-sensor-sgp40-qwiic.html)\n\n### Supported Platforms\n\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 Pro Micro RP2350](https://www.sparkfun.com/sparkfun-pro-micro-rp2350.html), [SparkFun IoT RedBoard ESP32](https://www.sparkfun.com/sparkfun-iot-redboard-esp32-development-board.html), [SparkFun IoT RedBoard RP2350](https://www.sparkfun.com/sparkfun-iot-redboard-rp2350.html)\n|CircuitPython | Raspberry Pi - RP2, ESP32 | [SparkFun Pro Micro RP2350](https://www.sparkfun.com/sparkfun-pro-micro-rp2350.html), [SparkFun IoT RedBoard ESP32](https://www.sparkfun.com/sparkfun-iot-redboard-esp32-development-board.html), [SparkFun IoT RedBoard RP2350](https://www.sparkfun.com/sparkfun-iot-redboard-rp2350.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\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 an Linux-based (Raspberry Pi) system.\n\nFirst, setup a virtual environment from a specific directory using venv:\n```sh\npython3 -m venv path/to/venv\n```\nYou can pass any path as path/to/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\npath/to/venv/bin/pip3 install sparkfun-qwiic-sgp40\n```\nNow you should be able to run any example or custom python scripts that have `import qwiic_sgp40` by running e.g.:\n```sh\npath/to/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_sgp40_py\n```\n\nIf you would also like to install the examples for this repository, issue the following mip command as well:\n```sh\nmpremote mip install --target \"\" github:sparkfun/qwiic_sgp40_py@examples\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_sgp40\n```\n\nIf you would like to install any of the examples from this repository, issue the corresponding circup command from below. (NOTE: The below syntax assumes you are using CircUp on Windows. Linux and Mac will have different path seperators (i.e. \"/\" vs. \"\\\"). See the [CircUp \"example\" command documentation](https://learn.adafruit.com/keep-your-circuitpython-libraries-on-devices-up-to-date-with-circup/example-command) for more information)\n```sh\ncircup example qwiic_sgp40\\qwiic_sgp40_ex1_basic_readings\ncircup example qwiic_sgp40\\qwiic_sgp40_ex2_function_test\n```\n\nExample Use\n ---------------\nBelow is a quickstart program to print Volatile Organic Compound (VOC) Index read from the SGP40.\n\nSee the examples directory for more detailed use examples and [examples/README.md](https://github.com/sparkfun/qwiic_sgp40_py/blob/main/examples/README.md) for a summary of the available examples.\n\n```python\ndef run_example():\n\n\tprint(\"\\nSparkFun Qwiic Air Quality Sensor - SGP40, Example 1\\n\")\n\tmy_sgp40 = qwiic_sgp40.QwiicSGP40()\n\t\n\tif my_sgp40.begin() != 0:\n\t\tprint(\"\\nThe Qwiic SGP40 isn't connected to the system. Please check your connection\", \\\n\t\t\tfile=sys.stderr)\n\t\treturn\n\t\n\tprint(\"\\nSGP40 ready!\")\n\t\n\twhile True:\n\t\t\n\t\tprint(\"\\nVOC Index is: \" + str(my_sgp40.get_VOC_index()))\n\t\t\n\t\ttime.sleep(1)\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_sgp40_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparkfun%2Fqwiic_sgp40_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkfun%2Fqwiic_sgp40_py/lists"}