Loading...

You have no items in your shopping cart.

 
 
 
×

Registration

Profile Informations

Login Datas

or login

First name is required!
Last name is required!
First name is not valid!
Last name is not valid!
This is not an email address!
Email address is required!
This email is already registered!
Password is required!
Enter a valid password!
Please enter 6 or more characters!
Please enter 16 or less characters!
Passwords are not same!
Terms and Conditions are required!
Email or Password is wrong!
Captcha is required!
Captcha is wrong!

Gboard with MQ2 Gas Sensor: DIY Home Fire-alarm system

Gboard is an upgraded arduino mainboard integrated with ATMega328 controller and sim900 module. It can be used as a GSM/GPRS data transfer or wireless communication project development platform.

MQ2Gas Sensor is an electronic brick that can be used in fire-alarm systems to detect hydrogen, isobutane, liquefied petroleum gas, methane, carbon monoxide, alcohol, smoke, propane and other harmful gases.

In this blog, we will do a simple home fire-alarm system by combining these two products together. An available phone calling sim card is needed to plug in Gboard. When MQ2 gas sensor detects the change of air quality: gas leaking or fire smoke, an alarm call will make to your phone automatically.

Components:

Demo Codes:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); 

const int thresholdvalue=700; //700 is the objective date of MQ2. Generally, the value of average air condition is 100

void setup()
{

pinMode(6, OUTPUT); //D6 is the run pin of sim900 in Gboard,the codes contrl Boot
pinMode(A1, OUTPUT);
digitalWrite(6,HIGH);
delay(1000);
digitalWrite(6,LOW);
delay(10000);
delay(5000);  

Serial.begin(9600);
mySerial.begin(9600);
}

void loop()
{
int sensorValue = analogRead(A0); //Use AO to read the value of MQ2
if(sensorValue>thresholdvalue)
{
digitalWrite(A1,HIGH);//Use A1 to show the status of LED, HIGH means light

Serial.println("ATD12345678900;\r");//Only change the numbers: 12345678900 into your phone number that you want to recieve the alarm call
mySerial.print("ATD12345678900;\r");//The serial monitor will show the phone call it makes

delay(5000);
//following script is to avoid repeat phone calls. when the value is over 700, make call once; when fall to 650 or even less, go back to main program and keep monitoring
 while((analogRead(A0)-thresholdvalue)>0)
 Serial.println(analogRead(A0));
while((thresholdvalue-analogRead(A0))<50)
Serial.println(analogRead(A0));
}

else 
{
Serial.println(analogRead(A0));     
digitalWrite(A1,LOW);//The value of MQ2 is less than 700, LED turns off
 }
}

Upload Demo Into Gboard

1. Before uploading demo, you should plug the jumpers into Gboard as below picture.

2. Connect MQ2 in A0, and LED in A1. Then plug FOCA to Gboard.

3. Remember to modify phone numbers into yours in the demo.

Serial.println("ATD12345678900;\r");//Only change the numbers: 12345678900 into your phone number that you want to recieve the alarm call
mySerial.print("ATD12345678900;\r");//The serial monitor will show the phone call it makes

Then upload the demo into Gboard. When uploading, choose Arduino Duemilanove w/atmega328 in “Board” option.

MQ2 Gas Sensor Test

After demo uploading, the sim900 in Gboard run automatically. At this time, you can open the serial monitor to check the data of MQ2. Attention: It takes about 1 minute that MQ2 reach at a stable status. If you open the serial monitor and no data shown, please wait some times.

Go to see the video at the beginning of this blog, we test it by using a lighter.