miguel5612 / MQSensorsLib

We present a unified library for MQ sensors, this library allows to read MQ signals easily from Arduino, Genuino, ESP8266, ESP-32 boards whose references are MQ2, MQ3, MQ4, MQ5, MQ6, MQ7, MQ8, MQ9, MQ131, MQ135, MQ136, MQ303A, MQ309A.
MIT License
173 stars 64 forks source link

Parameters to model temperature and humidity dependence #70

Open pjcm97 opened 1 year ago

pjcm97 commented 1 year ago

Hello Miguel,

I have gone through the MQ-135-CorrectionFactorDHT11 document, and there are a few parameters that are not entirely clear to me.

I would like to use the correction factor for temperature and humidity for the MQ-4 sensor, which is designed for methane detection, and the MQ-8 sensor, which is used for hydrogen detection, as well as the MQ-135 sensor for CO2 detection. Could you please provide guidance on where I can obtain these correction factors for the MQ-4 and MQ-8 sensors?

Here are the parameters I'm particularly interested in:

#define` MQ135_DEFAULTPPM 399 // default ppm of CO2 for calibration
#define MQ135_DEFAULTRO 68550 // default Ro for MQ135_DEFAULTPPM ppm of CO2
#define MQ135_SCALINGFACTOR 116.6020682 // CO2 gas value
#define MQ135_EXPONENT -2.769034857 // CO2 gas value
#define MQ135_MAXRSRO 2.428 // for CO2
#define MQ135_MINRSRO 0.358 // for CO2

/// Parameters for calculating ppm of CO2 from sensor resistance
#define PARA 116.6020682
#define PARB 2.769034857

/// Parameters to model temperature and humidity dependence
#define CORA 0.00035
#define CORB 0.02718
#define CORC 1.39538
#define CORD 0.0018

I greatly appreciate your work!

Thank you so much!

snico2 commented 11 months ago

I'm also interested in being able to apply the correction based on temperature and humidity. I found this old article online https://davidegironi.blogspot.com/2017/07/mq-gas-sensor-correlation-function.html where the method is explained, but I didn't understand much (the code for AVR is attached to the article).

Looking at the code "MQ-135-CorrectionFactorDHT11.ino" it seems that it is not complete as the functions are not used getCorrectedPPM getCorrectedResistance Why doesn't the correctionFactor also apply to R0?

It would be wonderful if the library could also include CorrectionFactor for other MQ sensors.

Congratulations go to Miguel for the excellent work done

miguel5612 commented 2 months ago

Thank you for your interest in applying temperature and humidity correction factors to other MQ sensors. We agree that adding support for the MQ-4 and MQ-8 sensors would be a valuable enhancement to the library. If you're able to implement the correction factors for these sensors, we would greatly appreciate it if you could contribute a pull request. Your input would help expand the functionality of the library and benefit the community.

Thank you for your continued support, and we look forward to your contributions!