Reading ppm for LPG off of the MQ-6

1,699 views
Skip to first unread message

Ariel Levi Simons

unread,
Jul 21, 2012, 3:10:00 PM7/21/12
to publicla...@googlegroups.com
I was wondering if anyone else out there, who has played around with the MQ-6 gas sensor (data sheet: http://www.sparkfun.com/datasheets/Sensors/Biometric/MQ-6.pdf ) has found about the same thing with calibration, or if not then could let me know what they did for relaying analog output to ppm levels.

Thanks!

Given the temperature and humidity calibration data off of the spec sheet we have a weighting factor, which we can call 'w', which goes as:

w = -0.0120*(T-20) * -0.0076*(H-65) + 1

From the concentration to resistance ratio graph we now know that their calibration curve was done under the standard 20 Celsius and 65% humidity testing conditions.  This means that we can assume that R_s = R_0 for that curve.

The experimentally fitted curve between concentration and R_s is:

C = 1036.5*R^-2.392
Where C is the concentration of LPG in ppm.
Where R is the ratio of R_s, the sensor resistance, and R_0, the resistance at 1000ppm, 20 Celsius, and 65% humidity.

R_s is given by:
R_s = (1024/s - 1)*R_L
s is the signal value from 0 to 1023.
R_L is the load resistance at 10,000 ohms

This ultimately means that, with temperature and humidity weighting added in, C is:
C = 1036.5*((1024/s - 1))^-2.392*(-0.0120*(T-20) * -0.0076*(H-65) + 1)

Jeffrey Warren

unread,
Jul 21, 2012, 5:59:39 PM7/21/12
to publicla...@googlegroups.com

I'm very interested in this topic as well. The hydrogen sulfide sensor which we are using is also sensitive to temperature and humidity and will have to be calibrated. I imagine the process will be very similar although I admit I can't quite follow what you've laid out here.

I'm going to read the datasheet to see if I can catch up but in the meantime are you writing any arduino code for this? This week at Parts and Crafts in somerville we are building an arduino-based hydrogen sulfide sensor. We have a temperature and humidity sensor as well and will soon be attempting to calibrate so we're eager to follow what you do.

Jeff

Ariel Levi Simons

unread,
Jul 21, 2012, 7:43:50 PM7/21/12
to publicla...@googlegroups.com
Hey all via Public Laboratory,

I've been working with a number of people setting up a network of multi-gas sensors which would continuously upload data every minute to the web to an open database for later visualization and analysis.  We currently have working modules for GPS, temperature/humidity, and particulate matter concentration for particles greater than 1 micron in diameter.  Our first gas sensor, the LPG sensor MQ-6, appears to be calibrated for our project using temperature and humidity data via the following process:

The function I laid out
C = 1036.5*((1024/s - 1))^-2.392*(-0.0120*(T-20) * -0.0076*(H-65) + 1)
describes the concentration C, in ppm, for natural gas.  The variable, s, is the digital output of the the microcontroller connected to the gas sensor.  The value of 's' will vary from 0 to 1023, and is run into the digital input of an Arduino board.  The power law portion of this function was fitted from manufacturing specifications, with a resistance ratio of 1 corresponding to a concentration of 1000pm at 20 Celsius and 65% humidity.
The variable T is the temperature in Celsius, and H is the humidity in percentage units.  These two inputs, temperature and humidity, are also read into an Arduino.  The linear portion of the function was also fitted to a curve supplied by the manufacturer.


We are working out a standard procedure to associate a calibration function for each type of gas sensor so that temperature and humidity can be factored in to any output.  When we get to H2S we can let you know what we'll get to, or we can give it a shot now with a particular sensor you're using.  If you send us the spec sheet we can give you our best shot at a calibration function.

Thanks!

On Sat, Jul 21, 2012 at 4:17 PM, Jeffrey Warren <je...@publiclaboratory.org> wrote:
that's great to hear, Ariel - would you mind fwding to the publiclaboratory list? Lots of other PLOTS folks are interested too.


On Sat, Jul 21, 2012 at 6:38 PM, Ariel Levi Simons <levis...@gmail.com> wrote:
Jeffrey,

The function I laid out
C = 1036.5*((1024/s - 1))^-2.392*(-0.0120*(T-20) * -0.0076*(H-65) + 1)
describes the concentration C, in ppm, for natural gas.  The variable, s, is the digital output of the the microcontroller connected to the gas sensor.  The value of 's' will vary from 0 to 1023, and is run into the digital input of an Arduino board.  The power law portion of this function was fitted from manufacturing specifications, with a resistance ratio of 1 corresponding to a concentration of 1000pm at 20 Celsius and 65% humidity.
The variable T is the temperature in Celsius, and H is the humidity in percentage units.  These two inputs, temperature and humidity, are also read into an Arduino.  The linear portion of the function was also fitted to a curve supplied by the manufacturer.


We are working out a standard procedure to associate a calibration function for each type of gas sensor so that temperature and humidity can be factored in to any output.  When we get to H2S we can let you know what we'll get to, or we can give it a shot now with a particular sensor you're using.  If you send us the spec sheet we can give you our best shot at a calibration function.

Thanks!
--
Ariel Levi Simons





--
Ariel Levi Simons

Jeffrey Warren

unread,
Jul 21, 2012, 8:11:34 PM7/21/12
to publicla...@googlegroups.com
Exciting! A comprehensive listing of calibration code for most major air sensors (maybe with example code and circuit diagrams/documentation for Arduinos) would be fantastic. Lots of folks hook these up poorly or don't adjust for temp/humidity because the datasheets are arcane and illegible.

I'm sure the Air Quality Egg folks will be interested as well if you haven't talked with them already.

I was also thinking that as large global databases of these readings develop, it'll be interesting to look for correlations with non-specific sensor readings such as those from atmospheric visible-near-IR spectrometers. Some folks have been wanting to run their PLOTS spectrometers pointed at the sky on a 5-min sampling cycle, but without something to compare to it's hard to even look for useful data.

Jeff

Sara Ann Wylie

unread,
Jul 22, 2012, 1:41:22 PM7/22/12
to publicla...@googlegroups.com
Hi All,

I can ask the community organizer in New Mexico where he is renting from. I
think it's a local solution however, because they have lots of gas
field workers
in the area, so I'm not sure everywhere will have personal alert units
like this
for rent.

We are calibrating the test strips against draeger tubes which respond only to
H2S. These are going to be co-located with the test strips, so we can make a
distribution curve as described here:
http://publiclaboratory.org/notes/sara/5-21-2012/excellent-geoscience-fieldtest-photostrip-h2s-detection

It would also be interesting to have some kind of continuous digital
monitor in
place, as well, but its not totally necessary to calibrate the test strips.

Sara

Sara Ann Wylie

unread,
Jul 22, 2012, 1:42:40 PM7/22/12
to publicla...@googlegroups.com
ops disregard this--sent in response to a different conversation!

ornelas.a...@gmail.com

unread,
Jul 9, 2016, 3:49:06 PM7/9/16
to The Public Laboratory for Open Technology and Science
How did you get the correction factors?

Ariel Levi Simons

unread,
Jul 9, 2016, 3:59:00 PM7/9/16
to publicla...@googlegroups.com
Given the temperature and humidity calibration data off of the spec sheet we have a weighting factor, which we can call 'w', which goes as:

w = -0.0120*(T-20) * -0.0076*(H-65) + 1

From the concentration to resistance ratio graph we now know that their calibration curve was done under the standard 20 Celsius and 65% humidity testing conditions.  This means that we can assume that R_s = R_0 for that curve.

The experimentally fitted curve between concentration and R_s is:

C = 1036.5*R^-2.392
Where C is the concentration of LPG in ppm.
Where R is the ratio of R_s, the sensor resistance, and R_0, the resistance at 1000ppm, 20 Celsius, and 65% humidity.

R_s is given by:
R_s = (1024/s - 1)*R_L
s is the signal value from 0 to 1023.
R_L is the load resistance at 10,000 ohms

This ultimately means that, with temperature and humidity weighting added in, C is:
C = 1036.5*((1024/s - 1))^-2.392*(-0.0120*(T-20) * -0.0076*(H-65) + 1)

Short answer: Data sheet to get the weighting factor and experimental determination for temperature and humidity.

On Sat, Jul 9, 2016 at 12:49 PM, <ornelas.a...@gmail.com> wrote:
How did you get the correction factors?
--
Post to this group at publicla...@googlegroups.com

Public Lab mailing lists (http://publiclab.org/lists) are great for discussion, but to get attribution, open source your work, and make it easy for others to find and cite your contributions, please publish your work at http://publiclab.org
---
You received this message because you are subscribed to the Google Groups "The Public Laboratory for Open Technology and Science" group.
To unsubscribe from this group and stop receiving emails from it, send an email to publiclaborato...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ariel Levi Simons

António Ornelas

unread,
Jul 9, 2016, 4:17:26 PM7/9/16
to publicla...@googlegroups.com
So it means you have to do some tests?

aren't 0.0120 and 0.0076 some yy spacings between the graphs?

You received this message because you are subscribed to a topic in the Google Groups "The Public Laboratory for Open Technology and Science" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/publiclaboratory/JqJs4TSIcRg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to publiclaborato...@googlegroups.com.

Ariel Levi Simons

unread,
Jul 9, 2016, 4:19:19 PM7/9/16
to publicla...@googlegroups.com
Yes.  We experimentally determined the values except for w, which we got from the data sheets.

I haven't done anything with this in four years though.

I do not recall these sensors being anywhere near research-grade so I wouldn't want to use them for anything other than an alarm system.

António Ornelas

unread,
Jul 9, 2016, 4:22:37 PM7/9/16
to publicla...@googlegroups.com
The thing is I cannot see how to get those values... from where to where.. wich points you compare...

Ariel Levi Simons

unread,
Jul 9, 2016, 4:25:59 PM7/9/16
to publicla...@googlegroups.com
I haven't touched this in four years, but if you're trying to use these sensors for anything approaching scientific data I would not bother.  If you want them for an alarm system that's a different matter.

António Ornelas

unread,
Jul 9, 2016, 4:28:58 PM7/9/16
to publicla...@googlegroups.com
Yes, it«s something scientific...but at least I wanted to show some calcs (that I understand) ... but ok, thanks anyway :)

Reply all
Reply to author
Forward
0 new messages