Electronics > Beginners

Reading multiple substance amounts from single Analog pin of MQ-2?

(1/1)

help_me_pick_username:
I bought an MQ-2 gas sensor module quite a long time ago, and it has been sitting on my shelf ever since. Recently, I decided to do some more tinkering with it. After doing some googling and finding some tutorials online, I found a few projects that use an Arduino to read the Analog Out pin of an MQ-2 breakout board to determine the individual concentration of multiple substances in the air.

Here is the GitHub page for an Arduino Library that does this, (https://github.com/miguel5612/MQSensorsLib) I did not manage to get the example sketch for the MQ-2 working, but according to the code (https://github.com/miguel5612/MQSensorsLib/blob/master/examples/MQ-2/MQ-2.ino), it gets the concentration of Hydrogen, LPG, Carbon Monoxide, Alcohol and Propane.

What I don’t understand is, how does it get all this information for multiple substances from a single Analog Output?

I also found that, apparetly, using the MQ sensor lineup is a whole lot more complicated than I actually thought. I found a detailed instructable for the MQ-7 where they build a whole drive circuit for the device and everything. (https://www.instructables.com/id/Arduino-CO-Monitor-Using-MQ-7-Sensor/). Are all these steps necessary for the MQ-2? If so, can someone link a proper tutorial for how to drive the MQ-2? I was unable to find any that went into as much detail as this instructable did.

excitedbox:
I only took a quick look at it but it seems this sensor has an internal heater and the Arduino doesn´t output enough current on that pin to power it so they are using that transistor to increase it. Depending on how the MQ2 sensor or module works you may need to do the same thing.

My guess on multiple gasses is that they use algorithms to calculate the resistance change and there may be multiple sensor pads made of different elements inside the MQ2 incorporated into one sensor. It could also be that 1 gas causes a big change and another a small change so the changes can be separated.

example: If I add 100 to a basket 5x and you add 3 to a basket 4 times you get 512 so you know how many times we each added to the basket because you can only reach that number with (5x100)+(4x3). This is just an educated guess though. So basically factoring is my guess.

another option could be light based. If you shine a light at something you can measure the wavelengths it emits/reflects. This is how spectroscopy works but considering the mq7 has a heater I think my first guess is correct.

help_me_pick_username:

--- Quote from: excitedbox on January 06, 2020, 02:49:20 am ---I only took a quick look at it but it seems this sensor has an internal heater and the Arduino doesn´t output enough current on that pin to power it so they are using that transistor to increase it. Depending on how the MQ2 sensor or module works you may need to do the same thing.

--- End quote ---

With the MQ-7, you have to run the heater at 5v for a certain period of time, and at 1.4v (I think) for another period of time. The measurement is made on the low heater voltage state. I don't know whether this is just for the MQ-7 or if it applies to the MQ-2 as well.

george.b:

--- Quote from: help_me_pick_username on January 06, 2020, 01:43:51 am ---What I don’t understand is, how does it get all this information for multiple substances from a single Analog Output?

--- End quote ---

It doesn't. The sensor doesn't discriminate. That Arduino program is misleading. If you're measuring H2 concentration, then the H2 value is correct, the others are nonsense, and so on. You have to know what you're measuring, and if it's a mixture, then all bets are off.

Also, at least when it comes to understanding how a device works, its parameters etc., I advise you to check the actual datasheet for the device, instead of relying on Arduino libraries and codes and "tutorials". The datasheet for the MQ-2 has all the data you need regarding its operation.

help_me_pick_username:

--- Quote from: george.b on January 06, 2020, 05:01:37 am ---It doesn't. The sensor doesn't discriminate. That Arduino program is misleading. If you're measuring H2 concentration, then the H2 value is correct, the others are nonsense, and so on. You have to know what you're measuring, and if it's a mixture, then all bets are off.

--- End quote ---

Ahh, I see. So it probably just runs the analogRead value through a different equation for each different substance.



--- Quote from: george.b on January 06, 2020, 05:01:37 am ---Also, at least when it comes to understanding how a device works, its parameters etc., I advise you to check the actual datasheet for the device, instead of relying on Arduino libraries and codes and "tutorials". The datasheet for the MQ-2 has all the data you need regarding its operation.

--- End quote ---

Thank you for the advice!

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod