mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-07-03 02:41:02 +03:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
3261318577 | |||
b85e7520d4 | |||
b2616295a3 | |||
886bfd9981 | |||
cfe8ccc6ad | |||
a9aba676e2 | |||
f351f6bdf2 | |||
aedc9edb8e | |||
6addbeb50b | |||
43cb57012d | |||
5fefa8ab66 | |||
5a911a2149 | |||
620b7c0cf0 | |||
bff0304e3f | |||
9a43163cae |
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
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.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
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.
|
61
README.md
61
README.md
@ -1,3 +1,6 @@
|
||||
[](https://zenodo.org/badge/latestdoi/170540207)
|
||||

|
||||
|
||||
# MQSensorsLib
|
||||
|
||||
This is a unified library to use sensors MQ: 2, 3, 4, 5, 6, 7, 8, 9, 131, 135, 303A and 309A.
|
||||
@ -11,10 +14,10 @@ float ppmCH4 = MQ4.readSensor();
|
||||
|
||||
### Prerequisites
|
||||
|
||||
You'll need Arduino desftop app 1.8.9 or later.
|
||||
You'll need Arduino desktop app 1.8.9 or later.
|
||||
|
||||
### Sensor manufacter:
|
||||
| Sensor | Manufacter | URL Datasheet |
|
||||
### Sensor manufacture:
|
||||
| Sensor | Manufacture | URL Datasheet |
|
||||
|----------|----------|----------|
|
||||
| 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) |
|
||||
@ -35,7 +38,7 @@ Review WPDigitalizer [folder](https://github.com/miguel5612/MQSensorsLib/tree/ma
|
||||
|
||||
### Installing
|
||||
|
||||
Clone this repositry into your desktop machine
|
||||
Clone this repository into your desktop machine
|
||||
|
||||
```
|
||||
git clone https://github.com/miguel5612/MQSensorsLib
|
||||
@ -48,7 +51,7 @@ Use calibration systems if you have several sensors that read the same gas.
|
||||
|
||||
### Break down into end to end tests
|
||||
|
||||
These test can re-adjust values defined previously and you can contribute to improve conditions or features obtained from particular scenes.
|
||||
These tests can re-adjust values defined previously and you can contribute to improve conditions or features obtained from particular scenes.
|
||||
|
||||
```
|
||||
Examples/MQ-3
|
||||
@ -56,7 +59,7 @@ Examples/MQ-3
|
||||
|
||||
### And coding style tests
|
||||
|
||||
These tests may generate statistics validation using descriptive tools for cuantitative variables.
|
||||
These tests may generate statistics validation using descriptive tools for quantitative variables.
|
||||
|
||||
```
|
||||
Examples/MQ-board.ino
|
||||
@ -77,7 +80,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)
|
||||
* **Yersson R. Carrillo A.** - [*GitHub*](https://github.com/Yercar18/Dronefenix) - [CV](https://scienti.colciencias.gov.co/cvlac/visualizador/generarCurriculoCv.do?cod_rh=0001637655)
|
||||
|
||||
## Colaborators
|
||||
## Collaborators
|
||||
|
||||
* **Andres A. Martinez.**
|
||||
* **Juan A. Rodríguez.** - [*Github*](https://github.com/Obiot24)
|
||||
@ -88,3 +91,47 @@ See also the list of [contributors](https://github.com/miguel5612/MQSensorsLib/c
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
||||
|
||||
## Cite as
|
||||
|
||||
* Plain text: Califa Urquiza, Miguel Angel, Contreras Contreras, Ghiordy, & Carrillo Amado, Yerson Ramiro. (2019, September 3). miguel5612/MQSensorsLib: Arduino Preview V1.03 (Version 1.0.3). Zenodo. http://doi.org/10.5281/zenodo.3384301
|
||||
* CSL: {
|
||||
"publisher": "Zenodo",
|
||||
"DOI": "10.5281/zenodo.3384301",
|
||||
"title": "miguel5612/MQSensorsLib: Arduino Preview V1.03",
|
||||
"issued": {
|
||||
"date-parts": [
|
||||
[
|
||||
2019,
|
||||
9,
|
||||
3
|
||||
]
|
||||
]
|
||||
},
|
||||
"abstract": "<p>Publishing on Zenodo platform as software in order to extend its applications for other works allowing to recognize MQSensorLib's Authors this work into scientific community using Digital Object Identifier System (DOI).</p>",
|
||||
"author": [
|
||||
{
|
||||
"family": "Califa Urquiza, Miguel Angel"
|
||||
},
|
||||
{
|
||||
"family": "Contreras Contreras, Ghiordy"
|
||||
},
|
||||
{
|
||||
"family": "Carrillo Amado, Yerson Ramiro"
|
||||
}
|
||||
],
|
||||
"version": "1.0.3",
|
||||
"type": "article",
|
||||
"id": "3384301"
|
||||
}
|
||||
* BibTeX:
|
||||
@misc{califa_urquiza_miguel_angel_2019_3384301,
|
||||
author = {Califa Urquiza, Miguel Angel and
|
||||
Contreras Contreras, Ghiordy and
|
||||
Carrillo Amado, Yerson Ramiro},
|
||||
title = {miguel5612/MQSensorsLib: Arduino Preview V1.03},
|
||||
month = sep,
|
||||
year = 2019,
|
||||
doi = {10.5281/zenodo.3384301},
|
||||
url = {https://doi.org/10.5281/zenodo.3384301}
|
||||
}
|
||||
|
@ -6,6 +6,5 @@ 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.
|
||||
category= Sensors
|
||||
url=https://github.com/miguel5612/MQSensorsLib
|
||||
architectures=*
|
||||
architectures=avr
|
||||
license=MIT
|
||||
|
@ -107,8 +107,12 @@ float MQUnifiedsensor::readSensor(String nameLectureRequeired, bool print)
|
||||
setSensorCharacteristics(nameLectureRequeired, print); //In this function update _a and _b
|
||||
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
||||
_RS_Calc = ((_VOLT_RESOLUTION*_RLValue)/_sensor_volt)-_RLValue; //Get value of RS in a gas
|
||||
if(_RS_Calc < 0) _RS_Calc = 0; //No negative values accepted.
|
||||
_ratio = _RS_Calc / this->_R0; // Get ratio RS_gas/RS_air
|
||||
if(_ratio <= 0 || _ratio>100) _ratio = 0.01; //No negative values accepted or upper datasheet recomendation.
|
||||
_PPM= _a*pow(_ratio, _b);
|
||||
if(_PPM < 0) _PPM = 0; //No negative values accepted or upper datasheet recomendation.
|
||||
if(_PPM > 10000) _PPM = 9999; //No negative values accepted or upper datasheet recomendation.
|
||||
|
||||
if(print)
|
||||
{
|
||||
@ -521,8 +525,10 @@ float MQUnifiedsensor::calibrate(boolean print) {
|
||||
*/
|
||||
float RS_air; //Define variable for sensor resistance
|
||||
float R0; //Define variable for R0
|
||||
RS_air = ((_VOLT_RESOLUTION*_RLValue)/_sensor_volt)-_RLValue; //Calculate RS in fresh air
|
||||
RS_air = ((_VOLT_RESOLUTION*_RLValue)/_sensor_volt)-_RLValue; //Calculate RS in fresh air
|
||||
if(RS_air < 0) RS_air = 0; //No negative values accepted.
|
||||
R0 = RS_air/_ratioInCleanAir; //Calculate R0
|
||||
if(R0 < 0) R0 = 0; //No negative values accepted.
|
||||
if(print)
|
||||
{
|
||||
Serial.println("*******Calibrating*********");
|
||||
|
@ -275,14 +275,14 @@ class MQUnifiedsensor
|
||||
|
||||
private:
|
||||
/************************Private vars************************************/
|
||||
int _pin, _type, _lecturePosInArray;
|
||||
double _R0;
|
||||
String _nameLectureRequeired;
|
||||
int _VOLT_RESOLUTION = 5.0; // if 3.3v use 3.3
|
||||
int _RLValue = 10; //Value in KiloOhms
|
||||
float _PPM, _RS_Calc;
|
||||
float _ratioInCleanAir, _sensor_volt, RS_air, _a, _b, _ratio;
|
||||
|
||||
byte _pin, _type, _lecturePosInArray;
|
||||
byte _VOLT_RESOLUTION = 5.0; // if 3.3v use 3.3
|
||||
byte _ratioInCleanAir, _sensor_volt;
|
||||
byte _RLValue = 10; //Value in KiloOhms
|
||||
float _R0, RS_air, _ratio, _PPM, _RS_Calc;
|
||||
float _b;
|
||||
double _a;
|
||||
String _nameLectureRequeired;
|
||||
};
|
||||
|
||||
#endif //MQUnifiedsensor_H
|
||||
|
Reference in New Issue
Block a user