mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-03-25 10:10:01 +03:00
Fixed calibration
This commit is contained in:
parent
e848e505b0
commit
b69d85d6be
6
.vscode/c_cpp_properties.json
vendored
6
.vscode/c_cpp_properties.json
vendored
@ -3,8 +3,10 @@
|
|||||||
{
|
{
|
||||||
"name": "Win32",
|
"name": "Win32",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"C:\\\\\\\\Users\\\\\\\\migue\\\\\\\\AppData\\\\\\\\Local\\\\\\\\Arduino15\\\\\\\\packages\\\\\\\\esp8266\\\\\\\\tools\\\\\\\\**",
|
"C:\\\\Users\\\\migue\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\esp8266\\\\tools\\\\**",
|
||||||
"C:\\\\\\\\Users\\\\\\\\migue\\\\\\\\AppData\\\\\\\\Local\\\\\\\\Arduino15\\\\\\\\packages\\\\\\\\esp8266\\\\\\\\hardware\\\\\\\\esp8266\\\\\\\\2.4.2\\\\\\\\**"
|
"C:\\\\Users\\\\migue\\\\AppData\\\\Local\\\\Arduino15\\\\packages\\\\esp8266\\\\hardware\\\\esp8266\\\\2.4.2\\\\**",
|
||||||
|
"C:\\Users\\migue\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.2\\**",
|
||||||
|
"C:\\Users\\migue\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\**"
|
||||||
],
|
],
|
||||||
"forcedInclude": [],
|
"forcedInclude": [],
|
||||||
"intelliSenseMode": "msvc-x64",
|
"intelliSenseMode": "msvc-x64",
|
||||||
|
@ -95,27 +95,28 @@ void setup() {
|
|||||||
//Print in serial monitor
|
//Print in serial monitor
|
||||||
Serial.println("MQ2 to MQ9 - Calibracion");
|
Serial.println("MQ2 to MQ9 - Calibracion");
|
||||||
Serial.println("Note - Make sure you are in a clean room and the sensor has pre-heated almost 4 hours");
|
Serial.println("Note - Make sure you are in a clean room and the sensor has pre-heated almost 4 hours");
|
||||||
|
Serial.println("Note - All values are in KOhms");
|
||||||
Serial.println("Autonumeric, MQ2(R0), MQ3(R0), MQ4(R0), MQ5(R0), MQ6(R0), MQ7(R0)");
|
Serial.println("Autonumeric, MQ2(R0), MQ3(R0), MQ4(R0), MQ5(R0), MQ6(R0), MQ7(R0)");
|
||||||
//Wait one second to continue
|
//Wait one second to continue
|
||||||
delay(timeDelay/10);
|
delay(timeDelay/10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
//Review in serial port the measures
|
|
||||||
bool printRawData = true;
|
|
||||||
//Read the sensor
|
//Read the sensor
|
||||||
int lecture2 = MQ2.calibrate(printRawData);
|
int lecture2 = MQ2.calibrate();
|
||||||
int lecture3 = MQ3.calibrate(printRawData);
|
int lecture3 = MQ3.calibrate();
|
||||||
int lecture4 = MQ4.calibrate(printRawData);
|
int lecture4 = MQ4.calibrate();
|
||||||
int lecture5 = MQ5.calibrate(printRawData);
|
int lecture5 = MQ5.calibrate();
|
||||||
int lecture6 = MQ6.calibrate(printRawData);
|
int lecture6 = MQ6.calibrate();
|
||||||
int lecture7 = MQ7.calibrate(printRawData);
|
int lecture7 = MQ7.calibrate();
|
||||||
int lecture8 = MQ8.calibrate(printRawData);
|
int lecture8 = MQ8.calibrate();
|
||||||
int lecture9 = MQ9.calibrate(printRawData);
|
int lecture9 = MQ9.calibrate();
|
||||||
|
|
||||||
|
|
||||||
//Print in serial monitor
|
//Print in serial monitor
|
||||||
char out[40];
|
char out[40];
|
||||||
|
//snprintf(out, 30, "%d,%d,%d,%d,%d,%d,%d,%d", contador, lecture2, lecture3, lecture4, lecture5, lecture6, lecture7, lecture8, lecture9);
|
||||||
snprintf(out, 30, "%d,%d,%d,%d,%d,%d,%d,%d", contador, lecture2, lecture3, lecture4, lecture5, lecture6, lecture7, lecture8, lecture9);
|
snprintf(out, 30, "%d,%d,%d,%d,%d,%d,%d,%d", contador, lecture2, lecture3, lecture4, lecture5, lecture6, lecture7, lecture8, lecture9);
|
||||||
Serial.println(out);
|
Serial.println(out);
|
||||||
|
|
||||||
|
@ -527,7 +527,7 @@ int MQUnifiedsensor::readPPM(int m, int b) {
|
|||||||
double ppm = pow(10, ppm_log); //Convert ppm value to log scale
|
double ppm = pow(10, ppm_log); //Convert ppm value to log scale
|
||||||
return floor(ppm);
|
return floor(ppm);
|
||||||
}
|
}
|
||||||
int MQUnifiedsensor::calibrate(boolean print) {
|
float MQUnifiedsensor::calibrate(boolean print) {
|
||||||
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
//More explained in: https://jayconsystems.com/blog/understanding-a-gas-sensor
|
||||||
/*
|
/*
|
||||||
V = I x R
|
V = I x R
|
||||||
|
@ -274,7 +274,7 @@ class MQUnifiedsensor
|
|||||||
int readSensor(String nameLectureRequeired = "", bool print = false);
|
int readSensor(String nameLectureRequeired = "", bool print = false);
|
||||||
int readPPM(int m, int b);
|
int readPPM(int m, int b);
|
||||||
|
|
||||||
int calibrate(boolean print = false);
|
float calibrate(boolean print = false);
|
||||||
double getVoltage();
|
double getVoltage();
|
||||||
double stringToDouble(String & str);
|
double stringToDouble(String & str);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user