adafruit_ccs811

This library supports the use of the CCS811 air quality sensor in CircuitPython.

Author(s): Dean Miller for Adafruit Industries

Hardware:

Software and Dependencies:

Notes:

#. Datasheet

class adafruit_ccs811.CCS811(i2c_bus: I2C, address: int = 90)[source]

CCS811 gas sensor driver.

Parameters:
  • i2c_bus (I2C) – The I2C bus the BME280 is connected to

  • address (int) – The I2C address of the CCS811. Defaults to 0x5A

Quickstart: Importing and using the CCS811

Here is an example of using the CCS811 class. First you will need to import the libraries to use the sensor

import board
import adafruit_ccs811

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()   # uses board.SCL and board.SDA
ccs811 = adafruit_ccs811.CCS811(i2c)

Now you have access to the eco2 and tvoc attributes.

eco2 = ccs811.eco2
tvoc = ccs811.tvoc
property baseline: int

The property reads and returns the current baseline value. The returned value is packed into an integer. Later the same integer can be used in order to set a new baseline.

data_ready

True when new data has been read.

property eco2: int | None

Equivalent Carbon Dioxide in parts per million. Clipped to 400 to 8192ppm.

error

True when an error has occured.

property error_code: int

Error code

reset() None[source]

Initiate a software reset.

set_environmental_data(humidity: int, temperature: float) None[source]

Set the temperature and humidity used when computing eCO2 and TVOC values.

Parameters:
  • humidity (int) – The current relative humidity in percent.

  • temperature (float) – The current temperature in Celsius.

set_interrupt_thresholds(low_med: int, med_high: int, hysteresis: int) None[source]

Set the thresholds used for triggering the interrupt based on eCO2. The interrupt is triggered when the value crossed a boundary value by the minimum hysteresis value.

Parameters:
  • low_med (int) – Boundary between low and medium ranges

  • med_high (int) – Boundary between medium and high ranges

  • hysteresis (int) – Minimum difference between reads

temp_offset = 0.0

Temperature offset.

property temperature: float

Deprecated since version 1.1.5: Hardware support removed by vendor

Temperature based on optional thermistor in Celsius.

property tvoc: int | None

Total Volatile Organic Compound in parts per billion.