Compare commits

..

1 Commits

2 changed files with 7 additions and 10 deletions

View File

@ -27,11 +27,11 @@
#define Pin7 (A7) //Analog input 7 of your arduino
#define Pin8 (A8) //Analog input 8 of your arduino
#define Pin9 (A9) //Analog input 9 of your arduino
#define Pin10 (A10) //Analog input 9 of your arduino
#define Pin11 (A11) //Analog input 9 of your arduino
#define Pin12 (A12) //Analog input 9 of your arduino
#define Pin13 (A13) //Analog input 9 of your arduino
#define Pin14 (A14) //Analog input 9 of your arduino
#define Pin10 (A10) //Analog input 10 of your arduino
#define Pin11 (A11) //Analog input 11 of your arduino
#define Pin12 (A12) //Analog input 12 of your arduino
#define Pin13 (A13) //Analog input 13 of your arduino
#define Pin14 (A14) //Analog input 14 of your arduino
#define PWMPin (5) // Pin connected to mosfet
/***********************Software Related Macros************************************/
#define RatioMQ2CleanAir (9.83) //RS / R0 = 9.83 ppm

View File

@ -142,13 +142,10 @@ float MQUnifiedsensor::validateEcuation(float ratioInput)
float MQUnifiedsensor::readSensor(bool isMQ303A, float correctionFactor, bool injected)
{
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
float voltRes = _VOLT_RESOLUTION; // preserve global resolution
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(!injected) _ratio = _RS_Calc / this->_R0; // Get ratio RS_gas/RS_air
_ratio += correctionFactor;