Introduction:
Arduino MQ-2 combustible gas sensor is mainly used to detect whether the gas leaks in industry and family. It can detect liquefied petroleum gas, methane, ethane, iso-butane, ethyl alcohol, hydrogen, smoke and ect. Potentiometer can be used to adjust the sensitivity of the sensor.
In this project, we use graphical programming to detect analog value of signal port of this sensor. When gases leak, the value increases and the LED is on .
Materials Required:
- 1. KEYESTUDIO UNO Control Board *1
- 2. V5 Sensor Shield*1
- 3. MQ-2 Combustible Gas and Smoke Sensor*1
- 4. Female to Female Dupont Line*3
Connection Diagram:
After wiring, we can start programming.
Click “download to Arduino” to see the following codes in IDE interface:
Sample Code:
***************************************************************************** void setup() { Serial.begin(9600); } void loop() { Serial.print("sensorValue;"); Serial.print(analogRead(0)); Serial.println(); delay( 1000 ); } *******************************************************************************
Result:
After downloading program, you can use this sensor to detect whether the gas leaks. Open serial monitor, you can see the analog value of ambient gas. In this experiment, we detect the gas of a lighter. Open a lighter and close to the sensor after closing it, the analog increasing, and the red light on the sensor is on; the lighter away from this sensor, the analog value decreasing, the red light off.
All Projects
- ARDUBLOCK Graphical Programming Starter Kit Tutorial
- ARDUBLOCK Project 1: LED Blinking
- ARDUBLOCK Project 2: PWM Regulating Light Brightness
- ARDUBLOCK Project 3: Flowing Light
- ARDUBLOCK Project 4: Button-controlled LED
- ARDUBLOCK Project 5: Passive Buzzer Sound Production
- ARDUBLOCK Project 6: Active Buzzer Sound Production
- ARDUBLOCK Project 7: Reading-out Analog Value
- ARDUBLOCK Project 8: Light-controlled Sound
- ARDUBLOCK Project 9: Sound-controlled Light
- ARDUBLOCK Project 10: Servo Motor Control
- ARDUBLOCK Project 11:Ultrasonic Distance Measurement
- ARDUBLOCK Project 12:PS2 Joystick Module
- ARDUBLOCK Project 13: LM35 Temperature Sensor
- ARDUBLOCK Project 14: 5V Relay Module
- ARDUBLOCK Project 15: Tilting Switch Module
- ARDUBLOCK Project 16: Capacitive Touch Module Control LED
- ARDUBLOCK Project 17: Flame Alarm Module
- ARDUBLOCK Project 18: Reed Switch Module
- ARDUBLOCK Project 19: Human Body IR Pyroelectricity
- ARDUBLOCK Project 20: Line Tracking Sensor
- ARDUBLOCK Project 21: MQ-2 Combustible Gas and Smoke Sensor
- ARDUBLOCK Project 22: Soil Module
Buy it >> ARDUBLOCK Graphical Programming Starter Kit for Arduino