Skip to content

Calibration coefficients

The library computes a gas concentration as ppm = a * (Rs/R0)^b. The values of a and b are passed to setCurve(a, b). This page lists every pair fitted from a datasheet curve, and then every pair the example sketches use.

Each fit is a straight line through digitised points on log-log axes. It describes the datasheet's typical curve over the range of the points, not an individual sensor, and should not be used outside that range. None has been validated against hardware.

Fitted curves

One row per curve. Where a curve has been re-derived from its datasheet, that is the source of its fit, and the hand-read points for the same gas are kept below as a comparison. Where it has not, the hand-read points are the source.

Sensor Gas a b Concentration range Rs/R0 range Points r² Largest error Datasheet Points from
MQ-2 alcohol 3553.2 -2.707 203 to 10000 ppm 0.655 to 2.84 9 0.9974 11 % mq-2-hanwei-2009 marked
MQ-2 CH4 4189.7 -2.628 203 to 10000 ppm 0.694 to 3.03 9 0.9971 12 % mq-2-hanwei-2009 marked
MQ-2 CO 29571 -2.974 203 to 10000 ppm 1.41 to 5.24 9 0.9991 6 % mq-2-hanwei-2009 marked
MQ-2 H2 980.95 -2.112 203 to 10000 ppm 0.332 to 2.09 9 0.9998 4 % mq-2-hanwei-2009 marked
MQ-2 LPG 564.77 -2.151 201 to 10000 ppm 0.255 to 1.58 9 0.9990 7 % mq-2-hanwei-2009 marked
MQ-2 propane 645.86 -2.166 203 to 10000 ppm 0.274 to 1.70 9 0.9992 6 % mq-2-hanwei-2009 marked
MQ-3 alcohol 0.39304 -1.495 0.103 to 9.98 mg/L 0.114 to 2.31 10 0.9991 9 % mq-3-hanwei-2007 extracted
MQ-3 benzene 4.7380 -2.688 0.103 to 9.96 mg/L 0.784 to 4.07 10 0.9982 11 % mq-3-hanwei-2007 extracted
MQ-3 CH4 3.8391e+32 -19.76 0.103 to 9.98 mg/L 39.8 to 49.8 10 0.9848 58 % mq-3-hanwei-2007 extracted
MQ-3 CO 715790 -3.895 0.103 to 9.96 mg/L 16.2 to 51.1 10 0.9749 55 % mq-3-hanwei-2007 extracted
MQ-3 hexane 7121.4 -2.825 0.103 to 10.0 mg/L 10.0 to 52.2 10 0.9986 10 % mq-3-hanwei-2007 extracted
MQ-3 LPG 55529 -3.281 0.103 to 10.0 mg/L 13.1 to 52.2 10 0.9885 26 % mq-3-hanwei-2007 extracted
MQ-4 alcohol 4.7360e+10 -13.79 201 to 10000 ppm 3.05 to 4.04 4 0.9992 7 % mq-4-hanwei-2007 extracted
MQ-4 CH4 990.22 -2.826 200 to 9960 ppm 0.439 to 1.76 4 0.9999 2 % mq-4-hanwei-2007 extracted
MQ-4 CO 3.6362e+14 -19.54 201 to 10000 ppm 3.52 to 4.28 4 0.9472 82 % mq-4-hanwei-2007 extracted
MQ-4 H2 360990 -5.634 200 to 9980 ppm 1.89 to 3.80 4 0.9998 4 % mq-4-hanwei-2007 extracted
MQ-4 LPG 3736.2 -3.121 200 to 9980 ppm 0.740 to 2.58 4 0.9994 4 % mq-4-hanwei-2007 extracted
MQ-4 smoke 4.7509e+07 -8.836 200 to 9960 ppm 2.55 to 3.92 4 0.9679 36 % mq-4-hanwei-2007 extracted
MQ-5 alcohol 67573 -4.526 199 to 10000 ppm 1.45 to 3.51 9 0.9894 26 % mq-5-hanwei-2007 extracted
MQ-5 CH4 183.51 -2.562 200 to 9980 ppm 0.204 to 0.953 9 0.9989 7 % mq-5-hanwei-2007 extracted
MQ-5 CO 1.6098e+06 -6.843 199 to 10000 ppm 2.27 to 3.90 9 0.9493 41 % mq-5-hanwei-2007 extracted
MQ-5 H2 1163.2 -3.892 200 to 9980 ppm 0.657 to 1.73 9 0.9397 40 % mq-5-hanwei-2007 extracted
MQ-5 LPG 77.016 -2.501 199 to 9960 ppm 0.146 to 0.700 9 0.9991 6 % mq-5-hanwei-2007 extracted
MQ-6 alcohol 5.2963e+07 -6.004 200 to 9980 ppm 4.22 to 7.96 9 0.9982 8 % mq-6-hanwei-2007 extracted
MQ-6 CH4 2195.3 -2.507 200 to 10000 ppm 0.546 to 2.60 9 0.9996 5 % mq-6-hanwei-2007 extracted
MQ-6 CO 1.5935e+14 -12.53 201 to 10000 ppm 6.44 to 8.86 9 0.9907 19 % mq-6-hanwei-2007 extracted
MQ-6 H2 93440 -3.640 200 to 9980 ppm 2.04 to 5.72 9 0.9773 30 % mq-6-hanwei-2007 extracted
MQ-6 LPG 1025.1 -2.368 200 to 10000 ppm 0.391 to 2.04 9 0.9991 5 % mq-6-hanwei-2007 extracted
MQ-7 alcohol 1.4350e+19 -14.58 50.0 to 4040 ppm 12.1 to 16.1 5 0.9398 81 % mq-7-hanwei-2007 extracted
MQ-7 CH4 5.5816e+13 -10.49 50.0 to 4040 ppm 9.02 to 13.9 5 0.9631 39 % mq-7-hanwei-2007 extracted
MQ-7 CO 98.691 -1.528 49.8 to 4020 ppm 0.0908 to 1.60 5 0.9992 9 % mq-7-hanwei-2007 extracted
MQ-7 H2 70.057 -1.365 49.5 to 4010 ppm 0.0521 to 1.27 5 0.9998 3 % mq-7-hanwei-2007 extracted
MQ-7 LPG 7.7057e+08 -7.570 49.8 to 4020 ppm 5.02 to 9.02 5 0.9982 9 % mq-7-hanwei-2007 extracted
MQ-8 alcohol 48842 -1.691 199 to 10000 ppm 2.35 to 24.6 9 0.9955 15 % mq-8-hanwei-2009 extracted
MQ-8 CH4 8.3559e+13 -6.675 200 to 9990 ppm 29.6 to 54.4 9 0.9728 47 % mq-8-hanwei-2009 extracted
MQ-8 CO 2.0195e+16 -7.606 199 to 10000 ppm 40.1 to 65.2 9 0.9608 60 % mq-8-hanwei-2009 extracted
MQ-8 H2 973.62 -0.6902 200 to 9990 ppm 0.0291 to 8.46 9 0.9970 12 % mq-8-hanwei-2009 extracted
MQ-8 LPG 8.3383e+07 -3.767 199 to 9990 ppm 12.6 to 34.4 9 0.9445 40 % mq-8-hanwei-2009 extracted
MQ-8 H2 2.1898 -2.587 101 to 9900 ppm 0.0404 to 0.248 321 0.9952 20 % mq-8-winsen-v1.3 traced
MQ-9 CH4 4224.5 -2.596 201 to 9950 ppm 0.689 to 3.14 9 0.9976 12 % mq-9-hanwei-2008 marked
MQ-9 CO 580.02 -2.220 199 to 990 ppm 0.783 to 1.62 4 0.9993 2 % mq-9-hanwei-2008 marked
MQ-9 LPG 971.09 -2.140 201 to 10000 ppm 0.333 to 2.04 9 0.9995 5 % mq-9-hanwei-2008 marked
MQ-9B CH4 3.4756 -2.593 473 to 8430 ppm 0.0499 to 0.153 120 0.9996 5 % mq-9b-winsen-v1.4 traced
MQ-9B CO 0.72228 -1.821 11.7 to 864 ppm 0.0219 to 0.223 174 0.9986 13 % mq-9b-winsen-v1.4 traced
MQ-131 Cl2 48.425 -1.181 5.00 to 99.2 ppm 0.505 to 6.05 5 0.9903 16 % mq-131-2009 marked
MQ-131 NOx 470.06 -2.218 5.00 to 97.8 ppm 2.04 to 8.09 5 0.9951 12 % mq-131-2009 marked
MQ-131 O3 24.264 -1.117 5.00 to 99.2 ppm 0.288 to 3.99 5 0.9991 4 % mq-131-2009 marked
MQ-135 acetone 34.544 -3.402 10.0 to 201 ppm 0.587 to 1.43 3 0.9982 7 % mq-135-hanwei extracted
MQ-135 alcohol 76.939 -3.173 9.98 to 200 ppm 0.735 to 1.90 3 0.9996 3 % mq-135-hanwei extracted
MQ-135 CO 610.01 -3.960 9.98 to 200 ppm 1.35 to 2.84 3 0.9978 8 % mq-135-hanwei extracted
MQ-135 CO2 109.66 -2.856 10.0 to 200 ppm 0.800 to 2.30 3 0.9993 5 % mq-135-hanwei extracted
MQ-135 NH4 102.29 -2.484 10.0 to 200 ppm 0.766 to 2.55 3 1.0000 1 % mq-135-hanwei extracted
MQ-135 toluene 44.880 -3.443 10.0 to 200 ppm 0.642 to 1.54 3 0.9994 4 % mq-135-hanwei extracted
MQ-136 CO 605.09 -3.909 9.99 to 200 ppm 1.35 to 2.87 3 0.9969 10 % mq-136-hanwei-2004 marked
MQ-136 H2S 36.716 -3.481 10.1 to 201 ppm 0.602 to 1.44 3 0.9972 9 % mq-136-hanwei-2004 marked
MQ-136 NH4 103.49 -2.479 10.1 to 198 ppm 0.776 to 2.57 3 0.9998 3 % mq-136-hanwei-2004 marked
MQ-136 H2S 0.13471 -3.775 1.12 to 181 ppm 0.148 to 0.569 280 0.9997 5 % mq-136-winsen-v1.4 traced
MQ-137 C2H6O 103.49 -2.479 10.1 to 198 ppm 0.776 to 2.57 3 0.9998 3 % mq-137-hanwei-2004 marked
MQ-137 CO 605.09 -3.909 9.99 to 200 ppm 1.35 to 2.87 3 0.9969 10 % mq-137-hanwei-2004 marked
MQ-137 NH3 36.716 -3.481 10.1 to 201 ppm 0.602 to 1.44 3 0.9972 9 % mq-137-hanwei-2004 marked
MQ-137 NH3 0.13471 -3.775 1.12 to 181 ppm 0.148 to 0.569 280 0.9997 5 % mq-137-winsen-v1.4 traced
MQ-303A ethanol 3.5821 -2.423 10.0 to 10000 ppm 0.0364 to 0.631 7 0.9993 10 % mq-303a-hanwei-2006 located
MQ-303A H2 4.3296 -2.721 10.0 to 10000 ppm 0.0582 to 0.729 7 0.9999 5 % mq-303a-hanwei-2006 located
MQ-303A iso-butane 5.3977 -3.001 95.3 to 9530 ppm 0.0853 to 0.391 5 0.9984 9 % mq-303a-hanwei-2006 read by hand upstream
MQ-309A alcohol 505470 -3.667 989 to 7010 ppm 3.18 to 5.42 3 0.9957 7 % mq-309a-hanwei-2004 located
MQ-309A CH4 1017.0 -1.680 301 to 6930 ppm 0.318 to 2.06 4 1.0000 1 % mq-309a-hanwei-2004 located
MQ-309A CO 1.6313e+06 -4.076 989 to 7010 ppm 3.76 to 6.06 3 0.9889 11 % mq-309a-hanwei-2004 located
MQ-309A H2 1586.2 -1.953 297 to 7010 ppm 0.469 to 2.38 4 0.9996 4 % mq-309a-hanwei-2004 located

Notes:

  • MQ-131 Cl2 (mq-131-2009): Read by eye from a JPEG. The figure plots R0/Rs, not Rs/R0, so the ratio these coefficients take is R0/Rs, as setRatio(MQRatio::R0OverRs) selects.
  • MQ-131 NOx (mq-131-2009): Read by eye from a JPEG. The figure plots R0/Rs, not Rs/R0, so the ratio these coefficients take is R0/Rs, as setRatio(MQRatio::R0OverRs) selects.
  • MQ-131 O3 (mq-131-2009): Read by eye from a JPEG. The figure plots R0/Rs, not Rs/R0, so the ratio these coefficients take is R0/Rs, as setRatio(MQRatio::R0OverRs) selects. The AIR line lies on pixel row 78 of the figure, R0/Rs 12.0 (11.6 to 12.5 a pixel either way); examples/MQ-131 calibrates with its inverse.
  • MQ-2 propane (mq-2-hanwei-2009): Read by eye from a JPEG. The plus-shaped markers are mostly hidden by the LPG squares drawn over them.
  • MQ-303A iso-butane (mq-303a-hanwei-2006): Kept as read by hand. The figure draws its grey gridlines over this line and its star markers, breaking both at every gridline, so neither can be followed automatically.
  • MQ-137 NH3 (mq-137-winsen-v1.4): The line the MQ137 manual prints for NH3 is identical, pixel for pixel along the curve, to the line the MQ136 manual prints for H2S; the two figures differ only in the legend and a CO line. The traced points and the fit are therefore the same as MQ-136 H2S. Whether the manufacturer measured the same response or reused the chart is not known.
  • MQ-136 H2S (mq-136-hanwei-2004): Read by eye from a JPEG. The MQ-137 datasheet draws the same figure, pixel for pixel, with this line labelled NH3. The sheet defines R0 at 10 ppm H2S, but this line reads Rs/R0 1.44 there.
  • MQ-137 NH3 (mq-137-hanwei-2004): Read by eye from a JPEG. The MQ-136 datasheet draws the same figure, pixel for pixel, with this line labelled H2S. The sheet defines R0 at 10 ppm NH3, but this line reads Rs/R0 1.44 there.

The concentration is in the unit of the datasheet figure's horizontal axis. Where that is not ppm, the value the library returns is in that unit too, whatever the sketch calls it: the MQ-3 curves are drawn against mg/L.

Datasheet is an id in datasheets/manifest.toml, which records the document's maker, edition and SHA-256. Datasheets from different makers for the same sensor have different curves.

Largest error is the biggest relative difference, over the fitted points, between the concentration the fit returns and the concentration the datasheet plots at that Rs/R0. It is what approximating the curve by a power law costs, before any error in the sensor itself.

Read by hand upstream means a few marker positions per curve, digitised by the authors of MQSensorsLib and copied from miguel5612/MQSensorsLib_Docs (MIT). Traced means every pixel column of the line, by the tool in analysis/. Extracted means the marker positions the PDF draws the figure with, read from its drawing commands by the same tool. Located means the centres of a line's hollow markers in a figure stored as an image, found by the same tool. Marked means marker centres read by eye from a figure stored as an image where neither tool can follow it, recorded as pixel positions so each can be checked against the figure. For all four, the link is the recipe that reproduces the points.

Hand-read points against the datasheet

Curves re-derived from a datasheet that also has hand-read points for the same gas. The re-derived fit is the one in the table above; the hand-read fit is kept here for comparison, with how far each hand-read point lies from the re-derived line, in Rs/R0 at the concentration the point was read at.

Sensor Gas Datasheet Hand-read a Re-derived a Hand-read b Re-derived b Hand-read points off the re-derived line
MQ-2 alcohol mq-2-hanwei-2009 3616.1 3553.2 -2.675 -2.707 +1.2 % at 203, +3.7 % at 494, +0.2 % at 789, +1.7 % at 1010, +1.2 % at 1480, +0.0 % at 2000, +0.4 % at 3050, -0.0 % at 4980, +1.1 % at 10100 ppm
MQ-2 CH4 mq-2-hanwei-2009 4301.2 4189.7 -2.651 -2.628 +0.7 % at 201, -0.0 % at 494, +0.2 % at 795, +1.5 % at 1020, -1.4 % at 1470, +1.3 % at 2010, +1.2 % at 3020, +0.7 % at 4950, +1.9 % at 10200 ppm
MQ-2 CO mq-2-hanwei-2009 32721 29571 -3.014 -2.974 -0.1 % at 203, +2.5 % at 492, +2.8 % at 811, +2.2 % at 994, +2.7 % at 1480, +0.3 % at 2030, +2.8 % at 3050, +1.7 % at 4980, +3.6 % at 10300 ppm
MQ-2 H2 mq-2-hanwei-2009 982.04 980.95 -2.131 -2.112 -1.2 % at 200, +0.4 % at 496, -0.2 % at 792, -0.4 % at 998, +1.1 % at 1480, +0.5 % at 2030, +0.6 % at 2980, +0.3 % at 4910, +0.9 % at 10000 ppm
MQ-2 LPG mq-2-hanwei-2009 578.68 564.77 -2.135 -2.151 +0.1 % at 198, +2.4 % at 497, +0.8 % at 798, +0.8 % at 1010, +2.9 % at 1460, +0.6 % at 1960, +0.6 % at 2960, -1.1 % at 4910, +0.3 % at 9960 ppm
MQ-2 propane mq-2-hanwei-2009 658.71 645.86 -2.168 -2.166 +0.5 % at 200, +1.6 % at 505, +1.3 % at 805, +0.9 % at 1480, +1.7 % at 1960, -0.5 % at 2980, +1.9 % at 5000, +1.0 % at 10000 ppm
MQ-3 alcohol mq-3-hanwei-2007 0.39339 0.39304 -1.504 -1.495 +0.0 % at 0.104, -0.3 % at 0.217, -1.1 % at 0.412, +1.1 % at 1.04, -0.6 % at 1.63, +1.9 % at 2.53, +3.1 % at 4.09, +0.9 % at 6.15, -1.0 % at 8.05, +2.5 % at 10.1 mg/L
MQ-3 benzene mq-3-hanwei-2007 4.8387 4.7380 -2.680 -2.688 +2.0 % at 0.103, +0.8 % at 0.215, +0.1 % at 0.409, +0.5 % at 1.03, +0.8 % at 1.64, +2.1 % at 2.51, +0.4 % at 4.05, +2.3 % at 6.15, +1.7 % at 7.98, -1.5 % at 9.91 mg/L
MQ-3 CH4 mq-3-hanwei-2007 1.8807e+31 3.8391e+32 -19.01 -19.76 -1.8 % at 9.91, -2.4 % at 7.91, -1.0 % at 6.15, -0.1 % at 4.09, -0.7 % at 2.51, -0.7 % at 1.66, -0.9 % at 1.02, -2.5 % at 0.412, +0.8 % at 0.217, -1.5 % at 0.102 mg/L
MQ-3 CO mq-3-hanwei-2007 521850 715790 -3.821 -3.895 -1.1 % at 0.102, +1.2 % at 0.215, +1.2 % at 0.412, +1.6 % at 1.03, +0.9 % at 6.20, -0.0 % at 7.98, -1.4 % at 9.91 mg/L
MQ-3 hexane mq-3-hanwei-2007 7585.3 7121.4 -2.849 -2.825 +0.3 % at 0.104, -3.0 % at 0.215, -0.2 % at 0.405, +1.4 % at 1.02, -0.3 % at 6.15, -0.4 % at 7.98, +1.0 % at 10.0 mg/L
MQ-3 LPG mq-3-hanwei-2007 44771 55529 -3.245 -3.281 -1.2 % at 0.104, -1.8 % at 0.215, -0.5 % at 0.409, +0.2 % at 1.04, -2.2 % at 6.15, -2.2 % at 7.98, -0.2 % at 9.91 mg/L
MQ-4 alcohol mq-4-hanwei-2007 6.4754e+10 4.7360e+10 -14.01 -13.79 +0.1 % at 200, -0.1 % at 1000, +0.2 % at 5000, +0.7 % at 10000 ppm
MQ-4 CH4 mq-4-hanwei-2007 1012.7 990.22 -2.786 -2.826 +0.9 % at 196, +2.0 % at 1000, +0.1 % at 4910, -0.9 % at 10000 ppm
MQ-4 CO mq-4-hanwei-2007 2.0828e+14 3.6362e+14 -19.05 -19.54 +0.9 % at 202, +0.5 % at 1000, -0.0 % at 5000, +0.8 % at 10100 ppm
MQ-4 H2 mq-4-hanwei-2007 332400 360990 -5.600 -5.634 -1.4 % at 200, +0.6 % at 1010, -1.5 % at 5000, -1.2 % at 10100 ppm
MQ-4 LPG mq-4-hanwei-2007 3811.9 3736.2 -3.113 -3.121 +0.5 % at 198, +1.6 % at 1000, -0.2 % at 5000, +0.9 % at 10000 ppm
MQ-4 smoke mq-4-hanwei-2007 2.7663e+07 4.7509e+07 -8.308 -8.836 +2.1 % at 202, +1.8 % at 1000, -0.4 % at 4910, -0.2 % at 9910 ppm
MQ-5 alcohol mq-5-hanwei-2007 68091 67573 -4.551 -4.526 +0.4 % at 200, -0.4 % at 494, -0.2 % at 789, -1.2 % at 1010, -0.0 % at 1510, -1.2 % at 2000, -0.9 % at 3020, +0.4 % at 5020, +0.6 % at 10000 ppm
MQ-5 CH4 mq-5-hanwei-2007 177.65 183.51 -2.560 -2.562 -1.5 % at 200, -1.2 % at 497, -1.2 % at 800, -0.4 % at 1500, -1.2 % at 2020, -2.2 % at 2990, -0.5 % at 5040, -1.7 % at 10000, -1.9 % at 1000 ppm
MQ-5 CO mq-5-hanwei-2007 1.5974e+06 1.6098e+06 -6.847 -6.843 -0.3 % at 200, -0.4 % at 498, +0.5 % at 796, -0.6 % at 1010, +0.0 % at 1520, +0.7 % at 2010, -0.3 % at 3050, -0.6 % at 5020, -0.8 % at 10100 ppm
MQ-5 H2 mq-5-hanwei-2007 1163.8 1163.2 -3.874 -3.892 +0.7 % at 201, +0.2 % at 494, -0.5 % at 801, -0.3 % at 996, -1.5 % at 1510, +0.6 % at 1980, +0.3 % at 3020, +0.3 % at 4970, +0.3 % at 10100 ppm
MQ-5 LPG mq-5-hanwei-2007 76.907 77.016 -2.489 -2.501 -0.0 % at 199, -1.3 % at 493, -0.6 % at 793, +0.8 % at 1010, -1.6 % at 1490, -0.8 % at 1990, +0.3 % at 3010, -1.2 % at 5000, -1.1 % at 9930 ppm
MQ-6 alcohol mq-6-hanwei-2007 5.9810e+07 5.2963e+07 -6.062 -6.004 +0.2 % at 201, -0.3 % at 492, -0.1 % at 794, +0.5 % at 996, +0.7 % at 1540, +0.4 % at 1980, +1.0 % at 2990, +0.1 % at 4940, +0.5 % at 9920 ppm
MQ-6 CH4 mq-6-hanwei-2007 2127.2 2195.3 -2.526 -2.507 -2.8 % at 201, -2.0 % at 501, -1.8 % at 794, +0.1 % at 1000, -1.9 % at 1550, +0.1 % at 2000, -1.2 % at 3010, -1.0 % at 4980, -1.8 % at 9920 ppm
MQ-6 CO mq-6-hanwei-2007 1.3305e+14 1.5935e+14 -12.43 -12.53 +0.3 % at 201, -0.3 % at 501, +0.1 % at 794, +0.0 % at 1000, +0.1 % at 1570, +0.5 % at 1980, +0.5 % at 3010, -0.2 % at 4940, -0.2 % at 10000 ppm
MQ-6 H2 mq-6-hanwei-2007 88158 93440 -3.597 -3.640 +0.2 % at 202, -0.6 % at 496, +1.0 % at 801, +0.7 % at 1000, -1.0 % at 1550, -0.3 % at 2000, -1.2 % at 2990, -0.5 % at 4940, -0.7 % at 9920 ppm
MQ-6 LPG mq-6-hanwei-2007 1016.8 1025.1 -2.398 -2.368 -2.2 % at 201, +0.2 % at 501, -0.6 % at 794, +0.6 % at 996, -0.3 % at 1570, +0.4 % at 1980, -0.1 % at 2990, +0.4 % at 4940, +0.5 % at 10000 ppm
MQ-7 alcohol mq-7-hanwei-2007 9.3366e+18 1.4350e+19 -14.41 -14.58 +0.5 % at 49.6, -0.6 % at 97.9, +0.2 % at 396, +0.8 % at 1010, -0.7 % at 4080 ppm
MQ-7 CH4 mq-7-hanwei-2007 6.0771e+13 5.5816e+13 -10.54 -10.49 -0.2 % at 49.6, -1.1 % at 99.1, -0.2 % at 401, +0.2 % at 1010, -0.2 % at 4030 ppm
MQ-7 CO mq-7-hanwei-2007 99.042 98.691 -1.518 -1.528 +1.8 % at 50.9, -1.2 % at 97.9, -0.3 % at 396, -1.2 % at 1010, -0.7 % at 4030 ppm
MQ-7 H2 mq-7-hanwei-2007 69.014 70.057 -1.374 -1.365 -1.3 % at 49.6, -1.7 % at 99.1, +1.1 % at 396, +0.0 % at 996, +0.2 % at 4030 ppm
MQ-7 LPG mq-7-hanwei-2007 7.4158e+08 7.7057e+08 -7.703 -7.570 -3.9 % at 49.6, -3.6 % at 100, -4.6 % at 396, -4.4 % at 1010, -2.1 % at 4030 ppm
MQ-8 alcohol mq-8-hanwei-2009 49783 48842 -1.695 -1.691 -1.0 % at 199, +2.9 % at 499, +0.7 % at 804, +0.5 % at 985, -0.1 % at 1490, +0.7 % at 2000, +1.8 % at 2970, +0.3 % at 4950, +0.6 % at 9950 ppm
MQ-8 CH4 mq-8-hanwei-2009 7.5359e+13 8.3559e+13 -6.666 -6.675 -1.0 % at 197, -0.5 % at 498, -2.4 % at 796, -1.4 % at 983, -1.2 % at 1490, -0.2 % at 1970, -0.2 % at 2960, -0.8 % at 4990, -1.8 % at 9840 ppm
MQ-8 CO mq-8-hanwei-2009 7.3658e+15 2.0195e+16 -7.335 -7.606 +2.9 % at 197, +1.0 % at 498, +1.9 % at 795, -0.1 % at 992, +1.3 % at 1490, +0.2 % at 1970, +0.2 % at 2960, +1.5 % at 4940, -0.3 % at 9830 ppm
MQ-8 H2 mq-8-hanwei-2009 976.97 973.62 -0.6879 -0.6902 +1.2 % at 198, +0.5 % at 500, -0.7 % at 805, +1.7 % at 1000, +0.6 % at 1490, +1.5 % at 2000, -0.3 % at 3000, -0.3 % at 4970, -1.4 % at 9990 ppm
MQ-8 LPG mq-8-hanwei-2009 7.9758e+07 8.3383e+07 -3.724 -3.767 +1.1 % at 199, +4.8 % at 499, +3.2 % at 803, +3.7 % at 1010, -0.6 % at 1490, +1.7 % at 1990, +1.1 % at 3020, +1.4 % at 5080, +2.2 % at 9930 ppm
MQ-9 CH4 mq-9-hanwei-2008 4269.6 4224.5 -2.648 -2.596 -1.8 % at 198, -1.8 % at 495, -0.2 % at 801, +0.7 % at 1000, -0.4 % at 1500, -1.9 % at 1980, +0.7 % at 2990, -0.6 % at 5000, +1.9 % at 9890 ppm
MQ-9 CO mq-9-hanwei-2008 599.65 580.02 -2.244 -2.220 +0.7 % at 198, +2.2 % at 492, +1.4 % at 789, +1.5 % at 988 ppm
MQ-9 LPG mq-9-hanwei-2008 993.68 971.09 -2.147 -2.140 +0.7 % at 200, +0.7 % at 495, +1.4 % at 802, +0.9 % at 996, +2.0 % at 1500, +0.8 % at 1990, +1.3 % at 2990, +1.1 % at 4960, +1.4 % at 9980 ppm
MQ-131 Cl2 mq-131-2009 47.209 48.425 -1.186 -1.181 -1.8 % at 4.96, -2.8 % at 9.82, -3.0 % at 19.7, -2.2 % at 49.5, -1.7 % at 99.2 ppm
MQ-131 NOx mq-131-2009 462.43 470.06 -2.204 -2.218 +0.1 % at 5.00, +2.2 % at 9.81, -1.9 % at 19.6, -0.0 % at 49.9, +0.1 % at 98.8 ppm
MQ-131 O3 mq-131-2009 23.943 24.264 -1.110 -1.117 +1.9 % at 5.02, -3.7 % at 9.84, -0.7 % at 19.7, -1.2 % at 50.1, -2.0 % at 99.3 ppm
MQ-135 acetone mq-135-hanwei 34.668 34.544 -3.369 -3.402 +0.5 % at 10.0, -0.3 % at 101, -0.3 % at 200 ppm
MQ-135 alcohol mq-135-hanwei 77.255 76.939 -3.180 -3.173 +0.0 % at 10.0, -0.1 % at 101, +0.4 % at 200 ppm
MQ-135 CO mq-135-hanwei 605.18 610.01 -3.937 -3.960 +0.4 % at 9.92, +0.3 % at 101, -0.2 % at 200 ppm
MQ-135 CO2 mq-135-hanwei 110.47 109.66 -2.862 -2.856 +0.1 % at 10.0, +0.3 % at 101, +0.3 % at 198 ppm
MQ-135 NH4 mq-135-hanwei 102.20 102.29 -2.473 -2.484 +0.4 % at 10.0, -0.3 % at 100, +0.1 % at 200 ppm
MQ-135 toluene mq-135-hanwei 44.947 44.880 -3.445 -3.443 +0.0 % at 10.0, +0.1 % at 100, +0.0 % at 200 ppm
MQ-303A ethanol mq-303a-hanwei-2006 3.4916 3.5821 -2.432 -2.423 -0.1 % at 9.76, -1.2 % at 28.9, -1.1 % at 97.1, +0.1 % at 291, +0.0 % at 976, -0.4 % at 2890, +0.3 % at 9710 ppm
MQ-303A H2 mq-303a-hanwei-2006 4.1487 4.3296 -2.716 -2.721 -0.1 % at 9.76, -2.9 % at 28.9, -2.4 % at 99.0, -1.8 % at 288, -1.9 % at 957, -2.0 % at 2920, -1.6 % at 9620 ppm
MQ-309A alcohol mq-309a-hanwei-2004 473620 505470 -3.647 -3.667 -1.0 % at 992, -0.8 % at 2970, -1.2 % at 7050 ppm
MQ-309A CH4 mq-309a-hanwei-2004 980.24 1017.0 -1.680 -1.680 -2.3 % at 298, -1.7 % at 989, -2.7 % at 2970, -2.0 % at 6980 ppm
MQ-309A CO mq-309a-hanwei-2004 1.4136e+06 1.6313e+06 -4.010 -4.076 -0.1 % at 997, -1.9 % at 2970, -1.0 % at 7050 ppm
MQ-309A H2 mq-309a-hanwei-2004 1532.9 1586.2 -1.951 -1.953 -1.9 % at 299, -1.5 % at 984, -1.4 % at 2940, -2.1 % at 6990 ppm

Where the hand-read points come from

For each sensor with hand-read points: how many of its hand-read curves have been re-derived from the datasheet named for them, and the largest difference between a hand-read point and the re-derived line. A hand-read curve that has not been re-derived keeps its points as the source of its fit.

Sensor Datasheet Hand-read curves Re-derived Largest difference Finding
MQ-2 mq-2-hanwei-2009 6 6 3.7 % in Rs/R0 read from this datasheet
MQ-3 mq-3-hanwei-2007 6 6 3.1 % in Rs/R0 read from this datasheet
MQ-4 mq-4-hanwei-2007 6 6 2.1 % in Rs/R0 read from this datasheet
MQ-5 mq-5-hanwei-2007 5 5 2.2 % in Rs/R0 read from this datasheet
MQ-6 mq-6-hanwei-2007 5 5 2.8 % in Rs/R0 read from this datasheet
MQ-7 mq-7-hanwei-2007 5 5 4.6 % in Rs/R0 read from this datasheet
MQ-8 mq-8-hanwei-2009 5 5 4.8 % in Rs/R0 read from this datasheet
MQ-9 mq-9-hanwei-2008 3 3 2.2 % in Rs/R0 read from this datasheet
MQ-131 mq-131-2009 3 3 3.7 % in Rs/R0 read from this datasheet
MQ-135 mq-135-hanwei 6 6 0.5 % in Rs/R0 read from this datasheet
MQ-303A mq-303a-hanwei-2006 3 2 2.9 % in Rs/R0 read from this datasheet, where checked
MQ-309A mq-309a-hanwei-2004 4 4 2.7 % in Rs/R0 read from this datasheet

Values used in the examples

Every distinct setCurve pair in examples/. The examples were written from the Hanwei-era datasheets, so only curves from those are compared; a Winsen manual for the same sensor is a different document with a different curve.

Each pair is matched to the closest fit for its sensor, hand-read or re-derived, and the verdict says how it relates to that fit. Every pair the examples use is the datasheet fit for its gas, apart from the linear-model example. Difference from the datasheet fit then compares the pair with the fit of the same gas's source curve, re-derived where it has been: the biggest relative difference in the concentration the two return, over that curve's Rs/R0 range. It is what using the example's value costs against the best power law for the datasheet's curve; how far that power law is from the curve itself is the curve's Largest error above.

Sensor a b Gas Matched fit a Matched fit b Difference in a Verdict Difference from the datasheet fit Source of that curve Sketches
MQ-2 564.77 -2.151 LPG 564.77 -2.151 0.0 % same as the fit 0 % marked Calibration, MQ-2, MQ-Board, UnitTesting
MQ-2 980.95 -2.112 H2 980.95 -2.112 0.0 % same as the fit 0 % marked ESP32_WROOM_32D
MQ-3 0.39304 -1.495 alcohol 0.39304 -1.495 0.0 % same as the fit 0 % extracted Alcoholimeter, MQ-Board, UnitTesting
MQ-3 4.7380 -2.688 benzene 4.7380 -2.688 0.0 % same as the fit 0 % extracted ESP32, ESP8266, MQ-3, external_A2D
MQ-4 -0.318 1.133 linear-model example LinearVsExponential, MQ-4-LINEAR
MQ-4 990.22 -2.826 CH4 990.22 -2.826 0.0 % same as the fit 0 % extracted LinearVsExponential, MQ-4, MQ-4-ALL, MQ-Board
MQ-4 3736.2 -3.121 LPG 3736.2 -3.121 0.0 % same as the fit 0 % extracted MQ-4-ALL
MQ-4 4.7509e+07 -8.836 smoke 4.7509e+07 -8.836 0.0 % same as the fit 0 % extracted MQ-4-ALL, UnitTesting, smokeDetector
MQ-4 4.7360e+10 -13.79 alcohol 4.7360e+10 -13.79 0.0 % same as the fit 0 % extracted MQ-4-ALL
MQ-4 3.6362e+14 -19.54 CO 3.6362e+14 -19.54 0.0 % same as the fit 1 % extracted MQ-4-ALL
MQ-5 77.016 -2.501 LPG 77.016 -2.501 0.0 % same as the fit 0 % extracted UnitTesting
MQ-5 1163.2 -3.892 H2 1163.2 -3.892 0.0 % same as the fit 0 % extracted MQ-5
MQ-5 67573 -4.526 alcohol 67573 -4.526 0.0 % same as the fit 0 % extracted MQ-Board
MQ-6 2195.3 -2.507 CH4 2195.3 -2.507 0.0 % same as the fit 0 % extracted MQ-6, MQ-Board, UnitTesting
MQ-7 98.691 -1.528 CO 98.691 -1.528 0.0 % same as the fit 0 % extracted MQ-7, MQ-Board, UnitTesting
MQ-8 973.62 -0.6902 H2 973.62 -0.6902 0.0 % same as the fit 0 % extracted MQ-8, MQ-Board, UnitTesting
MQ-9 580.02 -2.220 CO 580.02 -2.220 0.0 % same as the fit 0 % marked MQ-9-ALL, UnitTesting
MQ-9 971.09 -2.140 LPG 971.09 -2.140 0.0 % same as the fit 0 % marked MQ-9, MQ-9-ALL, MQ-Board
MQ-9 4224.5 -2.596 CH4 4224.5 -2.596 0.0 % same as the fit 0 % marked MQ-9-ALL
MQ-131 24.264 -1.117 O3 24.264 -1.117 0.0 % same as the fit 0 % marked MQ-131, UnitTesting
MQ-135 34.544 -3.402 acetone 34.544 -3.402 0.0 % same as the fit 0 % extracted MQ-135-ALL, MQ135-ADS1115
MQ-135 44.880 -3.443 toluene 44.880 -3.443 0.0 % same as the fit 0 % extracted MQ-135-ALL, MQ135-ADS1115
MQ-135 76.939 -3.173 alcohol 76.939 -3.173 0.0 % same as the fit 0 % extracted MQ-135-ALL, MQ135-ADS1115
MQ-135 102.29 -2.484 NH4 102.29 -2.484 0.0 % same as the fit 0 % extracted MQ-135, MQ-135-ALL, MQ-135-CorrectionFactorDHT11, MQ135-ADS1115
MQ-135 109.66 -2.856 CO2 109.66 -2.856 0.0 % same as the fit 0 % extracted MQ-135-ALL, MQ135-ADS1115, UnitTesting
MQ-135 610.01 -3.960 CO 610.01 -3.960 0.0 % same as the fit 0 % extracted MQ-135-ALL, MQ135-ADS1115
MQ-136 36.716 -3.481 H2S 36.716 -3.481 0.0 % same as the fit 0 % marked MQ-136, UnitTesting
MQ-303A 3.5821 -2.423 ethanol 3.5821 -2.423 0.0 % same as the fit 0 % located UnitTesting
MQ-303A 5.3977 -3.001 iso-butane 5.3977 -3.001 0.0 % same as the fit 0 % read by hand upstream MQ-303A
MQ-309A 1.6313e+06 -4.076 CO 1.6313e+06 -4.076 0.0 % same as the fit 0 % located MQ-309A, UnitTesting
Verdict Pairs
same as the fit 29
linear-model example 1
  • Same as the fit: the example's value equals the fitted value at the precision the example writes it.
  • The fit, rounded coarsely: equal at the precision written, but written to so few figures that a is off by the amount shown. The computed concentration is off by the same proportion.
  • Near the fit, not equal: within 5 % in a and 0.05 in b of a curve, without being that curve's fit. Its origin is not recorded.
  • Does not match any curve: no digitised curve for the sensor gives this pair.

Clean air

Each example calibrates R0 with calibrate(RatioMQxCleanAir), which sets R0 = Rs in clean air / that ratio, so the ratio scales every reading after it. The datasheets draw it as an AIR line, read here with the same tools as the curves; MQ-303A and MQ-309A draw it as a single marked level. The examples use each value to three significant figures, inverted where the figure plots R0/Rs.

Sensor Datasheet Axis Clean air on the figure Points from Examples define Sketches
MQ-2 mq-2-hanwei-2009 Rs/R0 9.507 marked 9.51 Calibration, ESP32_WROOM_32D, MQ-2, MQ-Board, UnitTesting
MQ-3 mq-3-hanwei-2007 Rs/R0 59.87 extracted 59.9 Alcoholimeter, Calibration, ESP32, ESP8266, MQ-3, MQ-Board, UnitTesting, external_A2D
MQ-4 mq-4-hanwei-2007 Rs/R0 4.433 extracted 4.43 Calibration, LinearVsExponential, MQ-4, MQ-4-ALL, MQ-4-LINEAR, MQ-Board, UnitTesting, smokeDetector
MQ-5 mq-5-hanwei-2007 Rs/R0 6.487 extracted 6.49 Calibration, MQ-5, MQ-Board, UnitTesting
MQ-6 mq-6-hanwei-2007 Rs/R0 9.856 extracted 9.86 Calibration, MQ-6, MQ-Board, UnitTesting
MQ-7 mq-7-hanwei-2007 Rs/R0 26.14 extracted 26.1 Calibration, MQ-7, MQ-Board, UnitTesting
MQ-8 mq-8-hanwei-2009 Rs/R0 69.52 extracted 69.5 Calibration, MQ-8, MQ-Board, UnitTesting
MQ-9 mq-9-hanwei-2008 Rs/R0 9.746 marked 9.75 Calibration, MQ-9, MQ-9-ALL, MQ-Board, UnitTesting
MQ-131 mq-131-2009 R0/Rs 12.05 marked 1.0 / 12.0 Calibration, MQ-131, UnitTesting
MQ-135 mq-135-hanwei Rs/R0 3.596 extracted 3.60 Calibration, MQ-135, MQ-135-ALL, MQ-135-CorrectionFactorDHT11, MQ135-ADS1115
MQ-136 mq-136-hanwei-2004 Rs/R0 3.551 marked 3.55 MQ-136, UnitTesting
MQ-303A mq-303a-hanwei-2006 Rs/Rs(air) 0.9910 (1 by the axis's definition) marked 1 Calibration, MQ-303A
MQ-309A mq-309a-hanwei-2004 Rs/Rs(1000 ppm CH4) 11.05 marked 11.1 Calibration, MQ-309A

Notes:

  • MQ-131 (mq-131-2009): The figure plots R0/Rs, so the examples calibrate with the inverse.
  • MQ-135 (mq-135-hanwei): The AIR line has no markers: the ends of its two straight segments.
  • MQ-136 (mq-136-hanwei-2004): The MQ-137 datasheet draws the same figure and the same AIR line.
  • MQ-303A (mq-303a-hanwei-2006): The axis is Rs over Rs in air, so clean air is 1 by definition; the marker the figure draws for it reads 0.991, within a pixel.
  • MQ-309A (mq-309a-hanwei-2004): Fig. 3's axis is Rs over Rs at 1000 ppm CH4, which the example's R0 is therefore also measured against.