Components Required
GSM shield
Arduino
Gas detection sensor module
_________________________________________________________________________________
Arduino Program:
int PIN = 7;// attach gas sensor to pin 7
int sensor = 0;
void setup()
{
pinMode (PIN,INPUT);
Serial.begin(9600); // gsm baud rate
delay(5000);
}
void loop()
{
sensor = digitalRead (PIN); // read whether gas is presented or not
if (sensor == HIGH){ // if gas is presented send a message
Serial.println("AT");
delay(1000);
Serial.println("AT+CMGF=1"); // send SMS in text mode
delay(1000);
Serial.println("AT+CMGS=\"+919962\""); //CHANGE TO Number , you'd like to receive message
delay(1000);
Serial.print("Gas Leakage at HOME (attention required)"); // content of the message
Serial.write(26); // ctrl+z ASCII code
delay(300000); // Wait for 5 minutes before next reading
}
}
_________________________________________________________________________________