The MQ2 sensor is a gas module for the detection of hydrogen, liquefied petroleum gas, smoke, carbon monoxide and alcohol. It has high sensitivity and fast response. The MQ2 sensor is a gas module for the detection of hydrogen, liquefied petroleum gas, smoke, carbon monoxide and alcohol. It has high sensitivity and fast response time to measure and acquire data. Sensitivity can be adjusted by the potentiometer behind it.
What is the MQ-2 smoke sensor?
The MQ-2 smoke sensor is sensitive to smoke and the following flammable gases:
The resistance of the sensor varies depending on the type of gas.
How does it work?
The voltage output by the sensor varies corresponding to the level of smoke/gas present in the atmosphere. The voltage output by the sensor is proportional to the concentration of smoke/gas.
In other words, the relationship between voltage and gas concentration is as follows:
- The greater the gas concentration, the larger the output voltage
Low gas concentration and low output voltage
The output can be an analog signal (A0) that can be read using the Arduino’s analog input or digital output (D0) and can be read using the Arduino’s digital inputs. Calculate the accuracy of the gas you want to detect.
Things used in this project
- MQ 2 Gas Sensor (View on Amazon)
- 16×2 I2C LCD Display (View on Amazon)
- Arduino Uno R3 (View on Amazon)
- Jumper Wires (View on Amazon)
Software apps and online services Requirements
- AO A0
- 5V VCC
- GND GND
//I2C pins declaration
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int Analog_Input = A0;
int lpg, co, smoke;
lcd.begin(16,2);//Defining 16 columns and 2 rows of lcd display
float* values= mq2.read(true); //set it false if you don’t want to print the values in the Serial
//lpg = values;
lpg = mq2.readLPG();
//co = values;
co = mq2.readCO();
//smoke = values;
smoke = mq2.readSmoke();