Hello Guys,In this post we learn how to make smoke detector using gsm module and ardunio in easy way.
Let Start it:-
*Parts Required
| S.N. | COMPONENTS NAME | DESCRIPTION | QUANTITY |
|---|
| 1 | Arduino Board | Arduino UNO R3 Development Board | 1 |
| 2 | LCD Display | JHD162A 16x2 LCD Display | 1 |
| 3 | GSM Module | SIM800/900 UART GSM Module | 1 |
| 4 | Gas Sensor | MQ-135/MQ7/MQ6/MQ5/MQ2 | 1 |
| 5 | Arduino Power Supply | 5V DC Adapter | 1 |
| 6 | GSM Power Supply | 12V DC Adapter | 1 |
| 7 | Potentiometer | 10K | 1 |
| 8 | Breadboard | - | 1 |
| 9 | Connecting Wires | Jumper Wires | 20 |
*Schematics & Diagrams
*Coding
by-techgyancreative
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 10);
int gasValue = A0; // smoke / gas sensor connected with analog pin A1 of the arduino / mega.
int data = 0;
void setup()
{
randomSeed(analogRead(0));
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
lcd.begin(16,2);
pinMode(gasValue, INPUT);
lcd.print (" Gas Leakage ");
lcd.setCursor(0,1);
lcd.print (" Detector Alarm ");
delay(3000);
lcd.clear();
}
void loop()
{
data = analogRead(gasValue);
Serial.print("Gas Level: ");
Serial.println(data);
lcd.print ("Gas Scan is ON");
lcd.setCursor(0,1);
lcd.print("Gas Level: ");
lcd.print(data);
delay(1000);
if ( data > 500) //
{
SendMessage();
Serial.print("Gas detect alarm");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Gas Level Exceed");
lcd.setCursor(0,1);
lcd.print("SMS Sent");
delay(1000);
}
else
{
Serial.print("Gas Level Low");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Gas Level Normal");
delay(1000);
}
lcd.clear();
}
void SendMessage()
{
Serial.println("I am in send");
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS=\"+91900xxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("Excess Gas Detected. Open Windows");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
-copy and paste code in ardunio ide.
-choose your com port and board type.
-upload the code.
*message view


