Adafruit SGP30 Arduino Library
Public Member Functions | Public Attributes | List of all members
Adafruit_SGP30 Class Reference

Class that stores state and functions for interacting with SGP30 Gas Sensor. More...

#include <Adafruit_SGP30.h>

Public Member Functions

 Adafruit_SGP30 ()
 Instantiates a new SGP30 class.
 
boolean begin (TwoWire *theWire=&Wire, boolean initSensor=true)
 Setups the hardware and detects a valid SGP30. Initializes I2C then reads the serialnumber and checks that we are talking to an SGP30. More...
 
boolean softReset ()
 Commands the sensor to perform a soft reset using the "General Call" mode. Take note that this is not sensor specific and all devices that support the General Call mode on the on the same I2C bus will perform this. More...
 
boolean IAQinit ()
 Commands the sensor to begin the IAQ algorithm. Must be called after startup. More...
 
boolean IAQmeasure ()
 Commands the sensor to take a single eCO2/VOC measurement. Places results in TVOC and eCO2. More...
 
boolean IAQmeasureRaw ()
 Commands the sensor to take a single H2/ethanol raw measurement. Places results in rawH2 and rawEthanol. More...
 
boolean getIAQBaseline (uint16_t *eco2_base, uint16_t *tvoc_base)
 Request baseline calibration values for both CO2 and TVOC IAQ calculations. Places results in parameter memory locaitons. More...
 
boolean setIAQBaseline (uint16_t eco2_base, uint16_t tvoc_base)
 Assign baseline calibration values for both CO2 and TVOC IAQ calculations. More...
 
boolean setHumidity (uint32_t absolute_humidity)
 Set the absolute humidity value [mg/m^3] for compensation to increase precision of TVOC and eCO2. More...
 

Public Attributes

uint16_t TVOC
 
uint16_t eCO2
 
uint16_t rawH2
 
uint16_t rawEthanol
 
uint16_t serialnumber [3]
 

Detailed Description

Class that stores state and functions for interacting with SGP30 Gas Sensor.

Member Function Documentation

◆ begin()

boolean Adafruit_SGP30::begin ( TwoWire *  theWire = &Wire,
boolean  initSensor = true 
)

Setups the hardware and detects a valid SGP30. Initializes I2C then reads the serialnumber and checks that we are talking to an SGP30.

Parameters
theWireOptional pointer to I2C interface, otherwise use Wire
initSensorOptional pointer to prevent IAQinit to be called. Used for Deep Sleep.
Returns
True if SGP30 found on I2C, False if something went wrong!

◆ softReset()

boolean Adafruit_SGP30::softReset ( void  )

Commands the sensor to perform a soft reset using the "General Call" mode. Take note that this is not sensor specific and all devices that support the General Call mode on the on the same I2C bus will perform this.

Returns
True if command completed successfully, false if something went wrong!

◆ IAQinit()

boolean Adafruit_SGP30::IAQinit ( void  )

Commands the sensor to begin the IAQ algorithm. Must be called after startup.

Returns
True if command completed successfully, false if something went wrong!

◆ IAQmeasure()

boolean Adafruit_SGP30::IAQmeasure ( void  )

Commands the sensor to take a single eCO2/VOC measurement. Places results in TVOC and eCO2.

Returns
True if command completed successfully, false if something went wrong!

◆ IAQmeasureRaw()

boolean Adafruit_SGP30::IAQmeasureRaw ( void  )

Commands the sensor to take a single H2/ethanol raw measurement. Places results in rawH2 and rawEthanol.

Returns
True if command completed successfully, false if something went wrong!

◆ getIAQBaseline()

boolean Adafruit_SGP30::getIAQBaseline ( uint16_t *  eco2_base,
uint16_t *  tvoc_base 
)

Request baseline calibration values for both CO2 and TVOC IAQ calculations. Places results in parameter memory locaitons.

Parameters
eco2_baseA pointer to a uint16_t which we will save the calibration value to
tvoc_baseA pointer to a uint16_t which we will save the calibration value to
Returns
True if command completed successfully, false if something went wrong!

◆ setIAQBaseline()

boolean Adafruit_SGP30::setIAQBaseline ( uint16_t  eco2_base,
uint16_t  tvoc_base 
)

Assign baseline calibration values for both CO2 and TVOC IAQ calculations.

Parameters
eco2_baseA uint16_t which we will save the calibration value from
tvoc_baseA uint16_t which we will save the calibration value from
Returns
True if command completed successfully, false if something went wrong!

◆ setHumidity()

boolean Adafruit_SGP30::setHumidity ( uint32_t  absolute_humidity)

Set the absolute humidity value [mg/m^3] for compensation to increase precision of TVOC and eCO2.

Parameters
absolute_humidityA uint32_t [mg/m^3] which we will be used for compensation. If the absolute humidity is set to zero, humidity compensation will be disabled.
Returns
True if command completed successfully, false if something went wrong!

Member Data Documentation

◆ TVOC

uint16_t Adafruit_SGP30::TVOC

The last measurement of the IAQ-calculated Total Volatile Organic Compounds in ppb. This value is set when you call IAQmeasure()

◆ eCO2

uint16_t Adafruit_SGP30::eCO2

The last measurement of the IAQ-calculated equivalent CO2 in ppm. This value is set when you call IAQmeasure()

◆ rawH2

uint16_t Adafruit_SGP30::rawH2

The last measurement of the raw H2 signal. This value is set when you call IAQmeasureRaw()

◆ rawEthanol

uint16_t Adafruit_SGP30::rawEthanol

The last measurement of the raw ethanol signal. This value is set when you call IAQmeasureRaw()

◆ serialnumber

uint16_t Adafruit_SGP30::serialnumber[3]

The 48-bit serial number, this value is set when you call begin()


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