mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-07-04 03:11:03 +03:00
Compare commits
1 Commits
codex/modi
...
codex/actu
Author | SHA1 | Date | |
---|---|---|---|
144f480f6f |
@ -27,11 +27,11 @@
|
|||||||
#define Pin7 (A7) //Analog input 7 of your arduino
|
#define Pin7 (A7) //Analog input 7 of your arduino
|
||||||
#define Pin8 (A8) //Analog input 8 of your arduino
|
#define Pin8 (A8) //Analog input 8 of your arduino
|
||||||
#define Pin9 (A9) //Analog input 9 of your arduino
|
#define Pin9 (A9) //Analog input 9 of your arduino
|
||||||
#define Pin10 (A10) //Analog input 9 of your arduino
|
#define Pin10 (A10) //Analog input 10 of your arduino
|
||||||
#define Pin11 (A11) //Analog input 9 of your arduino
|
#define Pin11 (A11) //Analog input 11 of your arduino
|
||||||
#define Pin12 (A12) //Analog input 9 of your arduino
|
#define Pin12 (A12) //Analog input 12 of your arduino
|
||||||
#define Pin13 (A13) //Analog input 9 of your arduino
|
#define Pin13 (A13) //Analog input 13 of your arduino
|
||||||
#define Pin14 (A14) //Analog input 9 of your arduino
|
#define Pin14 (A14) //Analog input 14 of your arduino
|
||||||
#define PWMPin (5) // Pin connected to mosfet
|
#define PWMPin (5) // Pin connected to mosfet
|
||||||
/***********************Software Related Macros************************************/
|
/***********************Software Related Macros************************************/
|
||||||
#define RatioMQ2CleanAir (9.83) //RS / R0 = 9.83 ppm
|
#define RatioMQ2CleanAir (9.83) //RS / R0 = 9.83 ppm
|
||||||
|
@ -142,13 +142,10 @@ float MQUnifiedsensor::validateEcuation(float ratioInput)
|
|||||||
float MQUnifiedsensor::readSensor(bool isMQ303A, float correctionFactor, bool injected)
|
float MQUnifiedsensor::readSensor(bool isMQ303A, float correctionFactor, bool injected)
|
||||||
{
|
{
|
||||||
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
||||||
|
|
||||||
float voltRes = _VOLT_RESOLUTION; // preserve global resolution
|
|
||||||
if(isMQ303A) {
|
if(isMQ303A) {
|
||||||
voltRes = voltRes - 0.45; //Calculations for RS using mq303a sensor look wrong #42
|
_VOLT_RESOLUTION = _VOLT_RESOLUTION - 0.45; //Calculations for RS using mq303a sensor look wrong #42
|
||||||
}
|
}
|
||||||
_RS_Calc = ((voltRes*_RL)/_sensor_volt)-_RL; //Get value of RS in a gas
|
_RS_Calc = ((_VOLT_RESOLUTION*_RL)/_sensor_volt)-_RL; //Get value of RS in a gas
|
||||||
|
|
||||||
if(_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.
|
if(_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.
|
||||||
if(!injected) _ratio = _RS_Calc / this->_R0; // Get ratio RS_gas/RS_air
|
if(!injected) _ratio = _RS_Calc / this->_R0; // Get ratio RS_gas/RS_air
|
||||||
_ratio += correctionFactor;
|
_ratio += correctionFactor;
|
||||||
|
Reference in New Issue
Block a user