Fixed issue on calibratioN

This commit is contained in:
miguel5612 2020-03-30 19:17:25 -05:00
parent 9cbc753758
commit 9497574e11
22 changed files with 191 additions and 293 deletions

View File

@ -54,18 +54,35 @@ void setup() {
Hexane | 7585.3 | -2.849
*/
// Calibration setup
MQ3.setR0(3.86018237);
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
MQ3.init();
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
// and now is on clean air (Calibration conditions), and it will setup R0 value.
// We recomend execute this routine only on setup or on the laboratory and save on the eeprom of your arduino
// This routine not need to execute to every restart, you can load your R0 if you know the value
// Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor
Serial.print("Calibrating please wait.");
float calcR0 = 0;
for(int i = 1; i<=10; i ++)
{
MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin
calcR0 += MQ3.calibrate(RatioMQ3CleanAir);
Serial.print(".");
}
MQ3.setR0(calcR0/10);
Serial.println(" done!.");
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
}
void loop() {

View File

@ -48,6 +48,10 @@ void setup() {
Serial.begin(115200);
MQ2.setRegressionMethod(1); //_PPM = a*ratio^b
MQ2.setA(574.25); MQ2.setB(-2.222); // Configurate the ecuation values to get LPG concentration
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
//init the sensor
MQ2.init();
//Print in serial monitor

View File

@ -52,6 +52,10 @@ void setup() {
Hexane | 7585.3 | -2.849
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
// Calibration setup
MQ3.setR0(3.86018237);
@ -59,16 +63,27 @@ void setup() {
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
// and now is on clean air (Calibration conditions), and it will setup R0 value.
// We recomend execute this routine only on setup or on the laboratory and save on the eeprom of your arduino
// This routine not need to execute to every restart, you can load your R0 if you know the value
// Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor
Serial.print("Calibrating please wait.");
float calcR0 = 0;
for(int i = 1; i<=10; i ++)
{
MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin
calcR0 += MQ3.calibrate(RatioMQ3CleanAir);
Serial.print(".");
}
MQ3.setR0(calcR0/10);
Serial.println(" done!.");
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
MQ3.serialDebug(true);
}

View File

@ -52,7 +52,15 @@ void setup() {
O3 | 23.943 | -1.11
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ131.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ131.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -74,21 +82,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ131.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ131.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ131.serialDebug(true);
}

View File

@ -43,7 +43,14 @@ void setup() {
//Set math model to calculate the PPM concentration and the value of constants
MQ135.setRegressionMethod(1); //_PPM = a*ratio^b
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ135.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ135.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -65,19 +72,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ135.setRL(10);
*/
MQ135.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
Serial.println("** Lectures from MQ-135 ****");
Serial.println("| CO | Alcohol | CO2 | Tolueno | NH4 | Acteona |");
}

View File

@ -54,8 +54,15 @@ void setup() {
NH4 | 102.2 | -2.473
Acetona | 34.668 | -3.369
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ135.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ135.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -77,21 +84,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ135.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ135.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ135.serialDebug(true);
}

View File

@ -52,6 +52,14 @@ void setup() {
Propane| 658.71 | -2.168
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ2.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ2.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -73,20 +81,7 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ2.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ2.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ2.serialDebug(true);
}

View File

@ -53,7 +53,15 @@ void setup() {
Hexane | 7585.3 | -2.849
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -75,21 +83,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.serialDebug(true);
}

View File

@ -52,7 +52,14 @@ void setup() {
Ethanol | 3.4916 | -2.432
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ303.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ303.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -74,21 +81,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ303.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ303.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ303.serialDebug(true);
}

View File

@ -53,7 +53,14 @@ void setup() {
ALCOHOL | 473622 | -3.647
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ309.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ309.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -75,21 +82,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ309.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ309.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ309.serialDebug(true);
}

View File

@ -43,7 +43,14 @@ void setup() {
MQ4.setRegressionMethod(1); //_PPM = a*ratio^b
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -66,18 +73,6 @@ void setup() {
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
Serial.println("*************** Lectures from MQ-4 **********************");
Serial.println("| LPG | CH4 | CO | Alcohol | Smoke |");
}

View File

@ -42,8 +42,14 @@ void setup() {
//Set math model to calculate the PPM concentration and the value of constants
MQ4.setRegressionMethod(0); //_PPM = pow(10, (log10(ratio)-b)/a)
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -66,18 +72,6 @@ void setup() {
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
Serial.println("** Lectures from MQ-4**********");
Serial.println("| LPG |");
}

View File

@ -53,7 +53,14 @@ void setup() {
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -75,21 +82,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.serialDebug(true);
}

View File

@ -53,7 +53,14 @@ void setup() {
Alcohol| 97124 | -4.918
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ5.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ5.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -75,21 +82,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ5.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ5.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ5.serialDebug(true);
}

View File

@ -53,7 +53,14 @@ void setup() {
Alcohol | 50000000 | -6.017
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ6.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ6.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -75,20 +82,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ6.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ6.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ6.serialDebug(true);
}

View File

@ -54,7 +54,14 @@ void setup() {
Alcohol | 40000000000000000 | -12.35
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ7.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ7.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -76,21 +83,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ7.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ7.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ7.serialDebug(true);
}

View File

@ -54,7 +54,14 @@ void setup() {
Alcohol | 76101 | -1.86
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ8.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ8.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -76,20 +83,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ8.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ8.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ8.serialDebug(true);
}

View File

@ -43,6 +43,14 @@ void setup() {
MQ9.setRegressionMethod(1); //_PPM = a*ratio^b
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -64,19 +72,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
Serial.println("** Lectures from MQ-9 ****");
Serial.println("| LPG | CH4 | CO |");
}

View File

@ -50,8 +50,15 @@ void setup() {
CH4 | 4269.6 | -2.648
CO | 599.65 | -2.244
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -73,21 +80,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.serialDebug(true);
}

View File

@ -177,28 +177,6 @@ void loop() {
MQ7.update();
MQ8.update();
MQ9.update();
/*
//Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button)
{
float R0 = MQ2.calibrate();
MQ2.setR0(R0):
R0 = MQ3.calibrate();
MQ3.setR0(R0):
R0 = MQ4.calibrate();
MQ4.setR0(R0):
R0 = MQ5.calibrate();
MQ5.setR0(R0):
R0 = MQ6.calibrate();
MQ6.setR0(R0):
R0 = MQ7.calibrate();
MQ7.setR0(R0):
R0 = MQ8.calibrate();
MQ8.setR0(R0):
R0 = MQ9.calibrate();
MQ9.setR0(R0):
}
*/
//Read the sensor and print in serial port
float MQ2Lecture = MQ2.readSensor();
float MQ3Lecture = MQ3.readSensor();

View File

@ -18,6 +18,8 @@
Please take care, arduino A0 pin represent the analog input configured on #define pin - For this example this doesn't matter
You will connect your sensor to your external A2D Sensor
This example code is in the public domain.
Important:
1. Although it doesn't matter what pin you put in when initializing your MQ sensor function it is important that you don't
for any reason invoke the MQ.init() method because that method configures the selected pin as input and you may need it for
@ -27,10 +29,6 @@
3. You must ensure that when invoking the setADC(value) method the value you are passing is within the expected parameters,
for example if it is a 10-bit ADC converter, we expect a value between 0 and 2^10 = 1024
This example code is in the public domain.
*/
//Include the library
@ -67,6 +65,11 @@ void setup() {
*/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -90,11 +93,6 @@ void setup() {
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
MQ3.serialDebug(true);
}

View File

@ -51,7 +51,10 @@ void setup() {
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -73,12 +76,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
MQ4.serialDebug(true);
}