ActivityCard5 GasSensor
ActivityCard5 GasSensor
MQ GAS SENSOR
Introduction
MQ gas sensors are a family of sensors which are used to detect a wide variety of gases
like alcohol, smoke, methane, LPG, hydrogen, NH3, Benzene, Propane etc. These sensors
are made up of electrode which is coated with a sensing material, and it is heated to
make it more reactive and sensitive. When the gas reacts with these electrodes, its
resistance changes, more the gas, less is the resistance and vice-versa.
Low Resistance
Glass Reference
Electrode Electrode
Gas
container
Here is a list of the different sensors that we have provided and the gases they
detect:
Objective:
During this activity, you will help students to achieve following objectives:
• Understanding principle and operations of MQ Gas sensor.
• Design algorithm and flowchart to sense moisture of soil using MQ Gas sensor.
• Programming MQ Gas sensor using Arduino API for Intel Genuino.
• Interfacing MQ Gas sensor with Intel Genuino using analog pin A0.
Algorithm
Step 1 Assign analog pin A0 to MQ GAS Sensor
Step 4 If GAS sensor value is Greater than Threshold value than Print High
Step 5 If GAS sensor value is Less than Threshold value than Print Low
Flowchart
Programming
int input =
A0; int
output = 7;
int thr=500; // Set threshold level. void
setup()
{
Serial.begin(9600);
pinMode(output,OUTPUT);
digitalWrite(output,LOW);
void
loop()
{ Serial.println(analogRead(input if(analogRead(input)>th
)); r)
{
digitalWrite(output,HIGH
);
else
digitalWrite(output,LOW delay(500
); );
}
}
Hardware
Instructions:
• Connect GND pin of Gas sensor to GND on the Genuino board
• Connect Out pin of Gas Moisture sensor to A0 on the Genuino board
• Connect VCC pin of Gas Moisture sensor to 5V on the Genuino board
• Connect power supply to the Genuino and USB to USB Client Port on the Genuino
• Open Arduino IDE under Tools → Board select Intel® Genuino
• Under Tools → Serial Port select the Com # where the Genuino is connected to
• Write the above code on Arduino IDE
• Upload to the Genuino by clicking the upload button
• Monitor the value of the gas sensor in the Serial Monitor
Hardware Connection
Genuino pin MQ Gas Sensor Pin
5V VCC
GND GND