Python module for the qwiic ccs811 sensor, which is part of the SparkFun Qwiic Environmental Combo Breakout
This python package is a port of the existing SparkFun CCS811 Arduino Library
This package can be used in conjunction with the overall SparkFun qwiic Python Package
New to qwiic? Take a look at the entire SparkFun qwiic ecosystem.
⚠️ Using this sensor on a Raspberry Pi? ⚠️Your system might need modification. See this note.
The qwiic CCS811 Python package current supports the following platforms:
This driver package depends on the qwiic I2C driver: Qwiic_I2C_Py
The SparkFun qwiic CCS811 module documentation is hosted at ReadTheDocs
This repository is hosted on PyPi as the sparkfun-qwiic-ccs811 package. On systems that support PyPi installation via pip, this library is installed using the following commands
For all users (note: the user must have sudo privileges):
sudo pip install sparkfun-qwiic-ccs811
For the current user:
pip install sparkfun-qwiic-ccs811
To install, make sure the setuptools package is installed on the system.
Direct installation at the command line:
To build a package for use with pip:
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
cd dist pip install sparkfun_qwiic_ccs811-<version>.tar.gz
For this sensor to work on the Raspberry Pi, I2C clock stretching must be enabled.
To do this:
dtparam=i2c_arm=on dtparam=i2s=on dtparam=spi=on
# Enable I2C clock stretching dtparam=i2c_arm_baudrate=10000
See the examples directory for more detailed use examples.
from __future__ import print_function import qwiic_ccs811 import time import sys def runExample(): print("\nSparkFun CCS811 Sensor Basic Example \n") mySensor = qwiic_ccs811.QwiicCcs811() if mySensor.isConnected() == False: print("The Qwiic CCS811 device isn't connected to the system. Please check your connection", \ file=sys.stderr) return mySensor.begin() while True: mySensor.readAlgorithmResults() print("CO2:\t%.3f" % mySensor.getCO2()) print("tVOC:\t%.3f\n" % mySensor.getTVOC()) time.sleep(1) if __name__ == '__main__': try: runExample() except (KeyboardInterrupt, SystemExit) as exErr: print("\nEnding Basic Example") sys.exit(0)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4