Arduino + gas sensor MQ-2 (hydrocarbons gases, smoke)

smoke_sensor_mq2

Sensor gas analyzer is based on MQ-2 can detect the presence of hydrocarbons gases (propane, methane, n-butane), smoke (suspended particles resulting from combustion) of hydrogen.

Sensors can be used to identify the origins of industrial gas and smoke. The initial result is an analog signal proportional to the gas content, which is susceptible analyzer. Sensitivity can be adjusted via trimmer onboard sensor.
In embedded heating element analyzer, which is required for the chemical reaction. Therefore, during the sensor is hot, this is normal. For stable readings new sensor must once warm (post included) within 24 hours. After this stabilization after turning will take about a minute.
Indications sensor affected by temperature and humidity. Therefore, when using a gas sensor changing environment, the need for accurate impressions need to realize compensation for these parameters.
My sensor has 4 contacts (power, ground, digital output, analog output), your sensor may have 3 contacts (power, ground, analog output). I hooked his analog output to analog input A0 Arduino. Earth to earth and power supply in accordance with Arduino (5V).

arduino_smoke_sensor

Reads the data a simple sketch:

const int sensorPin= 0; //sensor
const int ledPin= 8; //led
int smoke_level; //smoke level

void setup() {
Serial.begin(115200);
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}

void loop() {
smoke_level= analogRead(sensorPin); // Read smoke level
Serial.println(smoke_level);
if(smoke_level > 200){ // check whether the level of smoke (gas) allowed
digitalWrite(ledPin, HIGH); // if more acceptable, LED light up
}
else{
digitalWrite(ledPin, LOW);
}
}



1 комментарий

Оставить ответ

Обязательные поля помечены*

Этот сайт использует Akismet для борьбы со спамом. Узнайте как обрабатываются ваши данные комментариев.