Qwiic_ENS160_Py  2.0.0-3-gba26a9b
Python for SFE Qwiic ENS160
Loading...
Searching...
No Matches
qwiic_ens160.QwiicENS160 Class Reference
Inheritance diagram for qwiic_ens160.QwiicENS160:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 Constructor. More...
 
def is_connected (self)
 Determines if this device is connected. More...
 
def begin (self)
 Initializes this device with default parameters. More...
 
def set_operating_mode (self, val)
 Sets the operating mode: Deep Sleep (0x00), Idle (0x01), Standard (0x02), Reset (0xF0) More...
 
def get_operating_mode (self)
 Gets the current operating mode: Deep Sleep (0x00), Idle (0x01), Standard (0x02), Reset (0xF0) More...
 
def get_app_ver (self)
 Retrieves the 24 bit application version of the device. More...
 
def get_unique_id (self)
 Retrieves the 16 bit id of the device. More...
 
def configure_interrupt (self, val)
 Changes all of the settings within the interrupt configuration register. More...
 
def enable_interrupt (self, enable=True)
 Enables the interrupt. More...
 
def set_interrupt_polarity (self, activeHigh=True)
 Changes the polarity of the interrupt: active high or active low. More...
 
def get_interrupt_polarity (self)
 Retrieves the Retrieves the polarity of the physical interrupt. More...
 
def set_interrupt_drive (self, pushPull=True)
 Changes the pin drive of the interrupt: open drain (default) to push/pull. More...
 
def set_data_interrupt (self, enable)
 Routes the data ready signal to the interrupt pin. More...
 
def set_gpr_interrupt (self, enable)
 Routes the general purporse read register signal to the interrupt pin. More...
 
def set_temp_compensation (self, tempKelvin)
 The ENS160 can use temperature data to help give more accurate sensor data. More...
 
def set_temp_compensation_celsius (self, tempCelsius)
 The ENS160 can use temperature data to help give more accurate sensor data. More...
 
def set_rh_compensation (self, humidity)
 The ENS160 can use relative Humidiy data to help give more accurate sensor data. More...
 
def check_data_status (self)
 This checks the if the NEWDAT bit is high indicating that new data is ready to be read. More...
 
def check_gpr_status (self)
 This checks the if the NEWGPR bit is high indicating that there is data in the general purpose read registers. More...
 
def get_flags (self)
 This checks the status "flags" of the device (0-3). More...
 
def check_operation_status (self)
 Checks the bit that indicates if an operation mode is running i.e. More...
 
def get_operation_error (self)
 Checks the bit that indicates if an invalid operating mode has been selected. More...
 
def get_aqi (self)
 This reports the calculated Air Quality Index according to UBA which is a value between 1-5. More...
 
def get_tvoc (self)
 This reports the Total Volatile Organic Compounds in ppb (parts per billion) More...
 
def get_etoh (self)
 This reports the ehtanol concentration in ppb (parts per billion). More...
 
def get_eco2 (self)
 This reports the CO2 concentration in ppm (parts per million) based on the detected VOCs and hydrogen. More...
 
def get_temp_kelvin (self)
 This reports the temperature compensation value given to the sensor in Kelvin. More...
 
def get_temp_celsius (self)
 This reports the temperature compensation value given to the sensor in Celsius. More...
 
def get_rh (self)
 This reports the relative humidity compensation value given to the sensor. More...
 
def get_raw_resistance (self)
 For certain gases the raw resistance values of the hot plates can be used for post processing. More...
 

Public Attributes

 address
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
int kRegPartId = 0x00
 
int kRegOpMode = 0x10
 
int kRegConfig = 0x11
 
int kRegCommand = 0x12
 
int kRegTempIn = 0x13
 
int kRegRhIn = 0x15
 
int kRegDeviceStatus = 0x20
 
int kRegDataAqi = 0x21
 
int kRegDataTvoc = 0x22
 
int kRegDataEtoh = 0x22
 
int kRegDataEco2 = 0x24
 
int kRegDataT = 0x30
 
int kRegDataRh = 0x32
 
int kRegDataMisr = 0x38
 
int kRegGPRWrite0 = 0x40
 
int kRegGPRWrite1 = 0x41
 
int kRegGPRWrite2 = 0x42
 
int kRegGPRWrite3 = 0x43
 
int kRegGPRWrite4 = 0x44
 
int kRegGPRWrite5 = 0x45
 
int kRegGPRWrite6 = 0x46
 
int kRegGPRWrite7 = 0x47
 
int kRegGPRRead0 = 0x48
 
int kRegGPRRead1 = 0x49
 
int kRegGPRRead2 = 0x4A
 
int kRegGPRRead3 = 0x4B
 
int kRegGPRRead4 = 0x4C
 
int kRegGPRRead5 = 0x4D
 
int kRegGPRRead6 = 0x4E
 
int kRegGPRRead7 = 0x4F
 
int kPartId = 0x0160
 
int kOpModeDeepSleep = 0x00
 
int kOpModeIdle = 0x01
 
int kOpModeStandard = 0x02
 
int kOpModeReset = 0xF0
 
int kShiftConfigIntPol = 6
 
int kShiftConfigIntCfg = 5
 
int kShiftConfigIntGPR = 3
 
int kShiftConfigIntDat = 1
 
int kShiftConfigIntEn = 0
 
int kMaskConfigIntPol = 0b1 << kShiftConfigIntPol
 
int kMaskConfigIntCfg = 0b1 << kShiftConfigIntCfg
 
int kMaskConfigIntGPR = 0b1 << kShiftConfigIntGPR
 
int kMaskConfigIntDat = 0b1 << kShiftConfigIntDat
 
int kMaskConfigIntEn = 0b1 << kShiftConfigIntEn
 
int kCommandNop = 0x00
 
int kCommandGetAppVer = 0x0E
 
int kCommandClearGPR = 0xCC
 
int kShiftDeviceStatusStatAs = 7
 
int kShiftDeviceStatusStatEr = 6
 
int kShiftDeviceStatusValidityFlag = 2
 
int kShiftDeviceStatusNewDat = 1
 
int kShiftDeviceStatusNewGpr = 0
 
int kMaskDeviceStatusStatAs = 0b1 << kShiftDeviceStatusStatAs
 
int kMaskDeviceStatusStatEr = 0b1 << kShiftDeviceStatusStatEr
 
int kMaskDeviceStatusValidityFlag = 0b11 << kShiftDeviceStatusValidityFlag
 
int kMaskDeviceStatusNewDat = 0b1 << kShiftDeviceStatusNewDat
 
int kMaskDeviceStatusNewGpr = 0b1 << kShiftDeviceStatusNewGpr
 
int kValidityFlagNormal = 0
 
int kValidityFlagWarmUp = 1
 
int kValidityFlagStartUp = 2
 
int kValidityFlagInvalid = 3
 
int kShiftDataAqiUba = 0
 
int kMaskDataAqiUba = 0b11 << kShiftDataAqiUba
 
int kPoly = 0x1D
 

Properties

 connected = property(is_connected)
 

Constructor & Destructor Documentation

◆ __init__()

def qwiic_ens160.QwiicENS160.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Constructor.

Parameters
int,optionaladdress: The I2C address to use for the device If not provided, the default address is used
I2CDriver,optionali2c_driver: An existing i2c driver object If not provided, a driver object is created

Member Function Documentation

◆ begin()

def qwiic_ens160.QwiicENS160.begin (   self)

Initializes this device with default parameters.

Returns
bool Returns True if successful, otherwise False

◆ check_data_status()

def qwiic_ens160.QwiicENS160.check_data_status (   self)

This checks the if the NEWDAT bit is high indicating that new data is ready to be read.

The bit is cleared when data has been read from their registers.

Returns
bool Whether NEWDAT bit is high

◆ check_gpr_status()

def qwiic_ens160.QwiicENS160.check_gpr_status (   self)

This checks the if the NEWGPR bit is high indicating that there is data in the general purpose read registers.

The bit is cleared the relevant registers have been read.

Returns
bool Whether NEWGPR bit is high

◆ check_operation_status()

def qwiic_ens160.QwiicENS160.check_operation_status (   self)

Checks the bit that indicates if an operation mode is running i.e.

the device is not off.

Returns
bool Whether NEWGPR bit is high

◆ configure_interrupt()

def qwiic_ens160.QwiicENS160.configure_interrupt (   self,
  val 
)

Changes all of the settings within the interrupt configuration register.

Parameters
intval: The desired configuration settings.

◆ enable_interrupt()

def qwiic_ens160.QwiicENS160.enable_interrupt (   self,
  enable = True 
)

Enables the interrupt.

Parameters
boolenable: Turns on or off the interrupt

◆ get_app_ver()

def qwiic_ens160.QwiicENS160.get_app_ver (   self)

Retrieves the 24 bit application version of the device.

Returns
int Application version

◆ get_aqi()

def qwiic_ens160.QwiicENS160.get_aqi (   self)

This reports the calculated Air Quality Index according to UBA which is a value between 1-5.

The AQI-UBA is a guideline developed by the German Federal Environmental Agency and is widely referenced and adopted by many countries and organizations.

1 - Excellent, 2 - Good, 3 - Moderate, 4 - Poor, 5 - Unhealthy.

Returns
int Qir Quality Index

◆ get_eco2()

def qwiic_ens160.QwiicENS160.get_eco2 (   self)

This reports the CO2 concentration in ppm (parts per million) based on the detected VOCs and hydrogen.

Returns
int CO2 concentration in ppm

◆ get_etoh()

def qwiic_ens160.QwiicENS160.get_etoh (   self)

This reports the ehtanol concentration in ppb (parts per billion).

According to the datasheet this is a "virtual mirror" of the ethanol-calibrated TVOC register, which is why they share the same register.

Returns
int Ethanol concentration in ppb

◆ get_flags()

def qwiic_ens160.QwiicENS160.get_flags (   self)

This checks the status "flags" of the device (0-3).

Returns
int The current status flag (0: normal, 1: warm-up, 2: initial start-up, 3: invalid)

◆ get_interrupt_polarity()

def qwiic_ens160.QwiicENS160.get_interrupt_polarity (   self)

Retrieves the Retrieves the polarity of the physical interrupt.

Returns
int Interrupt polarity (0: active low, 1: active high)

◆ get_operating_mode()

def qwiic_ens160.QwiicENS160.get_operating_mode (   self)

Gets the current operating mode: Deep Sleep (0x00), Idle (0x01), Standard (0x02), Reset (0xF0)

Returns
int The current operating mode

◆ get_operation_error()

def qwiic_ens160.QwiicENS160.get_operation_error (   self)

Checks the bit that indicates if an invalid operating mode has been selected.

Returns
bool Whether an OpMode error is selected

◆ get_raw_resistance()

def qwiic_ens160.QwiicENS160.get_raw_resistance (   self)

For certain gases the raw resistance values of the hot plates can be used for post processing.

More information can be found within the datasheet.

Returns
float Raw Resistance

◆ get_rh()

def qwiic_ens160.QwiicENS160.get_rh (   self)

This reports the relative humidity compensation value given to the sensor.

Returns
float Relative Humidty

◆ get_temp_celsius()

def qwiic_ens160.QwiicENS160.get_temp_celsius (   self)

This reports the temperature compensation value given to the sensor in Celsius.

Returns
float Temperature compensation in Celsius

◆ get_temp_kelvin()

def qwiic_ens160.QwiicENS160.get_temp_kelvin (   self)

This reports the temperature compensation value given to the sensor in Kelvin.

Returns
float Temperature compensation in Kelvin

◆ get_tvoc()

def qwiic_ens160.QwiicENS160.get_tvoc (   self)

This reports the Total Volatile Organic Compounds in ppb (parts per billion)

Returns
int Total Volatile Organic Compounds in ppb

◆ get_unique_id()

def qwiic_ens160.QwiicENS160.get_unique_id (   self)

Retrieves the 16 bit id of the device.

Returns
int Part Id

◆ is_connected()

def qwiic_ens160.QwiicENS160.is_connected (   self)

Determines if this device is connected.

Returns
bool True if connected, otherwise False

◆ set_data_interrupt()

def qwiic_ens160.QwiicENS160.set_data_interrupt (   self,
  enable 
)

Routes the data ready signal to the interrupt pin.

Parameters
boolenable: enables or disables data ready on

◆ set_gpr_interrupt()

def qwiic_ens160.QwiicENS160.set_gpr_interrupt (   self,
  enable 
)

Routes the general purporse read register signal to the interrupt pin.

Parameters
boolenable: whether to turn on or off general purpose read

◆ set_interrupt_drive()

def qwiic_ens160.QwiicENS160.set_interrupt_drive (   self,
  pushPull = True 
)

Changes the pin drive of the interrupt: open drain (default) to push/pull.

Parameters
boolpushPull: Changes the drive of the pin.

◆ set_interrupt_polarity()

def qwiic_ens160.QwiicENS160.set_interrupt_polarity (   self,
  activeHigh = True 
)

Changes the polarity of the interrupt: active high or active low.

By default this value is set to zero or active low.

Parameters
boolactiveHigh: Changes active state of interrupt from high to low.

◆ set_operating_mode()

def qwiic_ens160.QwiicENS160.set_operating_mode (   self,
  val 
)

Sets the operating mode: Deep Sleep (0x00), Idle (0x01), Standard (0x02), Reset (0xF0)

Parameters
intval: The desired operating mode to set

◆ set_rh_compensation()

def qwiic_ens160.QwiicENS160.set_rh_compensation (   self,
  humidity 
)

The ENS160 can use relative Humidiy data to help give more accurate sensor data.

Parameters
floathumidity: The given relative humidity

◆ set_temp_compensation()

def qwiic_ens160.QwiicENS160.set_temp_compensation (   self,
  tempKelvin 
)

The ENS160 can use temperature data to help give more accurate sensor data.

Parameters
floattempKelvin: The given temperature in Kelvin

◆ set_temp_compensation_celsius()

def qwiic_ens160.QwiicENS160.set_temp_compensation_celsius (   self,
  tempCelsius 
)

The ENS160 can use temperature data to help give more accurate sensor data.

Parameters
floattempCelsius: The given temperature in Celsius

Member Data Documentation

◆ address

qwiic_ens160.QwiicENS160.address

◆ available_addresses

qwiic_ens160.QwiicENS160.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ device_name

qwiic_ens160.QwiicENS160.device_name = _DEFAULT_NAME
static

◆ kCommandClearGPR

int qwiic_ens160.QwiicENS160.kCommandClearGPR = 0xCC
static

◆ kCommandGetAppVer

int qwiic_ens160.QwiicENS160.kCommandGetAppVer = 0x0E
static

◆ kCommandNop

int qwiic_ens160.QwiicENS160.kCommandNop = 0x00
static

◆ kMaskConfigIntCfg

int qwiic_ens160.QwiicENS160.kMaskConfigIntCfg = 0b1 << kShiftConfigIntCfg
static

◆ kMaskConfigIntDat

int qwiic_ens160.QwiicENS160.kMaskConfigIntDat = 0b1 << kShiftConfigIntDat
static

◆ kMaskConfigIntEn

int qwiic_ens160.QwiicENS160.kMaskConfigIntEn = 0b1 << kShiftConfigIntEn
static

◆ kMaskConfigIntGPR

int qwiic_ens160.QwiicENS160.kMaskConfigIntGPR = 0b1 << kShiftConfigIntGPR
static

◆ kMaskConfigIntPol

int qwiic_ens160.QwiicENS160.kMaskConfigIntPol = 0b1 << kShiftConfigIntPol
static

◆ kMaskDataAqiUba

int qwiic_ens160.QwiicENS160.kMaskDataAqiUba = 0b11 << kShiftDataAqiUba
static

◆ kMaskDeviceStatusNewDat

int qwiic_ens160.QwiicENS160.kMaskDeviceStatusNewDat = 0b1 << kShiftDeviceStatusNewDat
static

◆ kMaskDeviceStatusNewGpr

int qwiic_ens160.QwiicENS160.kMaskDeviceStatusNewGpr = 0b1 << kShiftDeviceStatusNewGpr
static

◆ kMaskDeviceStatusStatAs

int qwiic_ens160.QwiicENS160.kMaskDeviceStatusStatAs = 0b1 << kShiftDeviceStatusStatAs
static

◆ kMaskDeviceStatusStatEr

int qwiic_ens160.QwiicENS160.kMaskDeviceStatusStatEr = 0b1 << kShiftDeviceStatusStatEr
static

◆ kMaskDeviceStatusValidityFlag

int qwiic_ens160.QwiicENS160.kMaskDeviceStatusValidityFlag = 0b11 << kShiftDeviceStatusValidityFlag
static

◆ kOpModeDeepSleep

int qwiic_ens160.QwiicENS160.kOpModeDeepSleep = 0x00
static

◆ kOpModeIdle

int qwiic_ens160.QwiicENS160.kOpModeIdle = 0x01
static

◆ kOpModeReset

int qwiic_ens160.QwiicENS160.kOpModeReset = 0xF0
static

◆ kOpModeStandard

int qwiic_ens160.QwiicENS160.kOpModeStandard = 0x02
static

◆ kPartId

int qwiic_ens160.QwiicENS160.kPartId = 0x0160
static

◆ kPoly

int qwiic_ens160.QwiicENS160.kPoly = 0x1D
static

◆ kRegCommand

int qwiic_ens160.QwiicENS160.kRegCommand = 0x12
static

◆ kRegConfig

int qwiic_ens160.QwiicENS160.kRegConfig = 0x11
static

◆ kRegDataAqi

int qwiic_ens160.QwiicENS160.kRegDataAqi = 0x21
static

◆ kRegDataEco2

int qwiic_ens160.QwiicENS160.kRegDataEco2 = 0x24
static

◆ kRegDataEtoh

int qwiic_ens160.QwiicENS160.kRegDataEtoh = 0x22
static

◆ kRegDataMisr

int qwiic_ens160.QwiicENS160.kRegDataMisr = 0x38
static

◆ kRegDataRh

int qwiic_ens160.QwiicENS160.kRegDataRh = 0x32
static

◆ kRegDataT

int qwiic_ens160.QwiicENS160.kRegDataT = 0x30
static

◆ kRegDataTvoc

int qwiic_ens160.QwiicENS160.kRegDataTvoc = 0x22
static

◆ kRegDeviceStatus

int qwiic_ens160.QwiicENS160.kRegDeviceStatus = 0x20
static

◆ kRegGPRRead0

int qwiic_ens160.QwiicENS160.kRegGPRRead0 = 0x48
static

◆ kRegGPRRead1

int qwiic_ens160.QwiicENS160.kRegGPRRead1 = 0x49
static

◆ kRegGPRRead2

int qwiic_ens160.QwiicENS160.kRegGPRRead2 = 0x4A
static

◆ kRegGPRRead3

int qwiic_ens160.QwiicENS160.kRegGPRRead3 = 0x4B
static

◆ kRegGPRRead4

int qwiic_ens160.QwiicENS160.kRegGPRRead4 = 0x4C
static

◆ kRegGPRRead5

int qwiic_ens160.QwiicENS160.kRegGPRRead5 = 0x4D
static

◆ kRegGPRRead6

int qwiic_ens160.QwiicENS160.kRegGPRRead6 = 0x4E
static

◆ kRegGPRRead7

int qwiic_ens160.QwiicENS160.kRegGPRRead7 = 0x4F
static

◆ kRegGPRWrite0

int qwiic_ens160.QwiicENS160.kRegGPRWrite0 = 0x40
static

◆ kRegGPRWrite1

int qwiic_ens160.QwiicENS160.kRegGPRWrite1 = 0x41
static

◆ kRegGPRWrite2

int qwiic_ens160.QwiicENS160.kRegGPRWrite2 = 0x42
static

◆ kRegGPRWrite3

int qwiic_ens160.QwiicENS160.kRegGPRWrite3 = 0x43
static

◆ kRegGPRWrite4

int qwiic_ens160.QwiicENS160.kRegGPRWrite4 = 0x44
static

◆ kRegGPRWrite5

int qwiic_ens160.QwiicENS160.kRegGPRWrite5 = 0x45
static

◆ kRegGPRWrite6

int qwiic_ens160.QwiicENS160.kRegGPRWrite6 = 0x46
static

◆ kRegGPRWrite7

int qwiic_ens160.QwiicENS160.kRegGPRWrite7 = 0x47
static

◆ kRegOpMode

int qwiic_ens160.QwiicENS160.kRegOpMode = 0x10
static

◆ kRegPartId

int qwiic_ens160.QwiicENS160.kRegPartId = 0x00
static

◆ kRegRhIn

int qwiic_ens160.QwiicENS160.kRegRhIn = 0x15
static

◆ kRegTempIn

int qwiic_ens160.QwiicENS160.kRegTempIn = 0x13
static

◆ kShiftConfigIntCfg

int qwiic_ens160.QwiicENS160.kShiftConfigIntCfg = 5
static

◆ kShiftConfigIntDat

int qwiic_ens160.QwiicENS160.kShiftConfigIntDat = 1
static

◆ kShiftConfigIntEn

int qwiic_ens160.QwiicENS160.kShiftConfigIntEn = 0
static

◆ kShiftConfigIntGPR

int qwiic_ens160.QwiicENS160.kShiftConfigIntGPR = 3
static

◆ kShiftConfigIntPol

int qwiic_ens160.QwiicENS160.kShiftConfigIntPol = 6
static

◆ kShiftDataAqiUba

int qwiic_ens160.QwiicENS160.kShiftDataAqiUba = 0
static

◆ kShiftDeviceStatusNewDat

int qwiic_ens160.QwiicENS160.kShiftDeviceStatusNewDat = 1
static

◆ kShiftDeviceStatusNewGpr

int qwiic_ens160.QwiicENS160.kShiftDeviceStatusNewGpr = 0
static

◆ kShiftDeviceStatusStatAs

int qwiic_ens160.QwiicENS160.kShiftDeviceStatusStatAs = 7
static

◆ kShiftDeviceStatusStatEr

int qwiic_ens160.QwiicENS160.kShiftDeviceStatusStatEr = 6
static

◆ kShiftDeviceStatusValidityFlag

int qwiic_ens160.QwiicENS160.kShiftDeviceStatusValidityFlag = 2
static

◆ kValidityFlagInvalid

int qwiic_ens160.QwiicENS160.kValidityFlagInvalid = 3
static

◆ kValidityFlagNormal

int qwiic_ens160.QwiicENS160.kValidityFlagNormal = 0
static

◆ kValidityFlagStartUp

int qwiic_ens160.QwiicENS160.kValidityFlagStartUp = 2
static

◆ kValidityFlagWarmUp

int qwiic_ens160.QwiicENS160.kValidityFlagWarmUp = 1
static

Property Documentation

◆ connected

qwiic_ens160.QwiicENS160.connected = property(is_connected)
static

The documentation for this class was generated from the following file: