Compare commits

..

3 Commits

18 changed files with 77 additions and 93 deletions

View File

@ -1,38 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -1,6 +1,3 @@
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3384299.svg)](https://doi.org/10.5281/zenodo.3384299)
![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)
# MQSensorsLib # MQSensorsLib
This is a unified library to use sensors MQ: 2, 3, 4, 5, 6, 7, 8, 9, 131, 135, 303A and 309A. This is a unified library to use sensors MQ: 2, 3, 4, 5, 6, 7, 8, 9, 131, 135, 303A and 309A.
@ -14,10 +11,10 @@ float ppmCH4 = MQ4.readSensor();
### Prerequisites ### Prerequisites
You'll need Arduino desktop app 1.8.9 or later. You'll need Arduino desftop app 1.8.9 or later.
### Sensor manufacture: ### Sensor manufacter:
| Sensor | Manufacture | URL Datasheet | | Sensor | Manufacter | URL Datasheet |
|----------|----------|----------| |----------|----------|----------|
| MQ-2 | Pololulu| [datasheet](https://www.pololu.com/file/0J309/MQ2.pdf) | | MQ-2 | Pololulu| [datasheet](https://www.pololu.com/file/0J309/MQ2.pdf) |
| MQ-3 | Sparkfun | [datasheet](https://www.sparkfun.com/datasheets/Sensors/MQ-3.pdf) | | MQ-3 | Sparkfun | [datasheet](https://www.sparkfun.com/datasheets/Sensors/MQ-3.pdf) |
@ -38,7 +35,7 @@ Review WPDigitalizer [folder](https://github.com/miguel5612/MQSensorsLib/tree/ma
### Installing ### Installing
Clone this repository into your desktop machine Clone this repositry into your desktop machine
``` ```
git clone https://github.com/miguel5612/MQSensorsLib git clone https://github.com/miguel5612/MQSensorsLib
@ -51,7 +48,7 @@ Use calibration systems if you have several sensors that read the same gas.
### Break down into end to end tests ### Break down into end to end tests
These tests can re-adjust values defined previously and you can contribute to improve conditions or features obtained from particular scenes. These test can re-adjust values defined previously and you can contribute to improve conditions or features obtained from particular scenes.
``` ```
Examples/MQ-3 Examples/MQ-3
@ -59,7 +56,7 @@ Examples/MQ-3
### And coding style tests ### And coding style tests
These tests may generate statistics validation using descriptive tools for quantitative variables. These tests may generate statistics validation using descriptive tools for cuantitative variables.
``` ```
Examples/MQ-board.ino Examples/MQ-board.ino
@ -80,7 +77,7 @@ Please read [CONTRIBUTING.md](https://github.com/miguel5612/MQSensorsLib/blob/NO
* **Ghiordy F. Contreras C.** - [*GitHub*](https://github.com/Ghiordy) - [CV](https://scienti.colciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0000050476) * **Ghiordy F. Contreras C.** - [*GitHub*](https://github.com/Ghiordy) - [CV](https://scienti.colciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0000050476)
* **Yersson R. Carrillo A.** - [*GitHub*](https://github.com/Yercar18/Dronefenix) - [CV](https://scienti.colciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0001637655) * **Yersson R. Carrillo A.** - [*GitHub*](https://github.com/Yercar18/Dronefenix) - [CV](https://scienti.colciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0001637655)
## Collaborators ## Colaborators
* **Andres A. Martinez.** * **Andres A. Martinez.**
* **Juan A. Rodríguez.** - [*Github*](https://github.com/Obiot24) * **Juan A. Rodríguez.** - [*Github*](https://github.com/Obiot24)
@ -91,17 +88,3 @@ See also the list of [contributors](https://github.com/miguel5612/MQSensorsLib/c
## License ## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Cite as
* Plain text: Miguel Angel Califa Urquiza. (2019, September 3). Ghiordy/MQSensorsLib: Arduino Preview V1.0.3 (Version 1.0.3). Zenodo. http://doi.org/10.5281/zenodo.3384299
* BibTeX:
@misc{miguel_angel_califa_urquiza_2019_3384299,
author = {Miguel Angel Califa Urquiza},
title = {Ghiordy/MQSensorsLib: Arduino Preview V1.0.3},
month = sep,
year = 2019,
doi = {10.5281/zenodo.3384299},
url = {https://doi.org/10.5281/zenodo.3384299}
}

View File

@ -41,12 +41,16 @@ void setup() {
void loop() { void loop() {
MQ131.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ131.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
// Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ131.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ131.calibrate(); float R0 = MQ131.calibrate();
MQ131.setR0(R0): MQ131.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -41,6 +41,10 @@ void setup() {
void loop() { void loop() {
MQ135.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ135.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ135.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)

View File

@ -41,12 +41,16 @@ void setup() {
void loop() { void loop() {
MQ2.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ2.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ2.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ2.calibrate(); float R0 = MQ2.calibrate();
MQ2.setR0(R0): MQ2.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -41,12 +41,16 @@ void setup() {
void loop() { void loop() {
MQ3.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ3.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ3.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ3.calibrate(); float R0 = MQ3.calibrate();
MQ3.setR0(R0): MQ3.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -41,12 +41,16 @@ void setup() {
void loop() { void loop() {
MQ303.update(); MQ303.update();
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ303.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ303.calibrate(); float R0 = MQ303.calibrate();
MQ303.setR0(R0): MQ303.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -41,12 +41,16 @@ void setup() {
void loop() { void loop() {
MQ309.update(); MQ309.update();
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ309.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ309.calibrate(); float R0 = MQ309.calibrate();
MQ309.setR0(R0): MQ309.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -42,11 +42,15 @@ void setup() {
void loop() { void loop() {
MQ4.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ4.update(); // Update data, the arduino will be read the voltaje in the analog pin
/* /*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ4.setRL(10);
*/
/*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ4.calibrate(); float R0 = MQ4.calibrate();
MQ4.setR0(R0): MQ4.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -42,12 +42,16 @@ void setup() {
void loop() { void loop() {
MQ5.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ5.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ5.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ5.calibrate(); float R0 = MQ5.calibrate();
MQ5.setR0(R0): MQ5.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -41,6 +41,10 @@ void setup() {
void loop() { void loop() {
MQ6.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ6.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ6.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)

View File

@ -44,12 +44,16 @@ void setup() {
void loop() { void loop() {
MQ7.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ7.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ7.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ7.calibrate(); float R0 = MQ7.calibrate();
MQ7.setR0(R0): MQ7.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -41,12 +41,16 @@ void setup() {
void loop() { void loop() {
MQ8.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ8.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ8.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ8.calibrate(); float R0 = MQ8.calibrate();
MQ8.setR0(R0): MQ8.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -41,12 +41,16 @@ void setup() {
void loop() { void loop() {
MQ9.update(); // Update data, the arduino will be read the voltaje in the analog pin MQ9.update(); // Update data, the arduino will be read the voltaje in the analog pin
/*
//Si el valor de RL es diferente a 10K por favor asigna tu valor de RL con el siguiente metodo:
MQ9.setRL(10);
*/
/* /*
//Rutina de calibracion - Uncomment if you need (setup too and header) //Rutina de calibracion - Uncomment if you need (setup too and header)
if(calibration_button) if(calibration_button)
{ {
float R0 = MQ9.calibrate(); float R0 = MQ9.calibrate();
MQ9.setR0(R0): MQ9.setR0(R0);
} }
*/ */
/***************************** MQReadSensor **************************************** /***************************** MQReadSensor ****************************************

View File

@ -1,10 +1,11 @@
name=MQUnifiedsensor name=MQUnifiedsensor
version=1.0.2 version=1.0.4
author= Miguel Califa <miguelangel5612@gmail.com>, Yersson Carrillo <miguelangel5612@gmail.com>, Ghiordy Contreras <miguelangel5612@gmail.com> author= Miguel Califa <miguelangel5612@gmail.com>, Yersson Carrillo <miguelangel5612@gmail.com>, Ghiordy Contreras <miguelangel5612@gmail.com>
maintainer= Miguel Califa <miguelangel5612@gmail.com> maintainer= Miguel Califa <miguelangel5612@gmail.com>
sentence= This library allows you to read the MQ sensors very easily. sentence= This library allows you to read the MQ sensors very easily.
paragraph= This library allows an Arduino/Genuino board to read MQ Sensors (AIr quality meter) references: MQ2, MQ3, MQ4, MQ5, MQ6, MQ7, MQ8, MQ9, MQ131, MQ135, MQ303A, MQ309A. paragraph= This library allows an Arduino/Genuino board to read MQ Sensors (AIr quality meter) references: MQ2, MQ3, MQ4, MQ5, MQ6, MQ7, MQ8, MQ9, MQ131, MQ135, MQ303A, MQ309A.
category= Sensors category= Sensors
url=https://github.com/miguel5612/MQSensorsLib url=https://github.com/miguel5612/MQSensorsLib
architectures=*
architectures=avr architectures=avr
license=MIT license=MIT

View File

@ -562,6 +562,14 @@ void MQUnifiedsensor::setR0(double R0) {
double MQUnifiedsensor::getR0() { double MQUnifiedsensor::getR0() {
return _R0; return _R0;
} }
void MQUnifiedsensor::setRL(double RL) {
this->_RLValue = RL;
}
double MQUnifiedsensor::getRL() {
return _RLValue;
}
void MQUnifiedsensor::setDefaultGas() void MQUnifiedsensor::setDefaultGas()
{ {
if(_type == 2) if(_type == 2)

View File

@ -255,6 +255,7 @@ class MQUnifiedsensor
void inicializar(); void inicializar();
void update(); void update();
void setR0(double R0 = 10); void setR0(double R0 = 10);
void setRL(double RL = 10);
void setVoltResolution(float voltaje = 5); void setVoltResolution(float voltaje = 5);
void setSensorCharacteristics(String nameLectureReqeuired = "", bool print = false); void setSensorCharacteristics(String nameLectureReqeuired = "", bool print = false);
void setDefaultGas(); void setDefaultGas();
@ -265,6 +266,7 @@ class MQUnifiedsensor
//get function for info //get function for info
double getR0(); double getR0();
double getRL();
double getVoltage(int read = true); double getVoltage(int read = true);
double stringToDouble(String & str); double stringToDouble(String & str);
String getnameLecture(); String getnameLecture();