From 07b6948f76d2f8dbfb6cbf40d1f01da45e3527fd Mon Sep 17 00:00:00 2001 From: miguel5612 Date: Sun, 20 Mar 2022 12:53:36 -0500 Subject: [PATCH] Updated and fixed typo examples --- README.md | 2 +- examples/Alcoholimeter/Alcoholimeter.ino | 22 +++++----- examples/Calibration/Calibration.ino | 2 +- .../ESP32/ESP32_WROOM_32D/ESP32_WROOM_32D.ino | 20 +++++----- examples/ESP32/esp32.ino | 20 +++++----- examples/ESP8266/ESP8266.ino | 20 +++++----- .../LinearVsExponential.ino | 24 +++++------ examples/MQ-131/MQ-131.ino | 22 +++++----- examples/MQ-135-ALL/MQ-135-ALL.ino | 12 +++--- .../MQ-135-CorrectionFactorDHT11.ino | 26 ++++++------ examples/MQ-135/MQ-135.ino | 26 ++++++------ examples/MQ-2/MQ-2.ino | 22 +++++----- examples/MQ-3/MQ-3.ino | 22 +++++----- examples/MQ-303A/MQ303.ino | 22 +++++----- examples/MQ-309A/MQ-309.ino | 26 ++++++------ examples/MQ-4-ALL/MQ-4-ALL.ino | 40 +++++++++---------- examples/MQ-4-LINEAR/MQ-4-LINEAR.ino | 22 +++++----- examples/MQ-4/MQ-4.ino | 22 +++++----- examples/MQ-5/MQ-5.ino | 22 +++++----- examples/MQ-6/MQ-6.ino | 22 +++++----- examples/MQ-7/MQ-7.ino | 26 ++++++------ examples/MQ-8/MQ-8.ino | 22 +++++----- examples/MQ-9-ALL/MQ-9-ALL.ino | 32 +++++++-------- examples/MQ-9/MQ-9.ino | 22 +++++----- examples/MQ-Board/MQ-Board.ino | 32 +++++++-------- examples/MQ135-ADS1115/MQ135-ADS1115.ino | 12 +++--- examples/external_A2D/external_A2D.ino | 22 +++++----- examples/smokeDetector/smokeDetector.ino | 20 +++++----- 28 files changed, 302 insertions(+), 302 deletions(-) diff --git a/README.md b/README.md index 1f95ca7..077b3ed 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ We present a unified library for MQ sensors, this library allows to read MQ sign MQUnifiedsensor MQ4(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type); // Setup MQ4.setRegressionMethod("Exponential"); //_PPM = a*ratio^b -MQ4.setA(1012.7); MQ4.setB(-2.786); // Configurate the ecuation values to get CH4 concentration +MQ4.setA(1012.7); MQ4.setB(-2.786); // Configure the equation to to calculate CH4 concentration MQ4.setR0(3.86018237); // Value getted on calibration // Loop MQ4.init(); diff --git a/examples/Alcoholimeter/Alcoholimeter.ino b/examples/Alcoholimeter/Alcoholimeter.ino index 84f5048..8d85c4b 100644 --- a/examples/Alcoholimeter/Alcoholimeter.ino +++ b/examples/Alcoholimeter/Alcoholimeter.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -42,7 +42,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ3.setRegressionMethod(1); //_PPM = a*ratio^b - MQ3.setA(0.3934); MQ3.setB(-1.504); // Configurate the ecuation values to get Alcohol concentration + MQ3.setA(0.3934); MQ3.setB(-1.504); //Configure the equation to calculate Alcohol concentration value /* Exponential regression: Gas | a | b @@ -64,30 +64,30 @@ void setup() { 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // 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 + MQ3.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ } void loop() { - MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin - alcoholPPM = MQ3.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ3.update(); // Update data, the arduino will read the voltage from the analog pin + alcoholPPM = MQ3.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup Serial.print("Alcohol now (PPM): "); Serial.println(alcoholPPM); delay(500); //Sampling frequency diff --git a/examples/Calibration/Calibration.ino b/examples/Calibration/Calibration.ino index 43a5185..a30a2dd 100644 --- a/examples/Calibration/Calibration.ino +++ b/examples/Calibration/Calibration.ino @@ -47,7 +47,7 @@ void setup() { //Init serial port 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 + MQ2.setA(574.25); MQ2.setB(-2.222); // Configure the equation to to calculate LPG concentration /* //If the RL value is different from 10K please assign your RL value with the following method: MQ3.setRL(10); diff --git a/examples/ESP32/ESP32_WROOM_32D/ESP32_WROOM_32D.ino b/examples/ESP32/ESP32_WROOM_32D/ESP32_WROOM_32D.ino index f157208..055b5f3 100644 --- a/examples/ESP32/ESP32_WROOM_32D/ESP32_WROOM_32D.ino +++ b/examples/ESP32/ESP32_WROOM_32D/ESP32_WROOM_32D.ino @@ -61,7 +61,7 @@ void setup() //Set math model to calculate the PPM concentration and the value of constants MQ2.setRegressionMethod(1); //_PPM = a*ratio^b - MQ2.setA(987.99); MQ2.setB(-2.162); // Configurate the ecuation values to get H2 concentration + MQ2.setA(987.99); MQ2.setB(-2.162); // Configure the equation to to calculate H2 concentration /* Exponential regression: @@ -84,24 +84,24 @@ void setup() */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ2.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ2.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ //MQ2.serialDebug(true); uncomment if you want to print the table on the serial port @@ -127,9 +127,9 @@ void setup() void loop() { - MQ2.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ2.update(); // Update data, the arduino will read the voltage from the analog pin //MQ2.serialDebug(); // Will print the table on the serial port - Serial.print(MQ2.readSensor()); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + Serial.print(MQ2.readSensor()); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup Serial.println(" PPM"); delay(500); //Sampling frequency } diff --git a/examples/ESP32/esp32.ino b/examples/ESP32/esp32.ino index 0aea8f0..8413a4c 100644 --- a/examples/ESP32/esp32.ino +++ b/examples/ESP32/esp32.ino @@ -40,7 +40,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ3.setRegressionMethod(1); //_PPM = a*ratio^b - MQ3.setA(4.8387); MQ3.setB(-2.68); // Configurate the ecuation values to get Benzene concentration + MQ3.setA(4.8387); MQ3.setB(-2.68); // Configure the equation to to calculate Benzene concentration /* Exponential regression: Gas | a | b @@ -63,31 +63,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // 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 + MQ3.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ3.serialDebug(true); } void loop() { - MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ3.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ3.update(); // Update data, the arduino will read the voltage from the analog pin + MQ3.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ3.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/ESP8266/ESP8266.ino b/examples/ESP8266/ESP8266.ino index b5ae8a6..586a262 100644 --- a/examples/ESP8266/ESP8266.ino +++ b/examples/ESP8266/ESP8266.ino @@ -40,7 +40,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ3.setRegressionMethod(1); //_PPM = a*ratio^b - MQ3.setA(4.8387); MQ3.setB(-2.68); // Configurate the ecuation values to get Benzene concentration + MQ3.setA(4.8387); MQ3.setB(-2.68); // Configure the equation to to calculate Benzene concentration /* Exponential regression: Gas | a | b @@ -63,31 +63,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // 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 + MQ3.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ3.serialDebug(true); } void loop() { - MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ3.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ3.update(); // Update data, the arduino will read the voltage from the analog pin + MQ3.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ3.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/LinearVsExponential/LinearVsExponential.ino b/examples/LinearVsExponential/LinearVsExponential.ino index dd1107e..60a7f71 100644 --- a/examples/LinearVsExponential/LinearVsExponential.ino +++ b/examples/LinearVsExponential/LinearVsExponential.ino @@ -43,24 +43,24 @@ void setup() { /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ /* @@ -75,23 +75,23 @@ void setup() { /************************************************************************************/ MQ4.init(); - Serial.println("** Lectures from MQ-4**********"); + Serial.println("** Values from MQ-4**********"); Serial.println("| LPG (Linear EQ) | LPG (Exponential EQ) |"); } void loop() { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from the analog pin //https://jayconsystems.com/blog/understanding-a-gas-sensor //Set math model to calculate the PPM concentration and the value of constants MQ4.setRegressionMethod(0); //_PPM = pow(10, (log10(ratio)-b)/a) MQ4.setA(-0.318); MQ4.setB(1.133); // A -> Slope, B -> Intersect with X - Axis - float LPG1 = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + float LPG1 = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup //Set math model to calculate the PPM concentration and the value of constants MQ4.setRegressionMethod(1); //_PPM = a*ratio^b - MQ4.setA(1012.7); MQ4.setB(-2.786); // Configurate the ecuation values to get CH4 concentration - float LPG2 = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ4.setA(1012.7); MQ4.setB(-2.786); // Configure the equation to to calculate CH4 concentration + float LPG2 = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup // exposure to 2000 ppm of LPG gas is immediately dangerous to life and health. In this section if(LPG1>=2000 || LPG2>=2000) Serial.println("Warning - Very high concentrations detected!"); diff --git a/examples/MQ-131/MQ-131.ino b/examples/MQ-131/MQ-131.ino index 636c1db..14f1d1f 100644 --- a/examples/MQ-131/MQ-131.ino +++ b/examples/MQ-131/MQ-131.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin Note: high concentration MQ-131 sensor. @@ -44,7 +44,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ131.setRegressionMethod(1); //_PPM = a*ratio^b - MQ131.setA(23.943); MQ131.setB(-1.11); // Configurate the ecuation values to get O3 concentration + MQ131.setA(23.943); MQ131.setB(-1.11); // Configure the equation to to calculate O3 concentration /* Exponential regression: @@ -65,32 +65,32 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ131.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ131.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ131.serialDebug(true); Serial.println("Ignore Ratio = RS/R0, for this example we will use readSensorR0Rs, the ratio calculated will be R0/Rs. Thanks :)"); } void loop() { - MQ131.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ131.readSensorR0Rs(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ131.update(); // Update data, the arduino will read the voltage from the analog pin + MQ131.readSensorR0Rs(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ131.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-135-ALL/MQ-135-ALL.ino b/examples/MQ-135-ALL/MQ-135-ALL.ino index 23e62df..44ad2ad 100644 --- a/examples/MQ-135-ALL/MQ-135-ALL.ino +++ b/examples/MQ-135-ALL/MQ-135-ALL.ino @@ -89,13 +89,13 @@ void loop() { float CO2 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.setA(44.947); MQ135.setB(-3.445); // Configure the equation to calculate Toluen concentration value - float Tolueno = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup + float Toluen = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.setA(102.2 ); MQ135.setB(-2.473); // Configure the equation to calculate NH4 concentration value float NH4 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.setA(34.668); MQ135.setB(-3.369); // Configure the equation to calculate Aceton concentration value - float Acetona = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup + float Aceton = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup Serial.print("| "); Serial.print(CO); Serial.print(" | "); Serial.print(Alcohol); // Note: 200 Offset for CO2 source: https://github.com/miguel5612/MQSensorsLib/issues/29 @@ -106,9 +106,9 @@ void loop() { https://www.lavanguardia.com/natural/20190514/462242832581/concentracion-dioxido-cabono-co2-atmosfera-bate-record-historia-humanidad.html */ Serial.print(" | "); Serial.print(CO2 + 400); - Serial.print(" | "); Serial.print(Tolueno); + Serial.print(" | "); Serial.print(Toluen); Serial.print(" | "); Serial.print(NH4); - Serial.print(" | "); Serial.print(Acetona); + Serial.print(" | "); Serial.print(Aceton); Serial.println(" |"); /* Exponential regression: @@ -116,9 +116,9 @@ void loop() { CO | 605.18 | -3.937 Alcohol | 77.255 | -3.18 CO2 | 110.47 | -2.862 - Tolueno | 44.947 | -3.445 + Toluen | 44.947 | -3.445 NH4 | 102.2 | -2.473 - Acetona | 34.668 | -3.369 + Aceton | 34.668 | -3.369 */ delay(500); //Sampling frequency diff --git a/examples/MQ-135-CorrectionFactorDHT11/MQ-135-CorrectionFactorDHT11.ino b/examples/MQ-135-CorrectionFactorDHT11/MQ-135-CorrectionFactorDHT11.ino index 0bbe622..63d761a 100644 --- a/examples/MQ-135-CorrectionFactorDHT11/MQ-135-CorrectionFactorDHT11.ino +++ b/examples/MQ-135-CorrectionFactorDHT11/MQ-135-CorrectionFactorDHT11.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -81,7 +81,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ135.setRegressionMethod(1); //_PPM = a*ratio^b - MQ135.setA(102.2); MQ135.setB(-2.473); // Configurate the ecuation values to get NH4 concentration + MQ135.setA(102.2); MQ135.setB(-2.473); // Configure the equation to to calculate NH4 concentration /* Exponential regression: @@ -89,9 +89,9 @@ void setup() { CO | 605.18 | -3.937 Alcohol | 77.255 | -3.18 CO2 | 110.47 | -2.862 - Tolueno | 44.947 | -3.445 + Toluen | 44.947 | -3.445 NH4 | 102.2 | -2.473 - Acetona | 34.668 | -3.369 + Aceton | 34.668 | -3.369 */ /***************************** MQ Init ********************************************/ @@ -104,24 +104,24 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ135.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ135.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ135.serialDebug(true); // Set delay between sensor readings based on sensor details. @@ -138,8 +138,8 @@ void loop() { float cFactor = 0; if (!isnan(event.temperature) && !isnan(event.relative_humidity)) cFactor = getCorrectionFactor(event.temperature, event.relative_humidity); Serial.print("Correction Factor: "); Serial.println(cFactor); - MQ135.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ135.readSensor(false, cFactor); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ135.update(); // Update data, the arduino will read the voltage from the analog pin + MQ135.readSensor(false, cFactor); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.serialDebug(); // Will print the table on the serial port } diff --git a/examples/MQ-135/MQ-135.ino b/examples/MQ-135/MQ-135.ino index 8471e05..20c8c7e 100644 --- a/examples/MQ-135/MQ-135.ino +++ b/examples/MQ-135/MQ-135.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -42,7 +42,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ135.setRegressionMethod(1); //_PPM = a*ratio^b - MQ135.setA(102.2); MQ135.setB(-2.473); // Configurate the ecuation values to get NH4 concentration + MQ135.setA(102.2); MQ135.setB(-2.473); // Configure the equation to to calculate NH4 concentration /* Exponential regression: @@ -50,9 +50,9 @@ void setup() { CO | 605.18 | -3.937 Alcohol | 77.255 | -3.18 CO2 | 110.47 | -2.862 - Tolueno | 44.947 | -3.445 + Toluen | 44.947 | -3.445 NH4 | 102.2 | -2.473 - Acetona | 34.668 | -3.369 + Aceton | 34.668 | -3.369 */ /***************************** MQ Init ********************************************/ @@ -65,31 +65,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ135.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ135.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ135.serialDebug(true); } void loop() { - MQ135.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ135.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ135.update(); // Update data, the arduino will read the voltage from the analog pin + MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-2/MQ-2.ino b/examples/MQ-2/MQ-2.ino index 45c9370..b3b7e3f 100644 --- a/examples/MQ-2/MQ-2.ino +++ b/examples/MQ-2/MQ-2.ino @@ -14,7 +14,7 @@ by Miguel Califa Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -41,7 +41,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ2.setRegressionMethod(1); //_PPM = a*ratio^b - MQ2.setA(574.25); MQ2.setB(-2.222); // Configurate the ecuation values to get LPG concentration + MQ2.setA(574.25); MQ2.setB(-2.222); // Configure the equation to to calculate LPG concentration /* Exponential regression: Gas | a | b @@ -62,32 +62,32 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ2.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ2.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ2.serialDebug(true); } void loop() { - MQ2.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ2.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ2.update(); // Update data, the arduino will read the voltage from the analog pin + MQ2.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ2.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-3/MQ-3.ino b/examples/MQ-3/MQ-3.ino index 1678463..498923a 100644 --- a/examples/MQ-3/MQ-3.ino +++ b/examples/MQ-3/MQ-3.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -41,7 +41,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ3.setRegressionMethod(1); //_PPM = a*ratio^b - MQ3.setA(4.8387); MQ3.setB(-2.68); // Configurate the ecuation values to get Benzene concentration + MQ3.setA(4.8387); MQ3.setB(-2.68); // Configure the equation to to calculate Benzene concentration /* Exponential regression: Gas | a | b @@ -64,31 +64,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // 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 + MQ3.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ3.serialDebug(true); } void loop() { - MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ3.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ3.update(); // Update data, the arduino will read the voltage from the analog pin + MQ3.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ3.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-303A/MQ303.ino b/examples/MQ-303A/MQ303.ino index 7440dfb..f8350bd 100644 --- a/examples/MQ-303A/MQ303.ino +++ b/examples/MQ-303A/MQ303.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -42,7 +42,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ303.setRegressionMethod(1); //_PPM = a*ratio^b - MQ303.setA(6.2144); MQ303.setB(-2.894); // Configurate the ecuation values to get Isobutano concentration + MQ303.setA(6.2144); MQ303.setB(-2.894); // Configure the equation to to calculate Isobutano concentration /* Exponential regression: @@ -62,31 +62,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ303.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ303.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ303.serialDebug(true); } void loop() { - MQ303.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ303.readSensor(true); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ303.update(); // Update data, the arduino will read the voltage from the analog pin + MQ303.readSensor(true); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ303.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-309A/MQ-309.ino b/examples/MQ-309A/MQ-309.ino index 71f9cff..8a43245 100644 --- a/examples/MQ-309A/MQ-309.ino +++ b/examples/MQ-309A/MQ-309.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -44,7 +44,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ309.setRegressionMethod(1); //_PPM = a*ratio^b - MQ309.setA(1000000); MQ309.setB(-4.01); // Configurate the ecuation values to get CO concentration + MQ309.setA(1000000); MQ309.setB(-4.01); // Configure the equation to calculate CO concentration value /* Exponential regression: @@ -65,24 +65,24 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ309.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ309.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ309.serialDebug(true); } @@ -94,8 +94,8 @@ void loop() { { // VH 0.9 Volts analogWrite(5, 2); // 255 is 100%, 2.295 is aprox 0.9% of Duty cycle for 60s - MQ309.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ309.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ309.update(); // Update data, the arduino will read the voltage from the analog pin + MQ309.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ309.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } @@ -106,8 +106,8 @@ void loop() { { // VL 0.2 Volts analogWrite(5, 1); // 255 is 100%, 0.51 is aprox 0.2% of Duty cycle for 120s - MQ309.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ309.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ309.update(); // Update data, the arduino will read the voltage from the analog pin + MQ309.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ309.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } diff --git a/examples/MQ-4-ALL/MQ-4-ALL.ino b/examples/MQ-4-ALL/MQ-4-ALL.ino index fc6a408..ff7692b 100644 --- a/examples/MQ-4-ALL/MQ-4-ALL.ino +++ b/examples/MQ-4-ALL/MQ-4-ALL.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -53,32 +53,32 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ - Serial.println("*************** Lectures from MQ-4 **********************"); + Serial.println("*************** Values from MQ-4 **********************"); Serial.println("| LPG | CH4 | CO | Alcohol | Smoke |"); } void loop() { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from the analog pin /* Exponential regression: @@ -89,20 +89,20 @@ void loop() { Alcohol| 60000000000 | -14.01 smoke | 30000000 | -8.308 */ - MQ4.setA(3811.9); MQ4.setB(-3.113); // Configurate the ecuation values to get CH4 concentration - float LPG = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ4.setA(3811.9); MQ4.setB(-3.113); // Configure the equation to to calculate CH4 concentration + float LPG = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup - MQ4.setA(1012.7); MQ4.setB(-2.786); // Configurate the ecuation values to get CH4 concentration - float CH4 = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ4.setA(1012.7); MQ4.setB(-2.786); // Configure the equation to to calculate CH4 concentration + float CH4 = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup - MQ4.setA(200000000000000); MQ4.setB(-19.05); // Configurate the ecuation values to get CH4 concentration - float CO = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ4.setA(200000000000000); MQ4.setB(-19.05); // Configure the equation to to calculate CH4 concentration + float CO = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup - MQ4.setA(60000000000); MQ4.setB(-14.01); // Configurate the ecuation values to get CH4 concentration - float Alcohol = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ4.setA(60000000000); MQ4.setB(-14.01); // Configure the equation to to calculate CH4 concentration + float Alcohol = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup - MQ4.setA(30000000); MQ4.setB(-8.308); // Configurate the ecuation values to get CH4 concentration - float Smoke = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ4.setA(30000000); MQ4.setB(-8.308); // Configure the equation to to calculate CH4 concentration + float Smoke = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup Serial.print("| "); Serial.print(LPG); Serial.print(" | "); Serial.print(CH4); diff --git a/examples/MQ-4-LINEAR/MQ-4-LINEAR.ino b/examples/MQ-4-LINEAR/MQ-4-LINEAR.ino index 3594f86..73730f7 100644 --- a/examples/MQ-4-LINEAR/MQ-4-LINEAR.ino +++ b/examples/MQ-4-LINEAR/MQ-4-LINEAR.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -52,36 +52,36 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ - Serial.println("** Lectures from MQ-4**********"); + Serial.println("** Values from MQ-4**********"); Serial.println("| LPG |"); } void loop() { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from the analog pin //https://jayconsystems.com/blog/understanding-a-gas-sensor MQ4.setA(-0.318); MQ4.setB(1.133); // A -> Slope, B -> Intersect with X - Axis - float LPG = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + float LPG = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup // exposure to 2000 ppm of LPG gas is immediately dangerous to life and health. In this section if(LPG>=2000) Serial.println("Warning - Very high concentrations detected!"); diff --git a/examples/MQ-4/MQ-4.ino b/examples/MQ-4/MQ-4.ino index b90b506..9f6b722 100644 --- a/examples/MQ-4/MQ-4.ino +++ b/examples/MQ-4/MQ-4.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -41,7 +41,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ4.setRegressionMethod(1); //_PPM = a*ratio^b - MQ4.setA(1012.7); MQ4.setB(-2.786); // Configurate the ecuation values to get CH4 concentration + MQ4.setA(1012.7); MQ4.setB(-2.786); // Configure the equation to to calculate CH4 concentration /* Exponential regression: Gas | a | b @@ -63,31 +63,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ4.serialDebug(true); } void loop() { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ4.update(); // Update data, the arduino will read the voltage from the analog pin + MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ4.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-5/MQ-5.ino b/examples/MQ-5/MQ-5.ino index 4f99b42..1c22831 100644 --- a/examples/MQ-5/MQ-5.ino +++ b/examples/MQ-5/MQ-5.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -42,7 +42,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ5.setRegressionMethod(1); //_PPM = a*ratio^b - MQ5.setA(1163.8); MQ5.setB(-3.874); // Configurate the ecuation values to get H2 concentration + MQ5.setA(1163.8); MQ5.setB(-3.874); // Configure the equation to to calculate H2 concentration /* Exponential regression: Gas | a | b @@ -63,31 +63,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ5.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ5.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ5.serialDebug(true); } void loop() { - MQ5.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ5.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ5.update(); // Update data, the arduino will read the voltage from the analog pin + MQ5.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ5.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-6/MQ-6.ino b/examples/MQ-6/MQ-6.ino index d9a6353..4f03526 100644 --- a/examples/MQ-6/MQ-6.ino +++ b/examples/MQ-6/MQ-6.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -42,7 +42,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ6.setRegressionMethod(1); //_PPM = a*ratio^b - MQ6.setA(2127.2); MQ6.setB(-2.526); // Configurate the ecuation values to get CH4 concentration + MQ6.setA(2127.2); MQ6.setB(-2.526); // Configure the equation to to calculate CH4 concentration /* Exponential regression: GAS | a | b @@ -63,31 +63,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ6.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ6.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ6.serialDebug(true); } void loop() { - MQ6.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ6.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ6.update(); // Update data, the arduino will read the voltage from the analog pin + MQ6.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ6.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-7/MQ-7.ino b/examples/MQ-7/MQ-7.ino index 0818ae1..22aa7f1 100644 --- a/examples/MQ-7/MQ-7.ino +++ b/examples/MQ-7/MQ-7.ino @@ -19,7 +19,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -48,7 +48,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ7.setRegressionMethod(1); //_PPM = a*ratio^b - MQ7.setA(99.042); MQ7.setB(-1.518); // Configurate the ecuation values to get CO concentration + MQ7.setA(99.042); MQ7.setB(-1.518); // Configure the equation to calculate CO concentration value /* Exponential regression: @@ -70,24 +70,24 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ7.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ7.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ7.serialDebug(true); } @@ -99,8 +99,8 @@ void loop() { { // VH 5 Volts analogWrite(5, 255); // 255 is DC 5V output - MQ7.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ7.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ7.update(); // Update data, the arduino will read the voltage from the analog pin + MQ7.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ7.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } @@ -111,8 +111,8 @@ void loop() { { // VH 1.4 Volts analogWrite(5, 20); // 255 is 100%, 20.4 is aprox 8% of Duty cycle for 90s - MQ7.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ7.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ7.update(); // Update data, the arduino will read the voltage from the analog pin + MQ7.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ7.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } diff --git a/examples/MQ-8/MQ-8.ino b/examples/MQ-8/MQ-8.ino index 66947db..ca1972c 100644 --- a/examples/MQ-8/MQ-8.ino +++ b/examples/MQ-8/MQ-8.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -42,7 +42,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ8.setRegressionMethod(1); //_PPM = a*ratio^b - MQ8.setA(976.97); MQ8.setB(-0.688); // Configurate the ecuation values to get H2 concentration + MQ8.setA(976.97); MQ8.setB(-0.688); // Configure the equation to to calculate H2 concentration /* Exponential regression: @@ -64,31 +64,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ8.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ8.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ8.serialDebug(true); } void loop() { - MQ8.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ8.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ8.update(); // Update data, the arduino will read the voltage from the analog pin + MQ8.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ8.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/MQ-9-ALL/MQ-9-ALL.ino b/examples/MQ-9-ALL/MQ-9-ALL.ino index 9479170..eaf1de3 100644 --- a/examples/MQ-9-ALL/MQ-9-ALL.ino +++ b/examples/MQ-9-ALL/MQ-9-ALL.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -53,31 +53,31 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ9.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ9.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ - Serial.println("** Lectures from MQ-9 ****"); + Serial.println("** Values from MQ-9 ****"); Serial.println("| LPG | CH4 | CO |"); } void loop() { - MQ9.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ9.update(); // Update data, the arduino will read the voltage from the analog pin /* Exponential regression: GAS | a | b @@ -86,14 +86,14 @@ void loop() { CO | 599.65 | -2.244 */ - MQ9.setA(1000.5); MQ9.setB(-2.186); // Configurate the ecuation values to get LPG concentration - float LPG = MQ9.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ9.setA(1000.5); MQ9.setB(-2.186); // Configure the equation to to calculate LPG concentration + float LPG = MQ9.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup - MQ9.setA(4269.6); MQ9.setB(-2.648); // Configurate the ecuation values to get LPG concentration - float CH4 = MQ9.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ9.setA(4269.6); MQ9.setB(-2.648); // Configure the equation to to calculate LPG concentration + float CH4 = MQ9.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup - MQ9.setA(599.65); MQ9.setB(-2.244); // Configurate the ecuation values to get LPG concentration - float CO = MQ9.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ9.setA(599.65); MQ9.setB(-2.244); // Configure the equation to to calculate LPG concentration + float CO = MQ9.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup Serial.print("| "); Serial.print(LPG); Serial.print(" | "); Serial.print(CH4); diff --git a/examples/MQ-9/MQ-9.ino b/examples/MQ-9/MQ-9.ino index ea9621b..0950140 100644 --- a/examples/MQ-9/MQ-9.ino +++ b/examples/MQ-9/MQ-9.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -45,7 +45,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ9.setRegressionMethod(1); //_PPM = a*ratio^b - MQ9.setA(1000.5); MQ9.setB(-2.186); // Configurate the ecuation values to get LPG concentration + MQ9.setA(1000.5); MQ9.setB(-2.186); // Configure the equation to to calculate LPG concentration /* Exponential regression: @@ -65,10 +65,10 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor // ISSUE 44 - MQ9 needs a low/high temperature cycle like MQ7 #44 @@ -94,15 +94,15 @@ void setup() { float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ9.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ9.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ9.serialDebug(true); } @@ -114,8 +114,8 @@ void loop() { digitalWrite(PreaheatControlPin5, HIGH); digitalWrite(PreaheatControlPin14, LOW); - MQ9.update(); // Update data, the arduino will be read the voltage on the analog pin - MQ9.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ9.update(); // Update data, the arduino will read the voltage from the analog pin + MQ9.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ9.serialDebug(); // Will print the table on the serial port } \ No newline at end of file diff --git a/examples/MQ-Board/MQ-Board.ino b/examples/MQ-Board/MQ-Board.ino index c14e41d..a13932d 100644 --- a/examples/MQ-Board/MQ-Board.ino +++ b/examples/MQ-Board/MQ-Board.ino @@ -11,7 +11,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -61,50 +61,50 @@ void setup() { //init the sensor MQ2.init(); MQ2.setRegressionMethod(1); //_PPM = a*ratio^b - MQ2.setA(574.25); MQ2.setB(-2.222); // Configurate the ecuation values to get LPG concentration + MQ2.setA(574.25); MQ2.setB(-2.222); // Configure the equation to to calculate LPG concentration MQ2.setR0(9.659574468); MQ3.init(); MQ3.setRegressionMethod(1); //_PPM = a*ratio^b - MQ3.setA(0.3934); MQ3.setB(-1.504); // Configurate the ecuation values to get Alcohol concentration + MQ3.setA(0.3934); MQ3.setB(-1.504); //Configure the equation to calculate Alcohol concentration value MQ3.setR0(3.86018237); MQ4.init(); MQ4.setRegressionMethod(1); //_PPM = a*ratio^b - MQ4.setA(1012.7); MQ4.setB(-2.786); // Configurate the ecuation values to get CH4 concentration + MQ4.setA(1012.7); MQ4.setB(-2.786); // Configure the equation to to calculate CH4 concentration MQ4.setR0(3.86018237); MQ5.init(); MQ5.setRegressionMethod(1); //_PPM = a*ratio^b - MQ5.setA(97124); MQ5.setB(-4.918); // Configurate the ecuation values to get Alcohol concentration + MQ5.setA(97124); MQ5.setB(-4.918); //Configure the equation to calculate Alcohol concentration value MQ5.setR0(71.100304); MQ6.init(); MQ6.setRegressionMethod(1); //_PPM = a*ratio^b - MQ6.setA(2127.2); MQ6.setB(-2.526); // Configurate the ecuation values to get CH4 concentration + MQ6.setA(2127.2); MQ6.setB(-2.526); // Configure the equation to to calculate CH4 concentration MQ6.setR0(13.4285714); MQ7.init(); MQ7.setRegressionMethod(1); //_PPM = a*ratio^b - MQ7.setA(99.042); MQ7.setB(-1.518); // Configurate the ecuation values to get CO concentration + MQ7.setA(99.042); MQ7.setB(-1.518); // Configure the equation to calculate CO concentration value MQ7.setR0(4); MQ8.init(); MQ8.setRegressionMethod(1); //_PPM = a*ratio^b - MQ8.setA(976.97); MQ8.setB(-0.688); // Configurate the ecuation values to get H2 concentration + MQ8.setA(976.97); MQ8.setB(-0.688); // Configure the equation to to calculate H2 concentration MQ8.setR0(1); MQ9.init(); MQ9.setRegressionMethod(1); //_PPM = a*ratio^b - MQ9.setA(1000.5); MQ9.setB(-2.186); // Configurate the ecuation values to get LPG concentration + MQ9.setA(1000.5); MQ9.setB(-2.186); // Configure the equation to to calculate LPG concentration 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float MQ2calcR0 = 0, @@ -117,7 +117,7 @@ void setup() { MQ9calcR0 = 0; for(int i = 1; i<=10; i ++) { - //Update the voltage lectures + //Update the voltage Values MQ2.update(); MQ3.update(); MQ4.update(); @@ -164,7 +164,7 @@ void setup() { //Print in serial monitor Serial.println("MQ2 to MQ9 - lecture"); - Serial.println("*************************** Lectures from MQ-board ***************************"); + Serial.println("*************************** Values from MQ-board ***************************"); Serial.println("| LPG | Alcohol | CH4 | Alcohol | CH4 | CO | H2 | LPG |"); Serial.println("| MQ-2 | MQ-3 | MQ-4 | MQ-5 | MQ-6 | MQ-7 | MQ-8 | MQ-9 |"); //pinMode(calibration_button, INPUT); @@ -192,7 +192,7 @@ void loop() { void readAllSensors() { - //Update the voltage lectures + //Update the voltage Values MQ2.update(); MQ3.update(); MQ4.update(); diff --git a/examples/MQ135-ADS1115/MQ135-ADS1115.ino b/examples/MQ135-ADS1115/MQ135-ADS1115.ino index 89df8c4..e1b625a 100644 --- a/examples/MQ135-ADS1115/MQ135-ADS1115.ino +++ b/examples/MQ135-ADS1115/MQ135-ADS1115.ino @@ -85,13 +85,13 @@ void loop() { float CO2 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.setA(44.947); MQ135.setB(-3.445); // Configure the equation to calculate Toluen concentration value - float Tolueno = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup + float Toluen = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.setA(102.2 ); MQ135.setB(-2.473); // Configure the equation to calculate NH4 concentration value float NH4 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ135.setA(34.668); MQ135.setB(-3.369); // Configure the equation to calculate Aceton concentration value - float Acetona = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup + float Aceton = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup Serial.print("| "); Serial.print(CO); Serial.print(" | "); Serial.print(Alcohol); // Note: 200 Offset for CO2 source: https://github.com/miguel5612/MQSensorsLib/issues/29 @@ -105,9 +105,9 @@ void loop() { https://www.lavanguardia.com/natural/20190514/462242832581/concentracion-dioxido-cabono-co2-atmosfera-bate-record-historia-humanidad.html */ Serial.print(" | "); Serial.print(CO2 + 400); - Serial.print(" | "); Serial.print(Tolueno); + Serial.print(" | "); Serial.print(Toluen); Serial.print(" | "); Serial.print(NH4); - Serial.print(" | "); Serial.print(Acetona); + Serial.print(" | "); Serial.print(Aceton); Serial.println(" |"); /* Exponential regression: @@ -115,9 +115,9 @@ void loop() { CO | 605.18 | -3.937 Alcohol | 77.255 | -3.18 CO2 | 110.47 | -2.862 - Tolueno | 44.947 | -3.445 + Toluen | 44.947 | -3.445 NH4 | 102.2 | -2.473 - Acetona | 34.668 | -3.369 + Aceton | 34.668 | -3.369 */ delay(500); //Sampling frequency diff --git a/examples/external_A2D/external_A2D.ino b/examples/external_A2D/external_A2D.ino index 03eba86..8228eda 100644 --- a/examples/external_A2D/external_A2D.ino +++ b/examples/external_A2D/external_A2D.ino @@ -15,7 +15,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin - For this example this doesn't matter + Please make sure arduino A0 pin represents 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. @@ -52,7 +52,7 @@ void setup() { //Set math model to calculate the PPM concentration and the value of constants MQ3.setRegressionMethod(1); //_PPM = a*ratio^b - MQ3.setA(4.8387); MQ3.setB(-2.68); // Configurate the ecuation values to get Benzene concentration + MQ3.setA(4.8387); MQ3.setB(-2.68); // Configure the equation to to calculate Benzene concentration /* Exponential regression: Gas | a | b @@ -72,25 +72,25 @@ void setup() { /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { int yourA2DValue = random(0, 1024); // 10-bit emulation - MQ3.setADC(yourA2DValue);// Update data, the arduino will be read the voltage on the analog pin + MQ3.setADC(yourA2DValue);// Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ3.serialDebug(true); @@ -98,8 +98,8 @@ void setup() { void loop() { int yourA2DValue = random(0, 1024); // 10-bit emulation - MQ3.setADC(yourA2DValue); // Update data, the arduino will be read the voltage on the analog pin - MQ3.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + MQ3.setADC(yourA2DValue); // Update data, the arduino will read the voltage from the analog pin + MQ3.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup MQ3.serialDebug(); // Will print the table on the serial port delay(500); //Sampling frequency } \ No newline at end of file diff --git a/examples/smokeDetector/smokeDetector.ino b/examples/smokeDetector/smokeDetector.ino index d133ec1..346919a 100644 --- a/examples/smokeDetector/smokeDetector.ino +++ b/examples/smokeDetector/smokeDetector.ino @@ -11,7 +11,7 @@ Wiring: https://github.com/miguel5612/MQSensorsLib_Docs/blob/master/static/img/MQ_Arduino.PNG - Please take care, arduino A0 pin represent the analog input configured on #define pin + Please make sure arduino A0 pin represents the analog input configured on #define pin This example code is in the public domain. @@ -37,7 +37,7 @@ void setup() { Serial.begin(115200); //Set math model to calculate the PPM concentration and the value of constants MQ4.setRegressionMethod(1); //_PPM = a*ratio^b - MQ4.setA(30000000); MQ4.setB(-8.308); // Configurate the ecuation values to get CH4 concentration + MQ4.setA(30000000); MQ4.setB(-8.308); // Configure the equation to to calculate CH4 concentration /* Exponential regression: Gas | a | b @@ -57,24 +57,24 @@ void setup() { */ /***************************** 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 + // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated + // and on clean air (Calibration conditions), setting up R0 value. + // We recomend executing this routine only on setup in laboratory conditions. + // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. // Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor Serial.print("Calibrating please wait."); float calcR0 = 0; for(int i = 1; i<=10; i ++) { - MQ4.update(); // Update data, the arduino will be read the voltage on the analog pin + MQ4.update(); // Update data, the arduino will read the voltage from 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);} + if(isinf(calcR0)) {Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); while(1);} + if(calcR0 == 0){Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); while(1);} /***************************** MQ CAlibration ********************************************/ MQ4.serialDebug(true); } @@ -88,7 +88,7 @@ void setup() { //Read the sensor and print in serial port //Lecture will be saved in lecture variable MQ4.update(); - float smokePPM = MQ4.readSensor(); // Sensor will read PPM concentration using the model and a and b values setted before or in the setup + float smokePPM = MQ4.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup if(smokePPM > 1000) {Serial.println("Warning: High concentrations of smoke detected");} MQ4.serialDebug(); // Will print the table on the serial port delay(400);