Arduino rise piece 11- smoke sensor MQ-2

Smoke sensor MQ-2

MQ family of sensors are very widely used low-cost sensors, it is widely used in household or factory gas leakage monitoring device. This introduction using MQ family MQ-2 smoke sensor, other sensors are MQ similar.

1. MQ Series sensor works

MQ family of sensors sensitive material using a highly active metal-oxide semiconductor, the sensor is heated, the gas in various concentrations in different conductivities. Using a simple circuit can convert the change in conductivity of the gas to output a signal corresponding to the concentration.

Smoke sensor module 2. Introduction

MQ-2 gas sensor sensitivity can be gas, smoke and other high, MQ-2 based on the circuit design of the smoke sensor module provides two output modes:

  • Digital output: concentration threshold setting potentiometer via an onboard, when detecting the ambient gas concentration exceeds the threshold, the digital output pin DO low.
  • Analog output: the higher the concentration, the higher the voltage value of the AO output pin, the higher the analog value acquired by the ADC.

Smoke sensor module

Note that, the sensor is energized, warm up about 20 seconds, the measured data will be stable. Since the need for internal wire heating the sensor is working, the heat sensor is normal.

3. Experimental Materials

  • Uno R3 Development Board
  • Supporting USB data cable
  • Bread plate and supporting cables
  • MQ-2 smoke sensor module

4. Experimental Procedure

1. The schematic circuit diagram of a building.

Smoke sensor module VCC, GND are connected to the development board 5V, GND. AO module connected to analog pins A0 development board module DO pin is connected to digital pins 2 Development Board.

Principle is shown below:

Experimental schematics

Physical connection is shown below:

Physical connection diagram

2. Create a new sketch, the following code replacement copies of the automatically generated code and save it.

/*
   MQ-2烟雾传感器的使用
*/
#include <Arduino.h>

#define Sensor_AO A0
#define Sensor_DO 2

unsigned int sensorValue = 0;

void setup()
{
  pinMode(Sensor_DO, INPUT);
  Serial.begin(9600);
}

void loop()
{
  sensorValue = analogRead(Sensor_AO);
  Serial.print("Sensor AD Value = ");
  Serial.println(sensorValue);

  if (digitalRead(Sensor_DO) == LOW)
  {
    Serial.println("Alarm!");
  }
  delay(1000);
}

3. Development Board connector, and set the port number corresponding to the type of boards, for download.

Download

The experimental results

Open the port monitor, the program provided baud rate consistent 9600. Monitor will display AO ADC analog voltage corresponding to the output pin, when the gas concentration is higher than a set threshold, an alarm message. We can with the use of sound and light alarms and other equipment, production of household smoke monitoring instruments.

Experimental phenomena

Focus on micro-channel public number: TonyCode
the Arduino learning exchange group: 868 283 450

More, I welcome the attention of the public number. Sweep the micro-channel to follow the Fanger Wei code:
Micro channel scan code added public number: TonyCode

Published 63 original articles · won praise 250 · Views 230,000 +

Guess you like

Origin blog.csdn.net/TonyIOT/article/details/103380128