MQ-6 with arduino

How to use MQ gas sensor using arduino

What is gas sensor

In modern industries, gas sensors are so important. Many modern industries use so many kind of hazardous gas that involved in fabrication process. Even in our home we use dangerous gases like LPG, of course only if not work properly like when it is leaked and burned.



Gas sensor is a device that can sense certain gas and give output proportional to concentration that sensed. Gas sensor with give an voltage output that increases with concentration.

MQ Gas Sensor

MQ gas sensor type is the most popular gas sensor for hobbyist, easy to get and of course very cheap. You can get this sensor for several $. MQ gas sensor type has many derived type for every certain gas. Here’s the list taken from arduino.cc website :

MQ-2

Sensitive for Methane, Butane, LPG, smoke.
This sensor is sensitive for flamable and combustible gasses.
The heater uses 5V.

MQ-3
Sensitive for Alcohol, Ethanol, smoke
The heater uses 5V

MQ-4
Sensitive for Methane, CNG Gas
The heater uses 5V.

MQ-5
Sensitive for Natural gas, LPG
The heater uses 5V.

MQ-6
Sensitive for LPG, butane gas
The heater uses 5V.



MQ-7
Sensitive for Carbon Monoxide
The heater uses an alternating voltage of 5V and 1.4V.
A library for the MQ-7

MQ-8
Sensitive for Hydrogen Gas
The heater uses 5V.

MQ-9
Sensitive for Carbon Monoxide, flammable gasses.
The heater uses an alternating voltage of 5V and 1.5V. It depends on the gases how to use that alternating voltage. If only Carbon Monoxide is tested, the heater can be set at 1.5V.

MQ131
Sensitive for Ozone
The heater uses 6V.

MQ135
For Air Quality
Sensitive for Benzene, Alcohol, smoke.
The heater uses 5V.



MQ136
Sensitive for Hydrogen Sulfide gas.
The heater uses 5V.

MQ137
Sensitive for Ammonia.
The heater uses 5V.

MQ138
Sensitive for Benzene, Toluene, Alcohol, Acetone, Propane, Formaldehyde gas, Hydrogen gas.
The heater uses 5V.

MQ214
Sensitive for Methane, Natural gas.
The heater uses 6V.

MQ216
Sensitive for Natural gas, Coal gas.

MQ303A
Sensitive for Alcohol, Ethanol, smoke (just like the MQ-3)
The heater uses 0.9V

MQ306A
Sensitive for LPG, butane gas
The heater uses 0.9V.
It detects the same gasses as the MQ-6, but uses a lower heater voltage.

MQ307A
Sensitive for Carbon Monoxide
The heater uses an alternating voltage of 0.2V and 0.9.
It detects the same gasses as the MQ-7, but uses a lower heater voltage.

MQ309A
Sensitive for Carbon Monoxide, flammable gasses.
The heater uses an alternating voltage of 0.2V and 0.9V. It depends on the gases how to use that alternating voltage.
It detects the same gasses as the MQ-9, but uses a lower heater voltage.



MG811
Sensitive for Carbon Dioxide (CO2).
The heater uses 6V.
The signal from this gas sensor can be connected to the Arduino, but it’s better to amplifly the signal with a OpAmp.

AQ-104
For air quality

AQ-2
Sensitive for Flamable gasses, smoke

AQ-3
Sensitive for Alcohol, Benzine

AQ-7
Sensitive for Carbon Monoxide

Liquid Petrolium Gas (LPG) sensor

For example here, we will use an LPG gas sensor which is MQ-6 with an arduino UNO. MQ-6 has 4 pin, that is VCC, Ground, Digital Out, and Analog Out.

MQ-6 LPG gas sensor
MQ-6 LPG gas sensor

VCC and GND are used to power up the sensor module. Digital Out used to give output High/Low when the gas concentration reach the threshold. So it will only give digital signal. Analog Out will give analog voltage according to gas concentration. More concentration will give more voltage output. Since we will read the gas concentration, we use the analog output.

Here is the wiring diagram :

MQ-6 with arduino
MQ-6 with arduino

Plug the USB connector to your PC and upload the code below :

void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1000);
}

The code above will print the ADC result from your sensor. You can test by give the sensor some LPG gas and sensor value will increase.

You can watch the video tutorial and demo below :
[embedyt] https://www.youtube.com/watch?v=IpqDeuDX7r8[/embedyt]

2 Replies to “How to use MQ gas sensor using arduino”

    1. You can just connect the positif of buzzer to any pin of arduino UNO, and ground of buzzer to arduino ground. Then give digitalWrite(pin, HIGH) to turn buzzer sound ON. when you want to turn off simply give digitalWrite(pin, LOW).

Leave a Reply

Your email address will not be published. Required fields are marked *