Qwiic_SGP40_Py  2.0.0
Python for SFE Qwiic SGP40
Loading...
Searching...
No Matches
qwiic_sgp40.qwiic_sgp40.QwiicSGP40 Class Reference

QwiicSGP40. More...

Inheritance diagram for qwiic_sgp40.qwiic_sgp40.QwiicSGP40:

Public Member Functions

def __init__ (self, address=None, i2c_driver=None)
 
def is_connected (self)
 Determine if a Qwiic SGP40 device is connected to the system. More...
 
def begin (self, warm_up_time=10)
 Initialize the operation of the Qwiic SGP40 and wait through warm- up time. More...
 
def measure_test (self)
 Sensor runs chip self test. More...
 
def soft_reset (self, ignore_error=True)
 Sensor reset. More...
 
def heater_off (self)
 Turns the hotplate off and puts sensor in idle mode. More...
 
def measure_raw (self, __relative_humidity=50, __temperature_c=25)
 Returns the raw data. More...
 
def get_VOC_index (self, __relative_humidity=50, __temperature_c=25)
 Get VOC index. More...
 

Public Attributes

 address
 

Static Public Attributes

 device_name = _DEFAULT_NAME
 
 available_addresses = _AVAILABLE_I2C_ADDRESS
 
list SGP40_MEASURE_RAW = [0x26, 0x0F]
 
list SGP40_MEASURE_TEST = [0x28, 0x0E]
 
list SGP40_HEATER_OFF = [0x36, 0x15]
 
list SGP40_SOFT_RESET = [0x00, 0x06]
 
list SGP40_MEASURE_TEST_PASS = [0xD4, 0x00]
 
list SGP40_MEASURE_TEST_FAIL = [0x4B, 0x00]
 
float DURATION_WAIT_MEASURE_TEST = 0.25
 
float DURATION_READ_RAW_VOC = 0.03
 

Detailed Description

QwiicSGP40.

Parameters
addressThe I2C address to use for the device. If not provided, the default address is used.
i2c_driverAn existing i2c driver object. If not provided a a driver object is created.
Returns
Object The GPIO device object.

Constructor & Destructor Documentation

◆ __init__()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.__init__ (   self,
  address = None,
  i2c_driver = None 
)

Member Function Documentation

◆ begin()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.begin (   self,
  warm_up_time = 10 
)

Initialize the operation of the Qwiic SGP40 and wait through warm- up time.

Run is_connected() and measure_test().

Returns
bool Returns true if the intialization was successful, false otherwise.

◆ get_VOC_index()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.get_VOC_index (   self,
  __relative_humidity = 50,
  __temperature_c = 25 
)

Get VOC index.

Parameters
__relative_humidityfloat relative humidity between 0 and 100%.
__temperature_cfloat temperature in celcius between -45 and 130 degrees.
Returns
int VOC index

◆ heater_off()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.heater_off (   self)

Turns the hotplate off and puts sensor in idle mode.

◆ is_connected()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.is_connected (   self)

Determine if a Qwiic SGP40 device is connected to the system.

Returns
bool True if the device is connected, false otherwise.

◆ measure_raw()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.measure_raw (   self,
  __relative_humidity = 50,
  __temperature_c = 25 
)

Returns the raw data.

See the SGP40 datasheet for more info.

Parameters
SRAW_ticksvariable to assign raw measurement to
__relative_humidityfloat relative humidity between 0 and 100%.
__temperature_cfloat temperature in celcius between -45 and 130 degrees.
Returns
int 0 if CRC checks out, -1 otherwise

◆ measure_test()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.measure_test (   self)

Sensor runs chip self test.

Returns
int Returns 0 if the self-test succeeded and 1 if it failed.

◆ soft_reset()

def qwiic_sgp40.qwiic_sgp40.QwiicSGP40.soft_reset (   self,
  ignore_error = True 
)

Sensor reset.

Parameters
bool,optionalignore_error: Whether to ignore exception that can be raised due to no ACK after reset command, defaults to True

Member Data Documentation

◆ address

qwiic_sgp40.qwiic_sgp40.QwiicSGP40.address

◆ available_addresses

qwiic_sgp40.qwiic_sgp40.QwiicSGP40.available_addresses = _AVAILABLE_I2C_ADDRESS
static

◆ device_name

qwiic_sgp40.qwiic_sgp40.QwiicSGP40.device_name = _DEFAULT_NAME
static

◆ DURATION_READ_RAW_VOC

float qwiic_sgp40.qwiic_sgp40.QwiicSGP40.DURATION_READ_RAW_VOC = 0.03
static

◆ DURATION_WAIT_MEASURE_TEST

float qwiic_sgp40.qwiic_sgp40.QwiicSGP40.DURATION_WAIT_MEASURE_TEST = 0.25
static

◆ SGP40_HEATER_OFF

list qwiic_sgp40.qwiic_sgp40.QwiicSGP40.SGP40_HEATER_OFF = [0x36, 0x15]
static

◆ SGP40_MEASURE_RAW

list qwiic_sgp40.qwiic_sgp40.QwiicSGP40.SGP40_MEASURE_RAW = [0x26, 0x0F]
static

◆ SGP40_MEASURE_TEST

list qwiic_sgp40.qwiic_sgp40.QwiicSGP40.SGP40_MEASURE_TEST = [0x28, 0x0E]
static

◆ SGP40_MEASURE_TEST_FAIL

list qwiic_sgp40.qwiic_sgp40.QwiicSGP40.SGP40_MEASURE_TEST_FAIL = [0x4B, 0x00]
static

◆ SGP40_MEASURE_TEST_PASS

list qwiic_sgp40.qwiic_sgp40.QwiicSGP40.SGP40_MEASURE_TEST_PASS = [0xD4, 0x00]
static

◆ SGP40_SOFT_RESET

list qwiic_sgp40.qwiic_sgp40.QwiicSGP40.SGP40_SOFT_RESET = [0x00, 0x06]
static

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