MQ2 gas sensor has high default sensor value

I am working on project with a very simple circuit and a MQ2 gas sensor. I am using the analogReadSerial example code, no changes has been made to the code at all. I done all of my coding and my circuit setup and I realized the gas sensor produce a very high sensor value, even before the sensor detects any gas at all. I am having 900++ sensor value and by default the gas sensor should be producing value between 100 - 300++. Since this is an analog device, the value can only be output between 0 - 1024. Please help me, how do I reduce the value?

The code:

// the setup routine runs once when you press reset:
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(1);        // delay in between reads for stability
}

The circuit:
Note: Due to I have insufficient fritzing component, in which I don't have MQ2, this diagram doesn't reflect on what my actual circuit looks like. I am using MQ2, 3v3 pin is connected to VCC, GND to GND, A0 to A0.

My serial monitor output will show values 800 - 900++ in loop.

The MQ2 gas sensor runs on 5 V, not 3.3 V. :roll_eyes:

It requires substantial current for the heater - it may overload your 3.3 V terminal.

Have you "baked" the sensor for the required time?

I am not sure. Fyi, I am a college student working on this project and I am new to this. We purchased a devkit with multiple components in it, and each of us have MQ2 gas sensor and NodeMCU. Our NodeMCU doesn't have 5V pin, so we connected to 3v3 pins. Some of us managed to do it correctly but I am not sure why, since we are all following the same steps. That's why I think it is ok to connect MQ2 to 3v3.

Hi, @shenloong99
Welcome to the forum.

Draw a circuit with pen(cil) and paper.

Can you please post a link to where you purchased the MQ sensor?
I think you will find the sensor works off 5V not 3V3.
This may help.

Also not the MQ consumes 800mW at 5V or 800/5 = 160mA
Check what your MCU can supply.

Tom... :smiley: :+1: :coffee: :australia:

The NodeMCU is powered by 5 V. Usually by the USB jack.

Unlike Arduinox, the "Vin" pin on the NodeMCU is actually there to either supply 5 V, or (depending on version) provide a modest 5 V supply for some other components. It should not be connected to greater than 5 Volts. :sunglasses:

It is not OK.

The MQ2 heater requires 5V, and up to 72 hours "burn in" time before the sensor will start to work as specified. Please read the MQ2 data sheet.

Do you mean that Vin pin is 5V pin? I tried running the code with the wires attached to 5V pin but the default value becomes even higher. The value has increased even higher, to 1000++. Sometimes it fluctuates and drops to 900++.

I don't have the link because we bought it from our lecturer. The lecturer made a bulk order from the vendor, so basically this is between the lecturer and the vendor.

I checked and the NodeMCU I have supplies 3.3V, source: https://www.make-it.ca/nodemcu-arduino/nodemcu-details-specifications/

I appreciate your help, but it seems Arduino UNO is being used in this tutorial and not NodeMCU. NodeMCU doesn't have 5V pins, but Arduino UNO has.

As of now, I don't think it's the issue of using 3.3V or 5V pins, since my friends and other people are able to make it work with 3.3V pin. Plus, I don't have 5V pin.

Hi,


Use a DMM and measure the voltage between Vin and gnd.

MQ-2 data.pdf (49.9 KB)

Tom... :smiley: :+1: :coffee: :australia:

Hi Tom,
I tried connecting my wires to Vin pin, unfortunately the sensor Value is still high. At first it was 1000++, so I just left it there and wait for a few hours. The sensor value managed to reduce to 700++. Based on the suggestions of the replies, I will leave it on for a few hours and hopefully the value will continue to drop. I am not sure am I heading to the right direction, so please correct me if I am wrong

1 Like

The MQ2 requires 5V and a burn in period of 24 to 72 hours.

Do those things and you will be "heading to the right direction".

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.