{"id":26507392,"url":"https://github.com/sparkfun/qwiic_scd4x_py","last_synced_at":"2026-05-09T15:42:44.359Z","repository":{"id":283355336,"uuid":"895227550","full_name":"sparkfun/qwiic_scd4x_py","owner":"sparkfun","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-19T19:34:37.000Z","size":6452,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-19T20:33:20.175Z","etag":null,"topics":["circuitpython","micropython","python","sparkfun","sparkfun-python"],"latest_commit_sha":null,"homepage":"http://docs.sparkfun.com/qwiic_scd4x_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":"2024-11-27T19:52:49.000Z","updated_at":"2025-03-19T19:34:41.000Z","dependencies_parsed_at":"2025-03-19T20:43:25.384Z","dependency_job_id":null,"html_url":"https://github.com/sparkfun/qwiic_scd4x_py","commit_stats":null,"previous_names":["sparkfun/qwiic_scd4x_py"],"tags_count":4,"template":false,"template_full_name":"sparkfun/Qwiic_Template_Py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_scd4x_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_scd4x_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_scd4x_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sparkfun%2Fqwiic_scd4x_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sparkfun","download_url":"https://codeload.github.com/sparkfun/qwiic_scd4x_py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244706545,"owners_count":20496571,"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","micropython","python","sparkfun","sparkfun-python"],"created_at":"2025-03-20T23:19:11.006Z","updated_at":"2026-05-09T15:42:39.340Z","avatar_url":"https://github.com/sparkfun.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Qwiic SCD4X - Python Package](docs/images/gh-banner.png \"qwiic SCD4X Python Package\")\n\n# SparkFun Qwiic SCD4X - Python Package\n\n![PyPi Version](https://img.shields.io/pypi/v/sparkfun_qwiic_scd4x)\n![GitHub issues](https://img.shields.io/github/issues/sparkfun/qwiic_scd4x_py)\n![License](https://img.shields.io/github/license/sparkfun/qwiic_scd4x_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_scd4x_py/classqwiic__scd4x_1_1_qwiic_s_c_d4x.html)\n\nThe SparkFun Qwiic CO2, Temperaure, and Humidity SCD4X Module provides a simple and cost effective solution for adding CO2, Temperaure, and Humidity capabilities 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 SCD4X. 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_scd4x_py/classqwiic__scd4x_1_1_qwiic_s_c_d4x.html)\n* [Examples](#example-use)\n\n## About the Package\n\nThis python package enables the user to access the features of the SCD4X via a single Qwiic cable. This includes reading CO2, reading temperature, reading humidity and more. The capabilities of the SCD4X 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 CO2, Temperaure, and Humidity Sensor - SCD4X](https://www.sparkfun.com/products/22396)\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 on a 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-scd4x\n```\nNow you should be able to run any example or custom python scripts that have `import qwiic_scd4x` 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_scd4x_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_scd4x_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_scd4x\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. 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\n```sh\ncircup example qwiic_scd4x\\qwiic_scd4x_ex1_basic\ncircup example qwiic_scd4x\\qwiic_scd4x_ex2_low_power\ncircup example qwiic_scd4x\\qwiic_scd4x_ex3_disable_auto_calibration\ncircup example qwiic_scd4x\\qwiic_scd4x_ex4_skip_stop_periodic\ncircup example qwiic_scd4x\\qwiic_scd4x_ex6_signal_compensation\ncircup example qwiic_scd4x\\qwiic_scd4x_ex7_test_and_reset\ncircup example qwiic_scd4x\\qwiic_scd4x_ex8_scd41_single_shot\ncircup example qwiic_scd4x\\qwiic_scd4x_ex9_sensor_type\n\n```\n\nExample Use\n ---------------\nBelow is a quickstart program to print readings from the SCD4X.\n\nSee the examples directory for more detailed use examples and [examples/README.md](https://github.com/sparkfun/qwiic_scd4x_py/blob/master/examples/README.md) for a summary of the available examples.\n\n```python\n\nimport qwiic_scd4x\nimport sys\nimport time\n\ndef runExample():\n\tprint(\"\\nQwiic SCD4x Example 1 - Basic Readings\\n\")\n\n\tmySCD4x = qwiic_scd4x.QwiicSCD4x() \n\n\tif mySCD4x.is_connected() == False:\n\t\tprint(\"The device isn't connected to the system. Please check your connection\", file=sys.stderr)\n\t\treturn\n\n\tif mySCD4x.begin() == False:\n\t\tprint(\"Error while initializing device\", file=sys.stderr)\n\t\treturn\n\t\n\n\twhile True:\n\t\tif mySCD4x.read_measurement(): # This must be called to get new data. It will return false until new data is available \n\t\t\tprint(\"\\nCO2(ppm):\", mySCD4x.get_co2())\n\t\t\tprint(\"Temperature(C):\", mySCD4x.get_temperature())\n\t\t\tprint(\"Humidity(%RH):\", mySCD4x.get_humidity())\n\t\telse:\n\t\t\tprint(\".\", end=\"\")\n\n\t\ttime.sleep(0.5) # Only check for new data every 0.5 seconds\n\nif __name__ == '__main__':\n\ttry:\n\t\trunExample()\n\texcept (KeyboardInterrupt, SystemExit) as exErr:\n\t\tprint(\"\\nEnding Example\")\n\t\tsys.exit(0)\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_scd4x_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsparkfun%2Fqwiic_scd4x_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsparkfun%2Fqwiic_scd4x_py/lists"}