diff --git a/examples/MQ-131/MQ-131.ino b/examples/MQ-131/MQ-131.ino index 0705917..f99378a 100644 --- a/examples/MQ-131/MQ-131.ino +++ b/examples/MQ-131/MQ-131.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-131" //MQ131 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ131CleanAir 15 //RS / R0 = 15 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -47,8 +48,28 @@ void setup() { O3 | 23.943 | -1.11 */ - // Calibration setup - MQ131.setR0(385.40); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ131.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ131.calibrate(RatioMQ131CleanAir); + Serial.print("."); + } + MQ131.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-135/MQ-135.ino b/examples/MQ-135/MQ-135.ino index ee2ba02..22721b6 100644 --- a/examples/MQ-135/MQ-135.ino +++ b/examples/MQ-135/MQ-135.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-135" //MQ135 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ135CleanAir 3.6//RS / R0 = 3.6 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -50,8 +51,28 @@ void setup() { Acetona | 34.668 | -3.369 */ - // Calibration setup - MQ135.setR0(76.63); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ135.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ135.calibrate(RatioMQ135CleanAir); + Serial.print("."); + } + MQ135.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-2/MQ-2.ino b/examples/MQ-2/MQ-2.ino index 2cff3ea..7bd9276 100644 --- a/examples/MQ-2/MQ-2.ino +++ b/examples/MQ-2/MQ-2.ino @@ -26,7 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-2" //MQ2 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO -//#define calibration_button 13 //Pin to calibrate your sensor +#define RatioMQ2CleanAir 9.83 //RS / R0 = 9.83 ppm //Declare Sensor MQUnifiedsensor MQ2(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type); @@ -48,9 +48,27 @@ void setup() { Propane| 658.71 | -2.168 */ - // Calibration setup - MQ2.setR0(9.659574468); - + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ2.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ2.calibrate(RatioMQ2CleanAir); + Serial.print("."); + } + MQ2.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: MQ2.setRL(10); diff --git a/examples/MQ-3/MQ-3.ino b/examples/MQ-3/MQ-3.ino index 1eedbad..58ddea2 100644 --- a/examples/MQ-3/MQ-3.ino +++ b/examples/MQ-3/MQ-3.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-3" //MQ3 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ3CleanAir 60 //RS / R0 = 60 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -49,8 +50,28 @@ void setup() { Hexane | 7585.3 | -2.849 */ - // Calibration setup - MQ3.setR0(3.86018237); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; 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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-303A/MQ303.ino b/examples/MQ-303A/MQ303.ino index fc1657e..fe96e03 100644 --- a/examples/MQ-303A/MQ303.ino +++ b/examples/MQ-303A/MQ303.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-303" //MQ303 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ303CleanAir 1 //RS / R0 = 1 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -47,8 +48,28 @@ void setup() { Ethanol | 3.4916 | -2.432 */ - // Calibration setup - MQ303.setR0(10); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ303.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ303.calibrate(RatioMQ303CleanAir); + Serial.print("."); + } + MQ303.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-309A/MQ-309.ino b/examples/MQ-309A/MQ-309.ino index e5588de..951b2af 100644 --- a/examples/MQ-309A/MQ-309.ino +++ b/examples/MQ-309A/MQ-309.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-309" //MQ309 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ309CleanAir 11 //RS / R0 = 11 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -48,8 +49,28 @@ void setup() { ALCOHOL | 473622 | -3.647 */ - // Calibration setup - MQ309.setR0(10); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ309.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ309.calibrate(RatioMQ309CleanAir); + Serial.print("."); + } + MQ309.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-4/MQ-4.ino b/examples/MQ-4/MQ-4.ino index 727a880..51000ca 100644 --- a/examples/MQ-4/MQ-4.ino +++ b/examples/MQ-4/MQ-4.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-4" //MQ4 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ4CleanAir 4.4 //RS / R0 = 4.4 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -49,8 +50,28 @@ void setup() { */ - // Calibration setup - MQ4.setR0(3.86018237); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ4.calibrate(RatioMQ4CleanAir); + Serial.print("."); + } + MQ4.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-5/MQ-5.ino b/examples/MQ-5/MQ-5.ino index dd1106a..d0b7c13 100644 --- a/examples/MQ-5/MQ-5.ino +++ b/examples/MQ-5/MQ-5.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-5" //MQ5 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ5CleanAir 6.5 //RS / R0 = 6.5 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -48,8 +49,28 @@ void setup() { Alcohol| 97124 | -4.918 */ - // Calibration setup - MQ5.setR0(71.100304); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ5.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ5.calibrate(RatioMQ5CleanAir); + Serial.print("."); + } + MQ5.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-6/MQ-6.ino b/examples/MQ-6/MQ-6.ino index d2e9389..6302464 100644 --- a/examples/MQ-6/MQ-6.ino +++ b/examples/MQ-6/MQ-6.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-6" //MQ6 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ6CleanAir 10 //RS / R0 = 10 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -48,9 +49,28 @@ void setup() { Alcohol | 50000000 | -6.017 */ - // Calibration setup - MQ6.setR0(13.4285714); - + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ6.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ6.calibrate(RatioMQ6CleanAir); + Serial.print("."); + } + MQ6.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: MQ6.setRL(10); diff --git a/examples/MQ-7/MQ-7.ino b/examples/MQ-7/MQ-7.ino index 6c86340..6bc96e1 100644 --- a/examples/MQ-7/MQ-7.ino +++ b/examples/MQ-7/MQ-7.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-7" //MQ7 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ7CleanAir 27.5 //RS / R0 = 27.5 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -49,8 +50,28 @@ void setup() { Alcohol | 40000000000000000 | -12.35 */ - // Calibration setup - MQ7.setR0(4); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ7.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ7.calibrate(RatioMQ7CleanAir); + Serial.print("."); + } + MQ7.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: diff --git a/examples/MQ-8/MQ-8.ino b/examples/MQ-8/MQ-8.ino index f559a5b..383a06d 100644 --- a/examples/MQ-8/MQ-8.ino +++ b/examples/MQ-8/MQ-8.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-8" //MQ8 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ8CleanAir 70 //RS / R0 = 70 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -49,9 +50,28 @@ void setup() { Alcohol | 76101 | -1.86 */ - // Calibration setup - MQ8.setR0(1); + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ8.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ8.calibrate(RatioMQ8CleanAir); + Serial.print("."); + } + MQ8.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: MQ8.setRL(10); diff --git a/examples/MQ-9/MQ-9.ino b/examples/MQ-9/MQ-9.ino index 8cd5926..276d6bc 100644 --- a/examples/MQ-9/MQ-9.ino +++ b/examples/MQ-9/MQ-9.ino @@ -26,6 +26,7 @@ #define pin A0 //Analog input 0 of your arduino #define type "MQ-9" //MQ9 #define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO +#define RatioMQ9CleanAir 9.6 //RS / R0 = 9.6 ppm //#define calibration_button 13 //Pin to calibrate your sensor //Declare Sensor @@ -47,8 +48,28 @@ void setup() { CO | 599.65 | -2.244 */ - // Calibration setup - MQ9.setR0(9.42857143); + + /***************************** 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."); + int calcR0 = 0; + for(int i = 0; i<=10; i ++) + { + MQ9.update(); // Update data, the arduino will be read the voltage on the analog pin + calcR0 += MQ9.calibrate(RatioMQ9CleanAir); + Serial.print("."); + } + MQ9.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 ********************************************/ /* //If the RL value is different from 10K please assign your RL value with the following method: