# MQ2 Gas sensor showing wrong reading

**URL:** <https://forum.arduino.cc/t/mq2-gas-sensor-showing-wrong-reading/1298113>\
**Category:** Sensors\
**Created:** [September 3, 2024, 3:16pm UTC](https://forum.arduino.cc/t/mq2-gas-sensor-showing-wrong-reading/1298113 "2024-09-03T15:16:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![swastik\_dey](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/swastik_dey/32/1100848_2.png) [@swastik\_dey](https://forum.arduino.cc/u/swastik_dey)\
**Post date:** [September 3, 2024, 3:16pm UTC](https://forum.arduino.cc/t/mq2-gas-sensor-showing-wrong-reading/1298113/1 "2024-09-03T15:16:07Z")

</div>

Hello everyone. I am trying out a project to read the value from a MQ2 Gas Sensor using my Arduino Uno board and display it on the serial monitor. Following is the attached code :-

```arduino
#define MQ2_PIN A0
void setup() {
  Serial.begin(115200);
  pinMode(MQ2_PIN, INPUT);
}
void loop() {
  int gasSensorValue = analogRead(MQ2_PIN);
  Serial.print("MQ2 Sensor Value: ");
  Serial.println((gasSensorValue/1023)*100);
  delay(1000);
}

```

I have set the correct baud rate and connected the pin A0 of the MQ2 sensor to the A0 pin of Arduino Uno, yet everytime I get a zero (0) reading as output from the sensor. Can anyone please help me ?

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [September 3, 2024, 3:25pm UTC](https://forum.arduino.cc/t/mq2-gas-sensor-showing-wrong-reading/1298113/2 "2024-09-03T15:25:40Z")

</div>

> [@swastik\_dey](#):
>
> `(gasSensorValue/1023)`

That is an integer divide, with result == 0 if gasSensorValue is less than 1023.

Just print out gasSensorValue, as there is no point in scaling it.

Don't forget to "burn in" the sensor for at least 48 hours before taking any readings.

---

<div class="post-metadata">

**Author:** ![swastik\_dey](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/swastik_dey/32/1100848_2.png) [@swastik\_dey](https://forum.arduino.cc/u/swastik_dey)\
**Post date:** [September 7, 2024, 5:07pm UTC](https://forum.arduino.cc/t/mq2-gas-sensor-showing-wrong-reading/1298113/3 "2024-09-07T17:07:49Z")

</div>

"Burn in" as in keep sensor connected to active power lines, right ?

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [September 7, 2024, 11:32pm UTC](https://forum.arduino.cc/t/mq2-gas-sensor-showing-wrong-reading/1298113/4 "2024-09-07T23:32:18Z")

</div>

Power the sensor normally for 48 to 72 hours, before making the first ever readings. Or take readings and notice how they change until settling down to something that might actually be useful.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [March 6, 2025, 11:32pm UTC](https://forum.arduino.cc/t/mq2-gas-sensor-showing-wrong-reading/1298113/5 "2025-03-06T23:32:53Z")

</div>

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