25 static constexpr double PARA = 116.6020682;
26 static constexpr double PARB = 2.769034857;
30 static constexpr double CORA = 0.00035;
31 static constexpr double CORB = 0.02718;
32 static constexpr double CORC = 1.39538;
33 static constexpr double CORD = 0.0018;
34 static constexpr double CORE = -0.003333333;
35 static constexpr double CORF = -0.001923077;
36 static constexpr double CORG = 1.130128205;
108 MQ135(
const unsigned int& digitalOutputPinNumber);
275 std::string
ToString()
const override;
Base class for the MQ-series gas sensors (MQ2, MQ7, ...).
Definition: GasSensor.h:19
Interface for analog-to-digital converter components (e.g.
Definition: AnalogDigitalConverterComponent.h:14
MQ-135 gas sensor, typically used for detecting Carbon Dioxide (CO2) PPM.
Definition: MQ135.h:17
static constexpr double CORA
Definition: MQ135.h:30
void Initialize() override
Initializes the MQ-135's datasheet values, its default temperature/humidity, and the pre-computed atm...
Definition: MQ135.cpp:101
double CalculateCorrectedR0(double temperatureInC, double humidityPercent)
Gets the corrected resistance R0 of the sensor for calibration purposes, adjusted for temperature and...
Definition: MQ135.cpp:216
double CalculateResistance() const
Gets the resistance of the sensor (its measurement value).
Definition: MQ135.cpp:162
void SetCurrentHumidityPercent(double currentHumidityPercent)
Sets the relative humidity (percent) used to correct the sensor's readings.
Definition: MQ135.cpp:400
double CalculateCorrectedResistance(double temperatureInC, double humidityPercent) const
Gets the sensor's resistance with the measurement value corrected for temperature and humidity.
Definition: MQ135.cpp:270
double myCurrentTemperatureInC
The temperature (in Celsius) used to correct PPM readings for the sensor's temperature dependence.
Definition: MQ135.h:47
double CalculateCorrectionFactor(double temperatureInC, double humidityPercent) const
Gets the correction factor used to compensate the sensor's resistance for temperature and humidity.
Definition: MQ135.cpp:239
double CalculateR0() override
Gets the resistance R0 (RZero) of the sensor for calibration purposes.
Definition: MQ135.cpp:145
MQ135()
Builds a default MQ-135 (carbon dioxide) sensor and initializes its datasheet values.
Definition: MQ135.cpp:15
static constexpr double PARB
Definition: MQ135.h:26
virtual ~MQ135()
Destroys the sensor, turning it off first.
Definition: MQ135.cpp:85
static constexpr double CORG
Definition: MQ135.h:36
double GetCurrentHumidityPercent() const
Gets the relative humidity (percent) currently used to correct the sensor's readings.
Definition: MQ135.cpp:366
static constexpr double PARA
Definition: MQ135.h:25
static constexpr double CORB
Definition: MQ135.h:31
double CalculateCorrectedPPM(double temperatureInC, double humidityPercent) const
Gets the PPM of CO2 sensed (assuming only CO2 in the air), corrected for temperature and humidity.
Definition: MQ135.cpp:298
double ReadGasValue() const override
Reads the current CO2 PPM for the sensor's raw reading (assuming only CO2 in the air).
Definition: MQ135.cpp:128
static constexpr double CORE
Definition: MQ135.h:34
static constexpr double CORC
Definition: MQ135.h:32
double myAtmosphericCO2PPMConstant
Pre-calculated value that does not change; correlates CO2 and PPM based on the graph in the data shee...
Definition: MQ135.h:44
void SetCurrentTemperatureInC(double currentTemperatureInC)
Sets the temperature (in Celsius) used to correct the sensor's readings.
Definition: MQ135.cpp:383
static constexpr double CORF
Definition: MQ135.h:35
double CalculatePPM() const
Gets the PPM of CO2 sensed (assuming only CO2 in the air), from the sensor's resistance ratio.
Definition: MQ135.cpp:187
std::string ToString() const override
Serializes the MQ-135's gas name, raw reading, raw and corrected PPM, temperature,...
Definition: MQ135.cpp:323
double GetCurrentTemperatureInC() const
Gets the temperature (in Celsius) currently used to correct the sensor's readings.
Definition: MQ135.cpp:349
double myCurrentHumidityPercent
The relative humidity (percent) used to correct PPM readings for the sensor's humidity dependence.
Definition: MQ135.h:50
static constexpr double ATMOCO2
Definition: MQ135.h:41
static constexpr double CORD
Definition: MQ135.h:33
RumPi is the library's top-level facade.
Definition: AlertManager.h:6