How to use an MQ gas sensor with Humidity and Temperature

Hello, I am using an MQ4 sensor to estimate methane in the air. I want to make the MQ sensor as accurate as I can, and one thing the datasheet shows (https://www.sparkfun.com/datasheets/Sensors/Biometric/MQ-4.pdf) is that the ppm of gas detected is effected by temperature and humidity (shown by the second graph). However the past few days I have been having issues figuring out the math to take the ppm from the first graph and combine it with humidity and temperature with the second graph to receive an updated ppm value.

This is the best resource I have found - Davide Gironi: MQ gas sensor correlation function against temperature and humidity The method of using linear interpolation makes sense to me, but most of the math does not. Does the math he implements in his project seem accurate?

What I tried: I saw that the dependence curve (the one showing the effect of humidity) shows that the curves for each humidity value seem to be equivalent with a change in the y-intercept, so I thought that maybe I could estimate the graph for a specific humidity and then use it to change the original ppm value.
The only thing I am missing is the differences in the R0 values from the different graphs. If the first graph shows a point at (1000,1) for CH4 and 65% humidity, why does the second graph show the point (20,1) for 33% humidity?

Any clarification or even links to code or examples would be greatly appreciated!

If you want reasonably accurate methane concentration measurements, buy a better quality sensor.

The MQ sensors are dirt cheap for a reason: they are very crude, difficult to impossible to calibrate, respond to many different gases and are intended ONLY to alert you that something in the ambient mixture of gases has changed.

2 Likes