Поделиться:
MQ-2 MQ2 Smoke Gas LPG Butane Hydrogen Gas Sensor Detector Module for arduino
Test program:
Function: This version of the test program supporting
Use chip: AT89S52
Crystal: 11.0592MHZ
Baud rate: 9600
Compiler Environment: Keil
[Statement] This procedure is used only for study and reference, please indicate the copyright and author information!
************************************************** ******************* /
/ ************************************************* *******************
Note: 1, when the measured concentration is greater than the set density, single-chip IO port output low
************************************************** ******************* /
# Include // library files
#define uchar unsigned char // macro definition unsigned char
#define uint unsigned int // macro definition unsigned int
/ ************************************************* *******************
I / O definitions
************************************************** ******************* /
sbit LED = P1 ^ 0; // define microcontroller P1 port of the first one (ie P1.0) to indicate the end
sbit DOUT = P2 ^ 0; // define the microcontroller P2 port first one (ie P2.0) as an input sensor
/ ************************************************* *******************
Delay function
************************************************** ******************* /
void delay () // delay procedure
{
uchar m, n, s;
for (m = 20; m> 0; m--)
for (n = 20; n> 0; n--)
for (s = 248; s> 0; s--);
}
/ ************************************************* *******************
The main function
************************************************** ******************* /
void main ()
{
while (1) // infinite loop
{
LED = 1; // off P1.0 port lights
if (DOUT == 0) // When the concentration is higher than the set value, the implementation of the Con
{
delay (); // delay interference
When if (DOUT == 0) // determine the concentration higher than the set value, the implementation of the Con
{
LED = 0; // P1.0 port lights lit
}
}
}
}
/ ************************************************* *******************
End
************************************************** ****************** /
MQ-2 gas sensor sensitive material used in the clean air low conductivity tin oxide (SnO2). When there is the environment in which the combustible gas sensor, conductivity sensor with increasing concentration of combustible gases in air increases. Using a simple circuit to convert the change in conductivity of the gas concentration corresponding to the output signal. MQ-2 gas sensor high on gas, propane, hydrogen sensitivity of detection of natural gas and other flammable vapors are also very good. This sensor can detect a variety of flammable gas, is a low-cost sensors for a variety of applications.
Gas may be used in homes and factories leakage monitoring device suitable for the detection of gas, butane , propane , methane , smoke , etc.
Using high-quality dual-panel design, with power indicator and TTL signal output instructions;
The switching signal having a DO (TTL) output and analog output AO ;
TTL output valid signal is low . ( Low-level signal when the output light can be directly connected to the microcontroller or relay module )
Analog output voltage with the higher concentration of higher voltage.
A gas, natural gas, city gas , smoke better sensitivity.
There are four screw holes for easy positioning ;
Has a long life and reliable stability
Rapid response and recovery characteristic
Input voltage : DC5V Power consumption ( current ): 150mA
DO output : TTL digital 0 and 1 ( 0.1 and 5V)
AO output :0.1-0 .3 V ( relative to pollution ) , the maximum concentration of a voltage of about 4V
Special note: After the sensor is powered , needs to warm up around 20S, measured data was stable , heat sensor is a normal phenomenon , because the internal heating wire , if hot is not normal .
VCC: positive power supply (5V)
GND: power supply is negative
DO: TTL switching signal output
AO: analog signal output