Professional Documents
Culture Documents
sensor
The MQ-2 smoke sensor is sensitive to smoke and to the following flammable gases:
LPG
Butane
Propane
Methane
Alcohol
Hydrogen
The resistance of the sensor is different depending on the type of the gas.
The smoke sensor has a built-in potentiometer that allows you to adjust the sensor
digital output (D0) threshold. This threshold sets the value above which the digital pin
will output a HIGH signal.
How does it work?
The voltage that the sensor outputs changes accordingly to the smoke/gas level that
exists in the atmosphere. The sensor outputs a voltage that is proportional to the
concentration of smoke/gas.
In other words, the relationship between voltage and gas concentration is the
following:
The greater the gas concentration, the greater the output voltage
The lower the gas concentration, the lower the output voltage
The output can be an analog signal (A0) that can be read with an analog input of the
Arduino or a digital output (D0) that can be read with a digital input of the Arduino.
Working procedure
Check the all component, display and sensor
Then properly connect the sensor and display in Arduino by using
circuit diagram
After connection then start to coding, for this programming use c
language
After coding upload the code in Arduino by using “Arduino idee”
After that check out the project we made
#include <Adafruit_SSD1306.h>
void setup() {
for(;;);
delay(2000);
display.clearDisplay();
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(smokeA0, INPUT);
Serial.begin(9600);
void loop()
display.clearDisplay();
int analogSensor = analogRead(smokeA0);
Serial.println(analogSensor);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(20, 10);
display.println("Smoke Level");
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(32,30);
display.print(analogSensor);
display.display();
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);
else
digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
noTone(buzzer);
delay(100);
}
Discussion:
The MQ-2 Gas sensor can detect or measure gasses like LPG, Alcohol,
Propane, Hydrogen, CO, and even methane. The module version of this
sensor comes with a Digital Pin which makes this sensor to operate even
without a microcontroller and that comes in handy when you are only
trying to detect one particular gas. We can use this project in power plant and
industry for security purpose, it can easily detect the leakage of gasses also
show the level of leakage gasses. So it is very useful and futuristic device for
industrial uses