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


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).


Reads the data a simple sketch:

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

void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);

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

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

Добавить комментарий для MelindaSmall Отменить ответ

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