Improving The Accuracy Of Gas Sensors

If you need a sensor to detect gasses of some sort, you’ll probably be looking at the MQ series of gas sensors. These small metal cylinders contain a heater and some electrochemical sensor. Wire the heater up to a voltage, and connect one end of the resistor to an ADC, and you have a sensor for alcohol vapors, hydrogen sulfide, carbon monoxide, or ozone, depending on which model of sensor you’ve picked up.

These are simple analog devices, and as you would expect they’re sensitive to both temperature and humidity. [Davide Gironi] wanted a more accurate gas sensor, so he’s diving into a bit of overengineering and correlating the output of these sensors against temperature and humidity.

There’s a difference between accuracy and precision, and if you want to calibrate gas sensors, you’ll need to calibrate them against something. Instead of digging out a gas sensor of known precision, [Davide] took the easy way out: he graphed the curves on the datasheets for these sensors. It’s brilliant in its simplicity.

These numbers were thrown into R, and with a bit of work, [Davide] had a look up table of various concentrations of gasses plotted against certain resistances. In testing these sensors, he found a higher correlation between humidity and temperature and gas concentrations, which one would expect.

The files for these sensors are available on [Davide]’s website, and he included a neat little video showing everyone what went into these calculations. You can check that out below.

12 thoughts on “Improving The Accuracy Of Gas Sensors

  1. >>and if you want to calibrate gas sensors, you’ll need to calibrate them against something

    Which is why every lab and field unit in the world is calibrated against a standard.
    Sure ultimately NIST or the EU equivalent has a batch of known good sensors, but for the rest of the world you use a calibration sample. For the calibration labs, they use compounds not subject to such swings. The sample is run at least daily, generally after X samples you run another standard to account for drift.
    As for humidity and temperature, that doesn’t matter so much once you get a calibration curve. So long as the drift is consistent over a sample run you can add or subtract out the noise.

  2. I’ve tried to use one of the MQ series to measure CO2 concentrations. After a lot of testing I found them to be horrible inconsistent as they returned different values every time we did a series of measurements whilst the CO2 levels remained stable. Maybe different types for other gasses provide better results but for CO2 look somewhere else.

  3. Hijacking the word “precision” to cover a variety of errors is one of the most annoying acts. It would be interesting to know when this happened as I’ve mostly come across this when presented as if it’s a grand revelation. The article seems to get it wrong as a very precise sensor could also have a very wrong answer, per the QA/QC mangling of the meaning.

    1. Since we’re dealing with metrology here, the International Vocabulary of Metrology seems a reasonable source for the definition:

      Measurement accuracy:
      closeness of agreement between a measured quantity value and a true quantity value of a measurand

      Measurement precision
      closeness of agreement between indications or measured quantity values obtained by replicate measurements on the same or similar objects under specified conditions

  4. Isn’t a gas sensor calibrated against a known calibration gas with a known composition (eg 5.000% helium to 95.000 nitrogen for example). It’d be pretty hard to calibrate 2 gas sensors against one another and making sure they each get the exact same gas composition.

    1. No much harder than calibrating one sensor against a known standard. You don’t have to calibrate both at the same time to check the accuracy of your circuit and method.
      But if you’re calibrating a new sensor and circuit design you’re not gonna get away with a single point calibration check. You’re gonna have to run a few calibration curves for each sensor.

  5. You know, I just came from a section where a low grade clickbait/controversial article by this guy had 60+ comments. Here is a great article that we should see more of but it only has 10.

    I understand your jadedness, Brian.

  6. Thanks for the heads up. I have abandoned the MQ sensor for CO2 measurement in favor of an inexpensive NDIR device available on Aliexpress. Wonder what its accuracy will be like?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.