Right from the time of industrial age, we mankind have been rapidly developing. With every progress we also pollute our environment and eventually degrading it. Now global warming is an alarming threat and even the air that we breathe are getting critical. So air quality monitoring has also started to gain importance. So in this article we will learn how to use any MQ series gas sensor with Arduino and showing the output in PPM (parts per million). PPM is also expressed as milligrams per litre (mg/L).
MQ-series Gas sensors
- Carbon Dioxide (CO2) : MG-811
- Carbon Monoxide (CO): MQ-9
- Total Volatile Organic Compounds (TVOCs): CCS811
- Equivalent Carbon Dioxide (eCO2): CCS811
- Metal Oxide (MOX): CCS811
- Ammonia: MQ-137
- Air Quality: MQ-135
- LPG, Alcohol, Smoke: MQ2
We have already used MQ2 for smoke sensing and MQ-135 for Air quality monitoring project. Here I will be using the MQ-137 sensor from sainsmart to measure ammonia in ppm. With the sensor in hand I went through all the available tutorials and found that there has no proper documentation on how to measure the gas in ppm. Most tutorials either deal with only the Analog values or introduce some constants which are not reliable for measuring all type of gas. So after fiddling around online for a long time I finally found how to use these MQ series gas sensors to measure ppm using Arduino. I am explaining things from the bottom without any libraries so that you can use this article for any Gas sensor available with you.
Preparing your Hardware:
The MQ gas sensors can either purchased as a module or just as a sensor alone. If your purpose is to measure only ppm then it’s best to buy the sensor alone since the module is good for only using the Digital pin. So if you have purchased the module already then you have to perform a small hack which will be discussed further. For now, let’s assume you have purchased the sensor.
As you can see you just have to connect one end of ‘H’ to supply and the other end of ‘H’ to ground. Then combine both A’s and both B’s. Connect one set to supply voltage and the other to your analog pin. The resistor RL plays a very important role in making the sensor work. So make a note of which value you are using, a value of 47k is recommended.
If you have already purchased a module, then you should track your PCB traces to find the value of your RL in the board. Grauonline has already done this work for us and the circuit diagram of the MQ gas sensor board is given below.