Compare commits

...

7 Commits
v1.10 ... v2.0

Author SHA1 Message Date
d0b00b4025 Updated props 2020-03-30 20:04:02 -05:00
f83e0fb0d7 Fixed bit comparation to strin 2020-03-30 19:54:22 -05:00
65a1246e51 Fixed ESP8266 volt resolution 3.3 2020-03-30 19:51:23 -05:00
28ce4c80f7 Removed setR0 before calibratioN 2020-03-30 19:46:49 -05:00
9497574e11 Fixed issue on calibratioN 2020-03-30 19:17:25 -05:00
9cbc753758 Updated MQ-board examples 2020-03-30 18:58:07 -05:00
c7b67d7fa5 Updated examples 2020-03-30 18:40:55 -05:00
25 changed files with 350 additions and 454 deletions

View File

@ -23,18 +23,18 @@
//Include the library
#include <MQUnifiedsensor.h>
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A3) //Analog input 3 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-3") //MQ3
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A3 //Analog input 3 of your arduino
#define type "MQ-3" //MQ3
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
//#define calibration_button 13 //Pin to calibrate your sensor
double alcoholPPM = 0;
//Declare Sensor
MQUnifiedsensor MQ3(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
/*****************************Globals***********************************************/
double alcoholPPM = (0);
/**************************Object_Sensor********************************************/
MQUnifiedsensor MQ3(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
//Init the serial port communication - to debug the library
@ -45,7 +45,7 @@ void setup() {
MQ3.setA(0.3934); MQ3.setB(-1.504); // Configurate the ecuation values to get Alcohol concentration
/*
Exponential regression:
Gas | a | b
Gas | a | b
LPG | 44771 | -3.245
CH4 | 2*10^31| 19.01
CO | 521853 | -3.821
@ -54,18 +54,35 @@ void setup() {
Hexane | 7585.3 | -2.849
*/
// Calibration setup
MQ3.setR0(3.86018237);
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
MQ3.init();
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
// and now is on clean air (Calibration conditions), and it will setup R0 value.
// We recomend execute this routine only on setup or on the laboratory and save on the eeprom of your arduino
// This routine not need to execute to every restart, you can load your R0 if you know the value
// Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor
Serial.print("Calibrating please wait.");
float calcR0 = 0;
for(int i = 1; i<=10; i ++)
{
MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin
calcR0 += MQ3.calibrate(RatioMQ3CleanAir);
Serial.print(".");
}
MQ3.setR0(calcR0/10);
Serial.println(" done!.");
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
}
void loop() {

View File

@ -13,20 +13,25 @@
with which the library was made.
*/
//Definitions
#define placa "Arduino Mega 2560"
#define Voltage_Resolution 5
#define type "Algorithm Tester"
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
// On this program pin value doesn't matter
#define pin2 A2 //Analog input 2 of your arduino
//Declare Sensor
MQUnifiedsensor mySensor(placa, Voltage_Resolution, ADC_Bit_Resolution, pin2, type);
//Include the library
#include <MQUnifiedsensor.h>
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A3) //Analog input 3 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-3") //MQ3
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
double ratio[4] = {};
double expectedValue[4] = {};
double calculatedValues[4] = {};
double error[4] = {};
//Declare Sensor
MQUnifiedsensor mySensor(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
/*****************************Globals***********************************************/
double ratio[4] = {};
double expectedValue[4] = {};
double calculatedValues[4] = {};
double error[4] = {};
/**************************Object_Sensor********************************************/
void setup()
{

View File

@ -15,15 +15,16 @@
//Include the library
#include <MQUnifiedsensor.h>
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A2) //Analog input 2 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-2") //MQ2
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A2 //Analog input 2 of your arduino
#define type "MQ-2" //MQ2
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
/*****************************Globals***********************************************/
double alcoholPPM = (0);
//Defaults, uncomment if you need
#define RatioMQ2CleanAir 9.83 //RS / R0 = 9.83 ppm
//#define RatioMQ3CleanAir 60 //RS / R0 = 60 ppm
@ -37,17 +38,20 @@
//#define RatioMQ135CleanAir 3.6//RS / R0 = 3.6 ppm
//#define RatioMQ303CleanAir 1 //RS / R0 = 1 ppm
//#define RatioMQ309CleanAir 11 //RS / R0 = 11 ppm
//Declare Sensor
MQUnifiedsensor MQ2(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
unsigned long contador = 0;
/**************************Object_Sensor********************************************/
MQUnifiedsensor MQ2(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
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
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
//init the sensor
MQ2.init();
//Print in serial monitor

View File

@ -22,16 +22,17 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "ESP8266" //NodeMcu, WeMos D1, TTGo, ESP32.. etc
#define Voltage_Resolution 3.3
#define pin A0 //Analog input 0 of your ESP Board
#define type "MQ-3" //MQ3
#define ADC_Bit_Resolution 10 // For ESP8266
//Declare Sensor
MQUnifiedsensor MQ3(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A0) //Analog input 3 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-3") //MQ3
#define Voltage_Resolution (3.3) // 3V3 <- IMPORTANT
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ3CleanAir (60)
/*****************************Globals***********************************************/
MQUnifiedsensor MQ3(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
/*****************************Globals***********************************************/
void setup() {
//Init the serial port communication - to debug the library
@ -51,23 +52,36 @@ void setup() {
Hexane | 7585.3 | -2.849
*/
// Calibration setup
MQ3.setR0(3.86018237);
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
// and now is on clean air (Calibration conditions), and it will setup R0 value.
// We recomend execute this routine only on setup or on the laboratory and save on the eeprom of your arduino
// This routine not need to execute to every restart, you can load your R0 if you know the value
// Acknowledgements: https://jayconsystems.com/blog/understanding-a-gas-sensor
Serial.print("Calibrating please wait.");
float calcR0 = 0;
for(int i = 1; i<=10; i ++)
{
MQ3.update(); // Update data, the arduino will be read the voltage on the analog pin
calcR0 += MQ3.calibrate(RatioMQ3CleanAir);
Serial.print(".");
}
MQ3.setR0(calcR0/10);
Serial.println(" done!.");
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
MQ3.serialDebug(true);
}

View File

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

View File

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

View File

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

View File

@ -22,17 +22,18 @@
//Include the library
#include <MQUnifiedsensor.h>
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A2) //Analog input 3 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-2") //MQ2
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ2CleanAir (9.83) //RS / R0 = 9.83 ppm
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A0 //Analog input 0 of your arduino
#define type "MQ-2" //MQ2
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define RatioMQ2CleanAir 9.83 //RS / R0 = 9.83 ppm
//Declare Sensor
MQUnifiedsensor MQ2(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
/*****************************Globals***********************************************/
MQUnifiedsensor MQ2(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
/*****************************Globals***********************************************/
void setup() {
//Init the serial port communication - to debug the library
@ -51,6 +52,14 @@ void setup() {
Propane| 658.71 | -2.168
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ2.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ2.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -72,20 +81,7 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ2.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ2.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ2.serialDebug(true);
}

View File

@ -23,18 +23,17 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A0 //Analog input 0 of your arduino
#define type "MQ-3" //MQ3
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define RatioMQ3CleanAir 60 //RS / R0 = 60 ppm
//#define calibration_button 13 //Pin to calibrate your sensor
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A3) //Analog input 3 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-3") //MQ3
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ3CleanAir (60) //RS / R0 = 60 ppm
/*****************************Globals***********************************************/
//Declare Sensor
MQUnifiedsensor MQ3(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
MQUnifiedsensor MQ3(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
//Init the serial port communication - to debug the library
@ -54,7 +53,15 @@ void setup() {
Hexane | 7585.3 | -2.849
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -76,21 +83,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ3.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ3.serialDebug(true);
}

View File

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

View File

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

View File

@ -23,18 +23,17 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A0 //Analog input 0 of your arduino
#define type "MQ-4" //MQ4
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define RatioMQ4CleanAir 4.4 //RS / R0 = 4.4 ppm
//#define calibration_button 13 //Pin to calibrate your sensor
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A4) //Analog input 4 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-4") //MQ4
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ4CleanAir (4.4) //RS / R0 = 60 ppm
/*****************************Globals***********************************************/
//Declare Sensor
MQUnifiedsensor MQ4(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
MQUnifiedsensor MQ4(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
//Init the serial port communication - to debug the library
@ -44,7 +43,14 @@ void setup() {
MQ4.setRegressionMethod(1); //_PPM = a*ratio^b
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -67,18 +73,6 @@ void setup() {
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
Serial.println("*************** Lectures from MQ-4 **********************");
Serial.println("| LPG | CH4 | CO | Alcohol | Smoke |");
}

View File

@ -23,18 +23,17 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A4 //Analog input 4 of your arduino
#define type "MQ-4" //MQ4
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define RatioMQ4CleanAir 4.4 //RS / R0 = 4.4 ppm
//#define calibration_button 13 //Pin to calibrate your sensor
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A4) //Analog input 4 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-4") //MQ4
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ4CleanAir (4.4) //RS / R0 = 60 ppm
/*****************************Globals***********************************************/
//Declare Sensor
MQUnifiedsensor MQ4(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
MQUnifiedsensor MQ4(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
//Init the serial port communication - to debug the library
@ -43,8 +42,14 @@ void setup() {
//Set math model to calculate the PPM concentration and the value of constants
MQ4.setRegressionMethod(0); //_PPM = pow(10, (log10(ratio)-b)/a)
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -67,18 +72,6 @@ void setup() {
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
Serial.println("** Lectures from MQ-4**********");
Serial.println("| LPG |");
}

View File

@ -23,18 +23,17 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A0 //Analog input 0 of your arduino
#define type "MQ-4" //MQ4
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define RatioMQ4CleanAir 4.4 //RS / R0 = 4.4 ppm
//#define calibration_button 13 //Pin to calibrate your sensor
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A4) //Analog input 4 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-4") //MQ4
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ4CleanAir (4.4) //RS / R0 = 60 ppm
/*****************************Globals***********************************************/
//Declare Sensor
MQUnifiedsensor MQ4(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
MQUnifiedsensor MQ4(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
//Init the serial port communication - to debug the library
@ -54,7 +53,14 @@ void setup() {
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -76,21 +82,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ4.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ4.serialDebug(true);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -23,18 +23,17 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A0 //Analog input 0 of your arduino
#define type "MQ-9" //MQ9
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define RatioMQ9CleanAir 9.6 //RS / R0 = 9.6 ppm
//#define calibration_button 13 //Pin to calibrate your sensor
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A9) //Analog input 4 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-9") //MQ9
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ9CleanAir (9.6) //RS / R0 = 60 ppm
/*****************************Globals***********************************************/
//Declare Sensor
MQUnifiedsensor MQ9(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
MQUnifiedsensor MQ9(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
//Init the serial port communication - to debug the library
@ -44,6 +43,14 @@ void setup() {
MQ9.setRegressionMethod(1); //_PPM = a*ratio^b
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -65,19 +72,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
Serial.println("** Lectures from MQ-9 ****");
Serial.println("| LPG | CH4 | CO |");
}

View File

@ -23,18 +23,17 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "Arduino UNO"
#define Voltage_Resolution 5
#define pin A0 //Analog input 0 of your arduino
#define type "MQ-9" //MQ9
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define RatioMQ9CleanAir 9.6 //RS / R0 = 9.6 ppm
//#define calibration_button 13 //Pin to calibrate your sensor
/************************Hardware Related Macros************************************/
#define Board ("Arduino UNO")
#define Pin (A9) //Analog input 4 of your arduino
/***********************Software Related Macros************************************/
#define Type ("MQ-9") //MQ9
#define Voltage_Resolution (5)
#define ADC_Bit_Resolution (10) // For arduino UNO/MEGA/NANO
#define RatioMQ9CleanAir (9.6) //RS / R0 = 60 ppm
/*****************************Globals***********************************************/
//Declare Sensor
MQUnifiedsensor MQ9(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
MQUnifiedsensor MQ9(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin, Type);
void setup() {
//Init the serial port communication - to debug the library
@ -51,8 +50,15 @@ void setup() {
CH4 | 4269.6 | -2.648
CO | 599.65 | -2.244
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ CAlibration ********************************************/
// Explanation:
// In this routine the sensor will measure the resistance of the sensor supposing before was pre-heated
@ -74,21 +80,6 @@ void setup() {
if(isinf(calcR0)) {Serial.println("Warning: Conection issue founded, R0 is infite (Open circuit detected) please check your wiring and supply"); while(1);}
if(calcR0 == 0){Serial.println("Warning: Conection issue founded, R0 is zero (Analog pin with short circuit to ground) please check your wiring and supply"); while(1);}
/***************************** MQ CAlibration ********************************************/
/*
//If the RL value is different from 10K please assign your RL value with the following method:
MQ9.setRL(10);
*/
/***************************** MQ Init ********************************************/
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.init();
/***************************** MQ Init ********************************************/
//Input: setup flag, if this function are on setup will print the headers (Optional - Default value: False)
//Output: print on serial port the information about sensor and sensor readings
//Remarks: Configure the pin of arduino as input.
/************************************************************************************/
MQ9.serialDebug(true);
}

View File

@ -19,39 +19,38 @@
//Include the library
#include <MQUnifiedsensor.h>
//Definitions
#define placa "Arduino Mega 2560"
#define Voltage_Resolution 5
#define type "MQ-Board"
#define ADC_Bit_Resolution 10 // For arduino UNO/MEGA/NANO
#define pin2 A2 //Analog input 2 of your arduino
#define pin3 A3 //Analog input 3 of your arduino
#define pin4 A4 //Analog input 4 of your arduino
#define pin5 A5 //Analog input 5 of your arduino
#define pin6 A6 //Analog input 6 of your arduino
#define pin7 A7 //Analog input 7 of your arduino
#define pin8 A8 //Analog input 8 of your arduino
#define pin9 A9 //Analog input 9 of your arduino
#define RatioMQ2CleanAir 9.83 //RS / R0 = 9.83 ppm
#define RatioMQ3CleanAir 60 //RS / R0 = 60 ppm
#define RatioMQ4CleanAir 4.4 //RS / R0 = 4.4 ppm
#define RatioMQ5CleanAir 6.5 //RS / R0 = 6.5 ppm
#define RatioMQ6CleanAir 10 //RS / R0 = 10 ppm
#define RatioMQ7CleanAir 27.5 //RS / R0 = 27.5 ppm
#define RatioMQ8CleanAir 70 //RS / R0 = 70 ppm
#define RatioMQ9CleanAir 9.6 //RS / R0 = 9.6 ppm
/************************Hardware Related Macros************************************/
#define Board ("Arduino Mega")
#define Pin2 (A2) //Analog input 2 of your arduino
#define Pin3 (A3) //Analog input 3 of your arduino
#define Pin4 (A4) //Analog input 4 of your arduino
#define Pin5 (A5) //Analog input 5 of your arduino
#define Pin6 (A6) //Analog input 6 of your arduino
#define Pin7 (A7) //Analog input 7 of your arduino
#define Pin8 (A8) //Analog input 8 of your arduino
#define Pin9 (A9) //Analog input 9 of your arduino
/***********************Software Related Macros************************************/
#define RatioMQ2CleanAir (9.83) //RS / R0 = 9.83 ppm
#define RatioMQ3CleanAir (60) //RS / R0 = 60 ppm
#define RatioMQ4CleanAir (4.4) //RS / R0 = 4.4 ppm
#define RatioMQ5CleanAir (6.5) //RS / R0 = 6.5 ppm
#define RatioMQ6CleanAir (10) //RS / R0 = 10 ppm
#define RatioMQ7CleanAir (27.5) //RS / R0 = 27.5 ppm
#define RatioMQ8CleanAir (70) //RS / R0 = 70 ppm
#define RatioMQ9CleanAir (9.6) //RS / R0 = 9.6 ppm
#define ADC_Bit_Resolution (10) // 10 bit ADC
#define Voltage_Resolution (5) // Volt resolution to calc the voltage
#define Type ("Arduino Mega 2560") //Board used
/*****************************Globals***********************************************/
//Declare Sensor
MQUnifiedsensor MQ2(placa, Voltage_Resolution, ADC_Bit_Resolution, pin2, type);
MQUnifiedsensor MQ3(placa, Voltage_Resolution, ADC_Bit_Resolution, pin3, type);
MQUnifiedsensor MQ4(placa, Voltage_Resolution, ADC_Bit_Resolution, pin4, type);
MQUnifiedsensor MQ5(placa, Voltage_Resolution, ADC_Bit_Resolution, pin5, type);
MQUnifiedsensor MQ6(placa, Voltage_Resolution, ADC_Bit_Resolution, pin6, type);
MQUnifiedsensor MQ7(placa, Voltage_Resolution, ADC_Bit_Resolution, pin7, type);
MQUnifiedsensor MQ8(placa, Voltage_Resolution, ADC_Bit_Resolution, pin8, type);
MQUnifiedsensor MQ9(placa, Voltage_Resolution, ADC_Bit_Resolution, pin9, type);
MQUnifiedsensor MQ2(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin2, Type);
MQUnifiedsensor MQ3(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin3, Type);
MQUnifiedsensor MQ4(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin4, Type);
MQUnifiedsensor MQ5(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin5, Type);
MQUnifiedsensor MQ6(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin6, Type);
MQUnifiedsensor MQ7(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin7, Type);
MQUnifiedsensor MQ8(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin8, Type);
MQUnifiedsensor MQ9(Board, Voltage_Resolution, ADC_Bit_Resolution, Pin9, Type);
void setup() {
//Init serial port
@ -178,28 +177,6 @@ void loop() {
MQ7.update();
MQ8.update();
MQ9.update();
/*
//Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button)
{
float R0 = MQ2.calibrate();
MQ2.setR0(R0):
R0 = MQ3.calibrate();
MQ3.setR0(R0):
R0 = MQ4.calibrate();
MQ4.setR0(R0):
R0 = MQ5.calibrate();
MQ5.setR0(R0):
R0 = MQ6.calibrate();
MQ6.setR0(R0):
R0 = MQ7.calibrate();
MQ7.setR0(R0):
R0 = MQ8.calibrate();
MQ8.setR0(R0):
R0 = MQ9.calibrate();
MQ9.setR0(R0):
}
*/
//Read the sensor and print in serial port
float MQ2Lecture = MQ2.readSensor();
float MQ3Lecture = MQ3.readSensor();

View File

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

View File

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

View File

@ -1,6 +1,6 @@
name=MQUnifiedsensor
version=1.10
author= Miguel Califa <miguelangel5612@gmail.com>, Yersson Carrillo, Ghiordy Contreras
version=2.0
author= Miguel Califa <miguelangel5612@gmail.com>, Yersson Carrillo<miguelangel5612@gmail.com>, Ghiordy Contreras<miguelangel5612@gmail.com>
maintainer= Miguel Califa <miguelangel5612@gmail.com>
sentence= This library allows you to read the MQ sensors very easily.
paragraph= This library allows an Arduino/Genuino/ESP8266 board to read MQ Sensors (AIr quality meter) references: MQ2, MQ3, MQ4, MQ5, MQ6, MQ7, MQ8, MQ9, MQ131, MQ135, MQ303A, MQ309A.

View File

@ -80,7 +80,7 @@ void MQUnifiedsensor::serialDebug(bool onSetup)
Serial.print("R0: "); Serial.print(_R0); Serial.println("");
Serial.print("RL: "); Serial.print(_RL); Serial.println("");
Serial.print("Model: "); if(_regressionMethod == "Exponential") Serial.println("Exponential"); else Serial.println("Linear");
Serial.print("Model: "); if(_regressionMethod == 1) Serial.println("Exponential"); else Serial.println("Linear");
Serial.print(_type); Serial.print(" -> a: "); Serial.print(_a); Serial.print(" | b: "); Serial.println(_b);
Serial.print("Development board: "); Serial.println(_placa);