mirror of
https://github.com/miguel5612/MQSensorsLib.git
synced 2025-07-02 02:11:04 +03:00
Updated examples to MQ-4
This commit is contained in:
@ -31,9 +31,6 @@
|
||||
//Declare Sensor
|
||||
MQUnifiedsensor MQ3(placa, Voltage_Resolution, ADC_Bit_Resolution, pin, type);
|
||||
|
||||
//Variables
|
||||
float CH4, LPG, CO, Alcohol, Hexane, Benzine;
|
||||
|
||||
void setup() {
|
||||
//Init the serial port communication - to debug the library
|
||||
Serial.begin(9600); //Init serial port
|
||||
@ -41,7 +38,17 @@ void setup() {
|
||||
//Set math model to calculate the PPM concentration and the value of constants
|
||||
MQ3.setRegressionMethod("Exponential"); //_PPM = a*ratio^b
|
||||
MQ3.setA(4.8387); MQ3.setB(-2.68); // Configurate the ecuation values to get Benzene concentration
|
||||
|
||||
/*
|
||||
Exponential regression:
|
||||
Gas | a | b
|
||||
LPG | 44771 | -3.245
|
||||
CH4 | 2*10^31| 19.01
|
||||
CO | 521853 | -3.821
|
||||
Alcohol| 0.3934 | -1.504
|
||||
Benzene| 4.8387 | -2.68
|
||||
Hexane | 7585.3 | -2.849
|
||||
*/
|
||||
|
||||
// Calibration setup
|
||||
MQ3.setR0(3.86018237);
|
||||
|
||||
|
Reference in New Issue
Block a user