I'm using a few gas sensors (MQ2, MQ3, MQ4, MQ5, MQ6, MQ7, MQ8, MQ9, and MQ135) to measure the air quality inside my home. These sensors have been calibrated to work within a specific concentration range (i.e. 200 - 10000ppm). Here's an example model from one of the datasheets: MQ2 Sensitivity Characteristics

Rs = Resistance of the Sensor

Ro = Resistance of the Sensor in Clean Air

An Arduino reads the values from the sensor. I then convert the Rs/Ro value to PPM using y = mx + b, where y = Log(Rs/Ro) and x = Log(PPM).

When concentrations are too low (<200ppm) or too high (>10000ppm), the Rs/Ro value falls outside the model. What should I do with the values that fall outside the model's range?

  • $\begingroup$ As you state the senors are calibrated to operate for a specific range of values. Any value outside that range is unreliable/anomalous and should be ignored. $\endgroup$
    – Fred
    Mar 10 at 15:52
  • $\begingroup$ I agree, you can't rely on the sensor outside the published range of calibration. For non-critical uses you might choose to estimate slightly outside that range assuming the model would still be valid, or you could conduct your own calibration experiments at higher or lower concentrations. $\endgroup$
    – Andy M
    Mar 10 at 16:28
  • $\begingroup$ Thank you for replying to my question. I'll update my code to ignore the sensor readings that fall outside the calibrated range. $\endgroup$ Mar 11 at 0:04
  • $\begingroup$ Don't just ignore them. I'll add details in an answer. $\endgroup$ Mar 11 at 7:33

1 Answer 1


I'll update my code to ignore the sensor readings that fall outside the calibrated range.

Do not do that. Instead flag them as off-scale low or off-scale high. Those off-scale low / off-scale high values might mean that the sensor is failing, or that the battery is about to die.

Or it could just mean that the sensor gave a one-off glitchy measurement. Sensors do do this, with great regularity. It is a good idea with regard to sensor processing to have a quality flag associated with the sensor. An occasional glitchy measurement is something one should expect. Rare glitchy measurements are best ignored, but still should be tracked. An excess of isolated glitchy measurements is an indicator of sensor / battery health.

On the other hand, an off-scale reading could well mean your house is about to burst into flames. Simply ignoring those off-scale readings is a bad idea.

  • $\begingroup$ Thank you, David. I'll store the values when it's off-scale low or high and figure out how to visualize it so I can see how often the readings are off scale. Also, I'm using a 5V 10A power supply, so it won't be an issue with low power. $\endgroup$ Mar 12 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.