API Reference

qwiic_ccs811

Python module for the qwiic ccs811 sensor, which is part of the [SparkFun Qwiic Environmental Combo Breakout](https://www.sparkfun.com/products/14348)

This python package is a port of the existing [SparkFun CCS811 Arduino Library](https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library)

This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)

New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).

class qwiic_ccs811.QwiicCcs811(address=None, i2c_driver=None)[source]

QwiicCccs811

param address:The I2C address to use for the device. If not provided, the default address is used.
param i2c_driver:
 An existing i2c driver object. If not provided a driver object is created.
return:The Ccs811 device object.
rtype:Object
CO2

Return the current CO2 value.

Returns:The CO2 Value
Return type:float
TVOC

Return the current TVOC value.

Returns:The TVOC Value
Return type:float
app_valid()[source]

Returns True if if the sensor APP_VALID bit is set in the status register

Returns:True if APP_VALID is set
Return type:bool
baseline

Returns the baseline value Used for telling sensor what ‘clean’ air is You must put the sensor in clean air and record this value

Returns:Baseline value for the sensor
Return type:integer
begin()[source]

Initialize the operation of the Ccs811 module

Returns:Returns SENSOR_SUCCESS on success, SENSOR_ID_ERROR on bad chip ID or SENSOR_INTERNAL_ERROR.
Return type:integer
check_status_error()[source]

Returns if the Error bit on the sensor is set.

Returns:value of Error bit
Return type:integer
connected

Determine if a CCS811 device is conntected to the system..

Returns:True if the device is connected, otherwise False.
Return type:bool
data_available()[source]

Returns True if data is available on the sensor

Returns:True if data is available.
Return type:bool
disable_interrupts()[source]

Clear the Interrupt bit in the sensor and disable Interrupts on the sensor

Returns:SENSOR_SUCCESS
Return type:integer
enable_interrupts()[source]

Set the Interrupt bit in the sensor and enable Interrupts on the sensor

Returns:SENSOR_SUCCESS
Return type:integer
error_register

Returns the value of the sensors error Register

Returns:Error register
Return type:int
get_baseline()[source]

Returns the baseline value Used for telling sensor what ‘clean’ air is You must put the sensor in clean air and record this value

Returns:Baseline value for the sensor
Return type:integer
get_co2()[source]

Return the current CO2 value.

Returns:The CO2 Value
Return type:float
get_error_register()[source]

Returns the value of the sensors error Register

Returns:Error register
Return type:int
get_reference_resistance()[source]

Get the sensors referance resistance

Returns:The current reference resistance
Return type:integer
get_resistance()[source]

Return the current resistance value.

Returns:The resistance value
Return type:float
get_temperature()[source]

Return the current temperature value.

Returns:The temperature Value
Return type:float
get_tvoc()[source]

Return the current TVOC value.

Returns:The TVOC Value
Return type:float
is_connected()[source]

Determine if a CCS811 device is conntected to the system..

Returns:True if the device is connected, otherwise False.
Return type:bool
read_algorithm_results()[source]

Reads the resutls from the sensor and stores internally

Returns:SENSOR_SUCCESS
Return type:integer
read_ntc()[source]

Read the NTC values from the sensor and store for future calications.

NOTE: The qwiic CCS811 doesn’t support this function, but other CCS811 sparkfun boards do.

Returns:A SENSOR_ status code
Return type:integer
referance_resistance

Get the sensors referance resistance

Returns:The current reference resistance
Return type:integer
resistance

Return the current resistance value.

Returns:The resistance value
Return type:float
set_baseline(input_val)[source]

Set the baseline value for the sensor

Returns:SENSOR_SUCCESS
Return type:integer
set_drive_mode(mode)[source]

Set the Drive mode for the sensor

Parameters:mode – Valid values are: 0 = Idle, 1 = read every 1s, 2 = every 10s, 3 = every 60s, 4 = RAW mode
Returns:SENSOR_SUCCESS
Return type:integer
set_environmental_data(relativeHumidity, temperature)[source]

Given a temp and humidity, write this data to the CSS811 for better compensation This function expects the humidity and temp to come in as floats

Parameters:
  • relativeHumidity – The relativity Humity for the sensor to use
  • temperature – The temperature for the sensor to use
Returns:

one of the SENSOR_ return codes.

Return type:

integer

set_reference_resistance(input_val)[source]

Set the sensors referance resistance

Parameters:input – The referance resistance to set in the sensor
Returns:No return value
temperature

Return the current temperature value.

Returns:The temperature Value
Return type:float