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

#include <Adafruit_SGP30.h>

Public Member Functions

 Adafruit_SGP30 ()
 Instantiates a new SGP30 class.
 
boolean begin (TwoWire *theWire=NULL)
 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 IAQinit (void)
 Commands the sensor to begin the IAQ algorithm. Must be called after startup. More...
 
boolean IAQmeasure (void)
 Commands the sensor to take a single eCO2/VOC measurement. Places results in TVOC and eCO2. 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 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 = NULL)

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
Returns
True if SGP30 found on I2C, 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!

◆ 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()

◆ 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: