아두이노 > 가스센서

TODAY967 TOTAL613,822
사이트 이용안내
Login▼/회원가입
최신글보기 질문게시판 기술자료 동영상강좌

아두이노 센서 ATMEGA128 PWM LED 초음파 AVR 블루투스 LCD UART 모터 적외선


BASIC4MCU | 아두이노 | 아두이노 | 가스센서

페이지 정보

작성자 키트 작성일2017-09-13 13:51 조회1,041회 댓글0건

본문

 

Grove - Gas Sensor(MQ2)

Twig-Gas Sensor

中文 The Grove - Gas Sensor(MQ2) module is useful for gas leakage detection (in home and industry). It is suitable for detectingH2, LPG, CH4, CO, Alcohol, Smoke or Propane. Due to its high sensitivity and fast response time, measurements can be taken as soon as possible. The sensitivity of the sensor can be adjusted by using the potentiometer.


Get One Now Banner 
 

Contents

 

Features

  • Wide detecting scope
  • Stable and long life
  • Fast response and High sensitivity

Specification

ItemParameterMinTypicalMaxUnit
VCCWorking Voltage4.955.1V
PHHeating consumption0.5-800mW
RLLoad resistanceadjustable
RHHeater resistance-33-Ω
RsSensing Resistance3-30

Application Ideas

  • Gas leakage detection.
  • Toys.

Hardware Overview

This is a Analog output sensor. This needs to be connected to any one Analog socket in Base Shield. The examples used in this tutorial makes uses of A0 analog pin. Connect this module to the A0 port of Base Shield.

It is possible to connect the Grove module to Arduino directly by using jumper wires by using the connection as shown in the below table:

ArduinoGas Sensor
5VVCC
GNDGND
NCNC
Analog A0SIG


The output voltage from the Gas sensor increases when the concentration of gas increases. Sensitivity can be adjusted by varying the potentiometer. Please note that the best preheat time for the sensor is above 24 hours. For detailed information about the MQ-2 sensor, please refer to the data-sheet provided in resource section.

Getting Started

Gas Sensor Connected to A0

Connect the Grove - Gas Sensor(MQ2) to A0 port as shown in the above picture.

Gas Detection : Basic Example

In this example, the sensor is connected to A0 pin. The voltage read from the sensor is displayed. This value can be used as a threshold to detect any increase/decrease in gas concentration.

void setup() {  Serial.begin(9600);} void loop() {  float sensor_volt;   float sensorValue;   sensorValue = analogRead(A0);  sensor_volt = sensorValue/1024*5.0;   Serial.print("sensor_volt = ");  Serial.print(sensor_volt);  Serial.println("V");  delay(1000);}

Measurement : Approximation

This examples demonstrates a way to know the approximate concentration of Gas. As per the data-sheet of the MQx sensors, these equations are tested for standard conditions and are not calibrated. It may vary based on change in temperature or humidity.

1.Keep the Gas Sensor in clean air environment. Upload the below program.

void setup() {  Serial.begin(9600);} void loop() {  float sensor_volt;   float RS_air; //  Get the value of RS via in a clear air  float R0;  // Get the value of R0 via in H2  float sensorValue; /*--- Get a average data by testing 100 times ---*/       for(int x = 0 ; x < 100 ; x++)  {    sensorValue = sensorValue + analogRead(A0);  }  sensorValue = sensorValue/100.0;/*-----------------------------------------------*/   sensor_volt = sensorValue/1024*5.0;  RS_air = (5.0-sensor_volt)/sensor_volt; // omit *RL  R0 = RS_air/9.8; // The ratio of RS/R0 is 9.8 in a clear air from Graph (Found using WebPlotDigitizer)   Serial.print("sensor_volt = ");  Serial.print(sensor_volt);  Serial.println("V");   Serial.print("R0 = ");  Serial.println(R0);  delay(1000); }

 

2. Then, open the serial monitor of Arduino IDE. Write down the value of R0 and this needs to be used in the next program. Please node down the R0 after the reading stabilizes.


Replace the R0 below with value of R0 tested above . Expose the sensor to any one of the gas listed above.

void setup() {  Serial.begin(9600);} void loop() {   float sensor_volt;  float RS_gas; // Get value of RS in a GAS  float ratio; // Get ratio RS_GAS/RS_air  int sensorValue = analogRead(A0);  sensor_volt=(float)sensorValue/1024*5.0;  RS_gas = (5.0-sensor_volt)/sensor_volt; // omit *RL   /*-Replace the name "R0" with the value of R0 in the demo of First Test -*/  ratio = RS_gas/R0;  // ratio = RS/R0   /*-----------------------------------------------------------------------*/   Serial.print("sensor_volt = ");  Serial.println(sensor_volt);  Serial.print("RS_ratio = ");  Serial.println(RS_gas);  Serial.print("Rs/R0 = ");  Serial.println(ratio);   Serial.print("\n\n");   delay(1000); }

 

Now, we can get the concentration of gas from the below figure  

Gas sensor 1

According to the graph, we can see that the minimum concentration we can test is 100ppm and the maximum is 10000ppm, in a other word, we can get a concentration of gas between 0.01% and 1%. However, we can't provide a formula because the relation between ratio and concentration is nonlinear.  

Suggest Reading / References

Download Arduino and install Arduino driver
Getting Started with Seeeduino
How to choose a Gas Sensor
What's LEL

 

Resources



3660040649_urKXyUs7_39189_1.jpg


디바이스 마트에서 판매하는 mq2 센서입니다.

3660040649_JhqNdaXQ_mq3_ma6_-_1_ekit.jpg3Ftype3Dw740
mq2,3,6등은 가스 농도에 비례해서 전류가 흐르고
센서 출력 단자에 풀다운 저항을 연결하면 전류에 비례한 전압을 얻습니다.
센서 종류에따라서 저항값이 다릅니다.

1
2
3
4
5
6
7
8
9
void setup(){
  Serial.begin(9600);
}
//
void loop(){
  int mq2Val=analogRead(A0);
  float volt=(float)mq2Val*5.0/1023.0;
  Serial.println(volt,1); // 소숫점 이하 1자리 출력
}
cs

가스 농도에 따른 출력 전압이 시리얼 모니터에 표시됩니다.


3660040649_43udJP9m_DC12V_25C625D225B125B825B525BF.PNG3Ftype3Dw740

<디지털 ON-OFF 출력>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const int FAN=11;
//
void setup() {
  pinMode(FAN, OUTPUT);
  Serial.begin(9600);
}
//
void loop() {
  int mq2Val=analogRead(A0);
  float volt=(float)mq2Val*5.0/1023.0// 전압으로 변환
  Serial.println(volt,1);              // 소숫점 이하 1자리 출력
  if(volt>2.5)digitalWrite(FAN,HIGH);  // 가스농도가 2.5V 이상이면 FAN-ON
  else        digitalWrite(FAN,LOW);   // 아니면 FAN-OFF
}
cs

//

 if(volt>2.5)digitalWrite(FAN,HIGH);  // 가스농도가 2.5V 이상이면 FAN-ON
  else        digitalWrite(FAN,LOW);   // 아니면 FAN-OFF
체크 전압은 원하는 농도에서의 전압으로 변경하세요

댓글 0

조회수 1,041

등록된 댓글이 없습니다.

아두이노HOME > 아두이노 > 전체 목록

아두이노 목록
제목 작성자 작성일 조회
61 아두이노 Adafruit Motor/Stepper/Servo Shield for Arduino kit - v1.2 이미지 키트 17-09-13 1093
현재글 아두이노 가스센서 이미지 키트 17-09-13 1042
59 아두이노 Arduino Waveform Generator 이미지 키트 17-09-13 838
58 아두이노 Arduino Waveform Generator 키트 17-09-13 819
57 아두이노 Arduino Waveform Generator 이미지 키트 17-09-13 1036
56 아두이노 Exclusive 2.5 GHz Frequency Counter 이미지 키트 17-09-13 2201
55 아두이노 AVR SIMULATOR IDE 이미지 키트 17-09-13 707
54 아두이노 Marlin 이미지 키트 17-09-13 785
53 아두이노 opencircuits.com - Oscilloscope 이미지 키트 17-09-13 809
52 아두이노 Zorkduino 키트 17-09-13 789
51 아두이노 Single Chip AVR BASIC Computer V0.1 키트 17-09-13 844
50 아두이노 Single Chip AVR BASIC Computer V0.3 키트 17-09-13 852
49 아두이노 Single Chip AVR BASIC Computer 키트 17-09-13 765
48 아두이노 Single Chip Computer: Easy to produce AVR BASIC Computer 이미지 키트 17-09-13 842
47 아두이노 Arduino Realtime Audio Processing 이미지 키트 17-09-13 777
게시물 검색

2019년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
2018년 1월 2월 3월 4월 5월 6월 7월 8월 9월 10월 11월 12월
Privacy Policy
MCU BASIC ⓒ 2017
모바일버전으로보기