Electrochemical Gas Sensor Library 1.0.0
A library for the Electrochemical Gas Sensor breakout board
Loading...
Searching...
No Matches
ElectrochemicalGasSensor Class Reference

#include <Electrochemical-Gas-Sensor-SOLDERED.h>

Public Member Functions

 ElectrochemicalGasSensor (sensorType _t, uint8_t _adcAddr=DEFAULT_ADC_ADDR, int _configPin=-1)
 Constructor on custom address.
 
bool begin ()
 Init the sensor and begin measuring with the ADC, must be called before using.
 
bool configureLMP ()
 Configure the LMP91000, has to be done at startup.
 
double getVoltage ()
 get the voltage which the ADS is currently measuring
 
double getPPM ()
 Make a measurement with the ADC and calculate the PPM value of the measured gas.
 
double getPPB ()
 Calcualte PPB values from PPM.
 
double getAveragedPPM (uint8_t _numMeasurements=5, uint8_t _secondsDelay=2)
 Calculate an averaged PPM measurement from a number of separate measurements.
 
double getAveragedPPB (uint8_t _numMeasurements=5, uint8_t _secondsDelay=2)
 Calculate an averaged PPB measurement from a number of separate measurements.
 
void setCustomTiaGain (float _tiaGain)
 Set a custom number of the kOhms in the TIA gain.
 
void setCustomZeroCalibration (double calibration)
 Set a custom value for the zero calibration.
 

Private Member Functions

float getTiaGain ()
 Get the actual number of the kOhms in the TIA gain.
 
float getInternalZeroPercent ()
 Get the internal zero % setting as an actual float.
 

Private Attributes

LMP91000lmp
 
ADS1015ads
 
uint8_t adcAddr
 
int configPin
 
sensorType type
 
float tiaGainInKOHms
 
float internalZeroPercent
 

Constructor & Destructor Documentation

◆ ElectrochemicalGasSensor()

ElectrochemicalGasSensor::ElectrochemicalGasSensor ( sensorType _t,
uint8_t _adcAddr = DEFAULT_ADC_ADDR,
int _configPin = -1 )

Constructor on custom address.

Parameters
sensorType_t The type of the sensor
uint8_t_adcAddr The custom address of the ADC

Member Function Documentation

◆ begin()

bool ElectrochemicalGasSensor::begin ( )

Init the sensor and begin measuring with the ADC, must be called before using.

Returns
True if it was successful, false if it failed

◆ configureLMP()

bool ElectrochemicalGasSensor::configureLMP ( )

Configure the LMP91000, has to be done at startup.

Returns
True if it was successful, false if it failed

◆ getAveragedPPB()

double ElectrochemicalGasSensor::getAveragedPPB ( uint8_t _numMeasurements = 5,
uint8_t _secondsDelay = 2 )

Calculate an averaged PPB measurement from a number of separate measurements.

Note
This is a blocking function, it won't exit until it's completed
Parameters
uint8_t_numMeasurements How many measurements to do
uint8_t_secondsDelay How many seconds to wait between each measurement
Returns
double value of the calculated averaged PPB

◆ getAveragedPPM()

double ElectrochemicalGasSensor::getAveragedPPM ( uint8_t _numMeasurements = 5,
uint8_t _secondsDelay = 2 )

Calculate an averaged PPM measurement from a number of separate measurements.

Note
This is a blocking function, it won't exit until it's completed
Parameters
uint8_t_numMeasurements How many measurements to do
uint8_t_secondsDelay How many seconds to wait between each measurement
Returns
double value of the calculated averaged PPM

◆ getInternalZeroPercent()

float ElectrochemicalGasSensor::getInternalZeroPercent ( )
private

Get the internal zero % setting as an actual float.

Returns
The internal zero as a float

◆ getPPB()

double ElectrochemicalGasSensor::getPPB ( )

Calcualte PPB values from PPM.

Returns
double value of PPB

◆ getPPM()

double ElectrochemicalGasSensor::getPPM ( )

Make a measurement with the ADC and calculate the PPM value of the measured gas.

Returns
double value of the PPM

◆ getTiaGain()

float ElectrochemicalGasSensor::getTiaGain ( )
private

Get the actual number of the kOhms in the TIA gain.

Note
Only used internally in the class
Returns
float of the TIA gain depending on the config

◆ getVoltage()

double ElectrochemicalGasSensor::getVoltage ( )

get the voltage which the ADS is currently measuring

Returns
double value of the voltage in volts

◆ setCustomTiaGain()

void ElectrochemicalGasSensor::setCustomTiaGain ( float _tiaGain)

Set a custom number of the kOhms in the TIA gain.

Note
This is if you're using an external resistor
Returns
None

◆ setCustomZeroCalibration()

void ElectrochemicalGasSensor::setCustomZeroCalibration ( double calibration)

Set a custom value for the zero calibration.

Parameters
calibrationVoltage level at 0ppm

Member Data Documentation

◆ adcAddr

uint8_t ElectrochemicalGasSensor::adcAddr
private

◆ ads

ADS1015* ElectrochemicalGasSensor::ads
private

◆ configPin

int ElectrochemicalGasSensor::configPin
private

◆ internalZeroPercent

float ElectrochemicalGasSensor::internalZeroPercent
private

◆ lmp

LMP91000* ElectrochemicalGasSensor::lmp
private

◆ tiaGainInKOHms

float ElectrochemicalGasSensor::tiaGainInKOHms
private

◆ type

sensorType ElectrochemicalGasSensor::type
private

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