RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
RumPi::GasSensor Class Reference

Base class for the MQ-series gas sensors (MQ2, MQ7, ...). More...

#include <GasSensor.h>

Inheritance diagram for RumPi::GasSensor:
[legend]
Collaboration diagram for RumPi::GasSensor:
[legend]

Public Member Functions

virtual void CalculateInitialR0 ()
 Calibrates the sensor: computes and stores its clean-air resistance (R0). More...
 
 GasSensor ()
 Builds a default gas sensor with zeroed calibration values and no ADC or digital pin. More...
 
 GasSensor (IAnalogDigitalConverterComponent *analogToDigitalConverter, const EComponentType &gasSensorType, const unsigned int &analogToDigitalConverterIndex, const unsigned int &digitalOutputPinNumber)
 Builds an analog gas sensor that reads through an ADC and also exposes a digital threshold pin. More...
 
 GasSensor (IAnalogDigitalConverterComponent *analogToDigitalConverter, const EComponentType &gasSensorType, const unsigned int &analogToDigitalConverterIndex)
 Builds an analog-only gas sensor that reads through an ADC (no digital threshold pin). More...
 
 GasSensor (const EComponentType &gasSensorType, const unsigned int &digitalOutputPinNumber)
 Builds a digital-only gas sensor that reports only its threshold-output pin (no ADC). More...
 
virtual ~GasSensor ()
 Destroys the gas sensor, turning it off first. More...
 
virtual void TurnOn ()
 Turns the sensor on. More...
 
virtual void TurnOff ()
 Turns the sensor off. More...
 
virtual void Initialize ()
 Initializes the sensor's datasheet values. More...
 
int ReadRawAnalogValue () const
 Reads the raw analog value from the sensor's ADC channel. More...
 
int ReadDigitalValue ()
 Reads the sensor's digital threshold-output pin (1 when the configured gas threshold is exceeded). More...
 
virtual double ReadGasValue () const
 Gets the most recently processed gas value. More...
 
virtual void ProcessRawValues () override
 Reads the sensor and computes the current gas value (PPM) from the RS/R0 ratio using the datasheet's log-log curve. More...
 
virtual std::string ToString () const override
 Serializes the sensor's current gas value (PPM), a rough percentage, and the raw reading to a string. More...
 
unsigned int GetAnalogToDigitalConverterIndex () const
 Gets the ADC channel index this sensor reads from. More...
 
unsigned int GetDigitalOutputPinNumber () const
 Gets the digital threshold-output pin (UINT_MAX if unused). More...
 
double GetInitialValueR0 () const
 Gets the sensor's clean-air resistance (R0) from calibration. More...
 
double GetResistorValueRL () const
 Gets the load resistor value (RL) from the sensor's datasheet. More...
 
double GetCurrentValueRS () const
 Gets the sensor's current resistance (RS). More...
 
const char * GetDetectibleConcentration () const
 Gets a human-readable detectable-concentration range for this sensor. More...
 
EComponentType GetGasSensorType () const
 Gets this sensor's component type (which MQ sensor it is). More...
 
const char * GetGasSensorTypeAsString () const
 Gets this sensor's type as a display string (e.g. More...
 
const char * GetGasSensorTypeAsString (const EComponentType &gasSensorType) const
 Maps a gas-sensor component type to its display string (e.g. More...
 
IAnalogDigitalConverterComponentGetAnalogDigitalConverter () const
 Gets the ADC this sensor reads its analog value through. More...
 
const GasDataGetGasData () const
 Gets the per-gas curve data (slope/intercept and concentration points) for this sensor. More...
 
- Public Member Functions inherited from RumPi::BaseComponent
 BaseComponent ()
 Builds a base component with an unknown type and an empty name. More...
 
virtual ~BaseComponent ()
 Virtual destructor so deleting a component through a BaseComponent* also cleans up the concrete subclass. More...
 
virtual void TurnOn ()=0
 Turns the component on (e.g. More...
 
virtual void TurnOff ()=0
 Turns the component off. More...
 
virtual std::string ToString () const =0
 Serializes the component's current readings to a string (usually JSON). More...
 
virtual void ProcessRawValues ()=0
 Reads and processes the component's latest raw values (called once per poll). More...
 
virtual EComponentType GetComponentType () const
 Gets the component's type. More...
 
const std::string & GetName () const
 Gets the component's unique per-instance name. More...
 
void SetName (const std::string &name)
 Sets the component's unique per-instance name. More...
 

Static Public Attributes

static constexpr double GAS_SENSOR_VOLTAGE = 5.0
 The supply voltage the gas sensor runs on. More...
 
static const int CALIBRATION_SAMPLE_TIMES = 200
 The number of samples taken during the calibration phase. More...
 
static const int CALIBRATION_SAMPLE_INTERVAL = 250
 Milliseconds between samples during the calibration phase. More...
 
static const int READ_SAMPLE_INTERVAL = 250
 Milliseconds between samples during normal operation. More...
 

Protected Member Functions

virtual double CalculateR0 ()
 Samples the sensor many times in clean air, averages the reading, converts it to resistance (RS), and divides by the clean-air factor to get R0. More...
 
virtual double CalculateRS (const double &sensorValueInVolts) const
 Computes the sensor's resistance (RS) from its output voltage, using the load resistor RL and supply voltage. More...
 
virtual double CalculateRSR0Ratio (const double &sensorValueInVolts) const
 Computes the RS/R0 ratio (used to look up PPM on the datasheet curve) from the sensor's output voltage. More...
 
double ConvertRawSensorValueToVolts (const double &rawGasSensorValue) const
 Converts a raw analog reading to its equivalent voltage (using the sensor's supply voltage and the ADC's maximum value). More...
 
double ConvertVoltsToRawSensorValue (const double &volts) const
 Converts a voltage back to its equivalent raw analog value (the inverse of ConvertRawSensorValueToVolts). More...
 
double GetAnalogToDigitalConverterMaxRawValue () const
 Gets the ADC's full-scale raw count for scaling raw readings to volts (PCF8591 = 255 8-bit, MCP3008 = 1023 10-bit), falling back to the 10-bit convention when no ADC is wired. More...
 
double GetAnalogToDigitalConverterVoltage () const
 Gets the ADC's reference voltage for scaling raw readings to volts (defined by the wired ADC, e.g. More...
 

Protected Attributes

unsigned int myAnalogToDigitalConverterIndex
 The ADC channel index this sensor reads its analog value from. More...
 
unsigned int myDigitalOutputPinNumber
 The digital output (threshold) pin, or UINT_MAX if unused. More...
 
double myInitialValueR0
 The sensor's resistance in clean air (R0), from calibration. More...
 
double myResistorValueRL
 The load resistor value (RL) from the sensor's datasheet. More...
 
double myCurrentValueRS
 The sensor's current resistance (RS). More...
 
double myCleanAirFactor
 The clean-air factor (RS/R0 in clean air) from the datasheet. More...
 
double myRawGasSensorValue
 The most recent raw analog reading. More...
 
double myCurrentGasValue
 The most recent computed gas value (PPM). More...
 
const char * myDetectibleConcentration
 A human-readable detectable-concentration range for this sensor. More...
 
IAnalogDigitalConverterComponentmyAnalogToDigitalConverter
 The ADC this sensor reads its analog value through. More...
 
GasData myGasData
 Per-gas curve data (slope/intercept) used to convert the RS/R0 ratio to PPM. More...
 
- Protected Attributes inherited from RumPi::BaseComponent
EComponentType myComponentType
 The kind of component this is (set by each concrete subclass). More...
 
std::string myName
 A unique per-instance name, assigned when the component is added to the manager. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from RumPi::BaseComponent
static std::string ComponentTypeToString (const EComponentType theComponentTypeToConvert)
 Maps an EComponentType to its string name. More...
 
static EComponentType StringToComponentType (const std::string &theComponentTypeName)
 Maps a type name back to its EComponentType (the inverse of ComponentTypeToString), so the client can turn the type carried on the wire back into a value it can look an icon up with. More...
 

Detailed Description

Base class for the MQ-series gas sensors (MQ2, MQ7, ...).

An MQ sensor's value only reflects the approximate trend of gas concentration within a permissible error range - it does NOT represent an exact concentration. The R0/RL/RS/CleanAirFactor references come from the various MQ-X datasheets (https://www.mysensors.org/build/gas/).

Author
Eddie O'Hagan
Date
8/13/2026

Constructor & Destructor Documentation

◆ GasSensor() [1/4]

RumPi::GasSensor::GasSensor ( )

Builds a default gas sensor with zeroed calibration values and no ADC or digital pin.

Subclasses (e.g. MQ2) fill in their datasheet values via Initialize().

Author
Eddie O'Hagan
Date
8/13/2026
//Called by a subclass's default constructor, e.g. MQ2().

◆ GasSensor() [2/4]

RumPi::GasSensor::GasSensor ( IAnalogDigitalConverterComponent analogToDigitalConverter,
const EComponentType gasSensorType,
const unsigned int &  analogToDigitalConverterIndex,
const unsigned int &  digitalOutputPinNumber 
)

Builds an analog gas sensor that reads through an ADC and also exposes a digital threshold pin.

Author
Eddie O'Hagan
Date
8/13/2026
//Called by a subclass, e.g. MQ2(adc, index, digitalPin).
Parameters
[in]analogToDigitalConverterThe ADC the sensor reads its analog value through.
[in]gasSensorTypeThe concrete sensor type (e.g. E_MQ2).
[in]analogToDigitalConverterIndexThe ADC channel index to read.
[in]digitalOutputPinNumberThe digital threshold-output pin.

◆ GasSensor() [3/4]

RumPi::GasSensor::GasSensor ( IAnalogDigitalConverterComponent analogToDigitalConverter,
const EComponentType gasSensorType,
const unsigned int &  analogToDigitalConverterIndex 
)

Builds an analog-only gas sensor that reads through an ADC (no digital threshold pin).

Author
Eddie O'Hagan
Date
8/13/2026
//Called by a subclass, e.g. MQ2(adc, index).
Parameters
[in]analogToDigitalConverterThe ADC the sensor reads its analog value through.
[in]gasSensorTypeThe concrete sensor type (e.g. E_MQ2).
[in]analogToDigitalConverterIndexThe ADC channel index to read.

◆ GasSensor() [4/4]

RumPi::GasSensor::GasSensor ( const EComponentType gasSensorType,
const unsigned int &  digitalOutputPinNumber 
)

Builds a digital-only gas sensor that reports only its threshold-output pin (no ADC).

Author
Eddie O'Hagan
Date
8/13/2026
//Called by a subclass, e.g. MQ2(digitalPin).
Parameters
[in]gasSensorTypeThe concrete sensor type (e.g. E_MQ2).
[in]digitalOutputPinNumberThe digital threshold-output pin.

◆ ~GasSensor()

RumPi::GasSensor::~GasSensor ( )
virtual

Destroys the gas sensor, turning it off first.

Author
Eddie O'Hagan
Date
8/13/2026
GasSensor* sensor = new MQ2();
delete sensor;
GasSensor()
Builds a default gas sensor with zeroed calibration values and no ADC or digital pin.
Definition: GasSensor.cpp:17

Member Function Documentation

◆ CalculateInitialR0()

void RumPi::GasSensor::CalculateInitialR0 ( )
virtual

Calibrates the sensor: computes and stores its clean-air resistance (R0).

Run this once in clean air before reading, so the RS/R0 ratio has a valid baseline. Public so callers can (re)calibrate after warm-up.

Author
Eddie O'Hagan
Date
8/13/2026
sensor.CalculateInitialR0(); //call once in clean air to calibrate.

Run this in clean air.

Author
Eddie O'Hagan
Date
8/13/2026
sensor.CalculateInitialR0(); //call once in clean air to calibrate.

◆ CalculateR0()

double RumPi::GasSensor::CalculateR0 ( )
protectedvirtual

Samples the sensor many times in clean air, averages the reading, converts it to resistance (RS), and divides by the clean-air factor to get R0.

Author
Eddie O'Hagan
Date
8/13/2026
double r0 = sensor.CalculateR0();
Returns
The computed clean-air resistance (R0).

Reimplemented in RumPi::MQ135.

◆ CalculateRS()

double RumPi::GasSensor::CalculateRS ( const double &  sensorValueInVolts) const
protectedvirtual

Computes the sensor's resistance (RS) from its output voltage, using the load resistor RL and supply voltage.

Author
Eddie O'Hagan
Date
8/13/2026
double rs = sensor.CalculateRS(sensorValueInVolts);
Parameters
[in]sensorValueInVoltsThe sensor's output voltage.
Returns
The sensor resistance (RS).

◆ CalculateRSR0Ratio()

double RumPi::GasSensor::CalculateRSR0Ratio ( const double &  sensorValueInVolts) const
protectedvirtual

Computes the RS/R0 ratio (used to look up PPM on the datasheet curve) from the sensor's output voltage.

Author
Eddie O'Hagan
Date
8/13/2026
double ratio = sensor.CalculateRSR0Ratio(sensorValueInVolts);
Parameters
[in]sensorValueInVoltsThe sensor's output voltage.
Returns
The RS/R0 ratio.

◆ ConvertRawSensorValueToVolts()

double RumPi::GasSensor::ConvertRawSensorValueToVolts ( const double &  rawGasSensorValue) const
protected

Converts a raw analog reading to its equivalent voltage (using the sensor's supply voltage and the ADC's maximum value).

Converts a raw analog reading to its equivalent voltage (using the ADC's reference voltage and the ADC's maximum value).

Author
Eddie O'Hagan
Date
8/13/2026
double volts = sensor.ConvertRawSensorValueToVolts(rawValue);
Parameters
[in]rawGasSensorValueThe raw analog reading.
Returns
The equivalent voltage.

◆ ConvertVoltsToRawSensorValue()

double RumPi::GasSensor::ConvertVoltsToRawSensorValue ( const double &  volts) const
protected

Converts a voltage back to its equivalent raw analog value (the inverse of ConvertRawSensorValueToVolts).

Author
Eddie O'Hagan
Date
8/13/2026
double raw = sensor.ConvertVoltsToRawSensorValue(volts);
Parameters
[in]voltsThe voltage to convert.
Returns
The equivalent raw analog value.

◆ GetAnalogDigitalConverter()

IAnalogDigitalConverterComponent * RumPi::GasSensor::GetAnalogDigitalConverter ( ) const

Gets the ADC this sensor reads its analog value through.

Author
Eddie O'Hagan
Date
8/13/2026
IAnalogDigitalConverterComponent* adc = sensor.GetAnalogDigitalConverter();
Returns
The sensor's ADC (may be nullptr for a digital-only sensor).

◆ GetAnalogToDigitalConverterIndex()

unsigned int RumPi::GasSensor::GetAnalogToDigitalConverterIndex ( ) const

Gets the ADC channel index this sensor reads from.

Author
Eddie O'Hagan
Date
8/13/2026
unsigned int channel = sensor.GetAnalogToDigitalConverterIndex();
Returns
The ADC channel index.

◆ GetAnalogToDigitalConverterMaxRawValue()

double RumPi::GasSensor::GetAnalogToDigitalConverterMaxRawValue ( ) const
protected

Gets the ADC's full-scale raw count for scaling raw readings to volts (PCF8591 = 255 8-bit, MCP3008 = 1023 10-bit), falling back to the 10-bit convention when no ADC is wired.

Author
Eddie O'Hagan
Date
8/13/2026
double fullScale = sensor.GetAnalogToDigitalConverterMaxRawValue();
Returns
The ADC's full-scale raw count, or GasData::MAX_ANALOG_VALUE if no ADC is set.

◆ GetAnalogToDigitalConverterVoltage()

double RumPi::GasSensor::GetAnalogToDigitalConverterVoltage ( ) const
protected

Gets the ADC's reference voltage for scaling raw readings to volts (defined by the wired ADC, e.g.

Gets the ADC's reference voltage for scaling raw readings to volts, falling back to the gas sensor's supply voltage when no ADC is wired.

the PCF8591's configured "adcVoltage"), falling back to the gas sensor's supply voltage when no ADC is wired.

Author
Eddie O'Hagan
Date
8/13/2026
double vref = sensor.GetAnalogToDigitalConverterVoltage();
Returns
The ADC's reference voltage, or the gas sensor's supply voltage if no ADC is set.
Author
Eddie O'Hagan
Date
8/13/2026
double vref = sensor.GetAnalogToDigitalConverterVoltage();
Returns
The ADC's reference voltage, or the gas sensor's supply voltage if no ADC is set.

◆ GetCurrentValueRS()

double RumPi::GasSensor::GetCurrentValueRS ( ) const

Gets the sensor's current resistance (RS).

Author
Eddie O'Hagan
Date
8/13/2026
double rs = sensor.GetCurrentValueRS();
Returns
The RS value.

◆ GetDetectibleConcentration()

const char * RumPi::GasSensor::GetDetectibleConcentration ( ) const

Gets a human-readable detectable-concentration range for this sensor.

Author
Eddie O'Hagan
Date
8/13/2026
const char* range = sensor.GetDetectibleConcentration();
Returns
The detectable-concentration range string.

◆ GetDigitalOutputPinNumber()

unsigned int RumPi::GasSensor::GetDigitalOutputPinNumber ( ) const

Gets the digital threshold-output pin (UINT_MAX if unused).

Author
Eddie O'Hagan
Date
8/13/2026
unsigned int pin = sensor.GetDigitalOutputPinNumber();
Returns
The digital output pin number.

◆ GetGasData()

const GasData & RumPi::GasSensor::GetGasData ( ) const

Gets the per-gas curve data (slope/intercept and concentration points) for this sensor.

Author
Eddie O'Hagan
Date
8/13/2026
GasData data = sensor.GetGasData();
Returns
The sensor's gas curve data.

◆ GetGasSensorType()

EComponentType RumPi::GasSensor::GetGasSensorType ( ) const

Gets this sensor's component type (which MQ sensor it is).

Author
Eddie O'Hagan
Date
8/13/2026
EComponentType type = sensor.GetGasSensorType();
EComponentType
Identifies each kind of component the library supports.
Definition: BaseComponent.h:14
Returns
The sensor's component type.

◆ GetGasSensorTypeAsString() [1/2]

const char * RumPi::GasSensor::GetGasSensorTypeAsString ( ) const

Gets this sensor's type as a display string (e.g.

"MQ-2").

Author
Eddie O'Hagan
Date
8/13/2026
const char* name = sensor.GetGasSensorTypeAsString();
Returns
The sensor's type as a string.

◆ GetGasSensorTypeAsString() [2/2]

const char * RumPi::GasSensor::GetGasSensorTypeAsString ( const EComponentType gasSensorType) const

Maps a gas-sensor component type to its display string (e.g.

E_MQ2 -> "MQ-2").

Author
Eddie O'Hagan
Date
8/13/2026
const char* name = sensor.GetGasSensorTypeAsString(EComponentType::E_MQ7); //"MQ-7"
Parameters
[in]gasSensorTypeThe gas-sensor type to convert.
Returns
The type's display string, or "UNKNOWN" if it is not a gas sensor.

◆ GetInitialValueR0()

double RumPi::GasSensor::GetInitialValueR0 ( ) const

Gets the sensor's clean-air resistance (R0) from calibration.

Author
Eddie O'Hagan
Date
8/13/2026
double r0 = sensor.GetInitialValueR0();
Returns
The R0 value.

◆ GetResistorValueRL()

double RumPi::GasSensor::GetResistorValueRL ( ) const

Gets the load resistor value (RL) from the sensor's datasheet.

Author
Eddie O'Hagan
Date
8/13/2026
double rl = sensor.GetResistorValueRL();
Returns
The RL value.

◆ Initialize()

void RumPi::GasSensor::Initialize ( )
virtual

Initializes the sensor's datasheet values.

The base does nothing; each MQ subclass overrides this to set its RL, clean-air factor, detectable concentration, and gas curve.

Author
Eddie O'Hagan
Date
8/13/2026
//Overridden by subclasses, e.g. MQ2::Initialize().

Reimplemented in RumPi::MQ135, RumPi::MQ2, RumPi::MQ3, RumPi::MQ4, RumPi::MQ5, RumPi::MQ6, RumPi::MQ7, RumPi::MQ8, and RumPi::MQ9.

◆ ProcessRawValues()

void RumPi::GasSensor::ProcessRawValues ( )
overridevirtual

Reads the sensor and computes the current gas value (PPM) from the RS/R0 ratio using the datasheet's log-log curve.

Warns and reports zero if the gas curve slope is zero (which would divide by zero).

Author
Eddie O'Hagan
Date
8/13/2026
sensor.ProcessRawValues(); //call each poll to refresh the gas value.

Implements RumPi::BaseComponent.

◆ ReadDigitalValue()

int RumPi::GasSensor::ReadDigitalValue ( )

Reads the sensor's digital threshold-output pin (1 when the configured gas threshold is exceeded).

Author
Eddie O'Hagan
Date
8/13/2026
int triggered = sensor.ReadDigitalValue();
Returns
The digital pin reading.

◆ ReadGasValue()

double RumPi::GasSensor::ReadGasValue ( ) const
virtual

Gets the most recently processed gas value.

MQ subclasses may override this to compute a gas-specific value.

Author
Eddie O'Hagan
Date
8/13/2026
double ppm = sensor.ReadGasValue();
Returns
The current gas value (PPM).

Reimplemented in RumPi::MQ135, RumPi::MQ3, RumPi::MQ4, RumPi::MQ5, RumPi::MQ6, RumPi::MQ7, RumPi::MQ8, and RumPi::MQ9.

◆ ReadRawAnalogValue()

int RumPi::GasSensor::ReadRawAnalogValue ( ) const

Reads the raw analog value from the sensor's ADC channel.

Author
Eddie O'Hagan
Date
8/13/2026
int raw = sensor.ReadRawAnalogValue();
Returns
The raw analog reading, or -1 if the sensor has no ADC.

◆ ToString()

std::string RumPi::GasSensor::ToString ( ) const
overridevirtual

Serializes the sensor's current gas value (PPM), a rough percentage, and the raw reading to a string.

Author
Eddie O'Hagan
Date
8/13/2026
std::string data = sensor.ToString();
Returns
A string describing the sensor's current reading.

Implements RumPi::BaseComponent.

Reimplemented in RumPi::MQ135, RumPi::MQ3, RumPi::MQ4, RumPi::MQ5, RumPi::MQ6, RumPi::MQ7, RumPi::MQ8, and RumPi::MQ9.

◆ TurnOff()

void RumPi::GasSensor::TurnOff ( )
virtual

Turns the sensor off.

No active teardown is needed, so this is a no-op.

Author
Eddie O'Hagan
Date
8/13/2026
sensor.TurnOff();

Implements RumPi::BaseComponent.

◆ TurnOn()

void RumPi::GasSensor::TurnOn ( )
virtual

Turns the sensor on.

If a digital threshold pin is configured, sets it as an input.

Author
Eddie O'Hagan
Date
8/13/2026
sensor.TurnOn();

Implements RumPi::BaseComponent.

Member Data Documentation

◆ CALIBRATION_SAMPLE_INTERVAL

const int RumPi::GasSensor::CALIBRATION_SAMPLE_INTERVAL = 250
static

Milliseconds between samples during the calibration phase.

◆ CALIBRATION_SAMPLE_TIMES

const int RumPi::GasSensor::CALIBRATION_SAMPLE_TIMES = 200
static

The number of samples taken during the calibration phase.

◆ GAS_SENSOR_VOLTAGE

constexpr double RumPi::GasSensor::GAS_SENSOR_VOLTAGE = 5.0
staticconstexpr

The supply voltage the gas sensor runs on.

◆ myAnalogToDigitalConverter

IAnalogDigitalConverterComponent* RumPi::GasSensor::myAnalogToDigitalConverter
protected

The ADC this sensor reads its analog value through.

◆ myAnalogToDigitalConverterIndex

unsigned int RumPi::GasSensor::myAnalogToDigitalConverterIndex
protected

The ADC channel index this sensor reads its analog value from.

◆ myCleanAirFactor

double RumPi::GasSensor::myCleanAirFactor
protected

The clean-air factor (RS/R0 in clean air) from the datasheet.

◆ myCurrentGasValue

double RumPi::GasSensor::myCurrentGasValue
protected

The most recent computed gas value (PPM).

◆ myCurrentValueRS

double RumPi::GasSensor::myCurrentValueRS
protected

The sensor's current resistance (RS).

◆ myDetectibleConcentration

const char* RumPi::GasSensor::myDetectibleConcentration
protected

A human-readable detectable-concentration range for this sensor.

◆ myDigitalOutputPinNumber

unsigned int RumPi::GasSensor::myDigitalOutputPinNumber
protected

The digital output (threshold) pin, or UINT_MAX if unused.

◆ myGasData

GasData RumPi::GasSensor::myGasData
protected

Per-gas curve data (slope/intercept) used to convert the RS/R0 ratio to PPM.

◆ myInitialValueR0

double RumPi::GasSensor::myInitialValueR0
protected

The sensor's resistance in clean air (R0), from calibration.

◆ myRawGasSensorValue

double RumPi::GasSensor::myRawGasSensorValue
protected

The most recent raw analog reading.

◆ myResistorValueRL

double RumPi::GasSensor::myResistorValueRL
protected

The load resistor value (RL) from the sensor's datasheet.

◆ READ_SAMPLE_INTERVAL

const int RumPi::GasSensor::READ_SAMPLE_INTERVAL = 250
static

Milliseconds between samples during normal operation.


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