Introduction: Sending Sms If Smoke Is Detected (Arduino+GSM SIM900A
Hi everyone!
In my first instructable I will be making a gas alarm which sends message to the user if pollution is detected. This will be a simple prototype using Arduino, GSM module and electrochemical smoke sensor. In future this can be extended to develop a web dashboard to keep a check on violators.
Step 1: Materials Required
(1) Arduino Uno board (or any Arduino board)
(2) GSM shield (Personally recommended GSM SIM900A).
(3) Jumper Cables
(4) 10 K resistor
(5) Breadboard
(6) MQ 135 gas sensor
Step 2: Making Connections (GSM MODULE TO ARDUINO)
First of all connect the TX of GSM module to pin #2 of Arduino and RX to pin#3. Make grounds of both components common. And don't forget to power the GSM shield with a 12V external power source while running your device.
Step 3: Making Connections (between Sensor and Arduino)
Make connections as shown in the pic and TREAT THE SIDE OF SENSOR WITH "MQ135" WRITTEN AS TOP.
And A0 as analog pin (or you have to change the code).
Step 4: Testing Time
Firstly we will run code attached so that we can see readings of sensor in normal and polluted environment on serial monitor.
Note down the values in both the cases.(we can make the environment "polluted" by lighting an incense stick or burning a paper)
Attachments
Step 5: Final Testing
Use the noted values to edit the final code attached and change the cellphone number in code and flash the code to Arduino.
Open serial monitor and wait.
Serial monitor will show "status OK" and soon will send sms to the cellphone.
Video soon would be published.
7 Comments
Question 5 years ago on Step 1
Hello Friends,
How to download any things in this website..plz tell i don't know ..it ask upgrade premium but i don't have any account in the bank so i can't upgrade it
5 years ago
Hello my friend, tried to compile the code and I get a bunch of errors. I am new at Arduino so please help me with the libraries (I think there is the problem)
See below error codes
Arduino: 1.8.4 (Windows 7), Board: "Arduino/Genuino Uno"
In file included from C:\Program Files\Arduino\libraries\GSM\src/GSM.h:46:0,
from C:\Users\user\Desktop\Ardruino\sms_again\sms_again.ino:1:
C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration
typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
^
C:\Users\user\Desktop\Ardruino\sms_again\sms_again.ino: In function 'void setup()':
C:\Users\user\Desktop\Ardruino\sms_again\sms_again.ino:36:21: warning: invalid conversion from 'int' to 'char*' [-fpermissive]
if (gsm.begin(2400)){
^
In file included from C:\Program Files\Arduino\libraries\GSM\src/GSM.h:45:0,
from C:\Users\user\Desktop\Ardruino\sms_again\sms_again.ino:1:
C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1AccessProvider.h:80:24: note: initializing argument 1 of 'virtual GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char*, bool, bool)'
GSM3_NetworkStatus_t begin(char* pin=0,bool restart=true, bool synchronous=true);
^
C:\Users\user\Desktop\Ardruino\sms_again\sms_again.ino:46:97: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
(sms.SendSMS("+919461022454", "RJ27 CB 3**9 Pollution Level Exceeding , Attention Required "));
^
C:\Users\user\Desktop\Ardruino\sms_again\sms_again.ino:46:97: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_3'
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_5'
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function `SoftwareSerial::read()':
(.text+0x0): multiple definition of `__vector_4'
libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
C:\Users\user\AppData\Local\Temp\ccEiHlnU.ltrans1.ltrans.o: In function `openCommand':
C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1ModemCore.cpp:184: undefined reference to `gsm'
C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1ModemCore.cpp:184: undefined reference to `gsm'
C:\Users\user\AppData\Local\Temp\ccEiHlnU.ltrans1.ltrans.o: In function `begin':
C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1AccessProvider.cpp:92: undefined reference to `gsm'
C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1AccessProvider.cpp:92: undefined reference to `gsm'
C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1AccessProvider.cpp:92: undefined reference to `gsm'
C:\Users\user\AppData\Local\Temp\ccEiHlnU.ltrans1.ltrans.o:C:\Program Files\Arduino\libraries\GSM\src/GSM3ShieldV1AccessProvider.cpp:92: more undefined references to `gsm' follow
C:\Users\user\AppData\Local\Temp\ccEiHlnU.ltrans1.ltrans.o: In function `setup':
C:\Users\user\Desktop\Ardruino\sms_again/sms_again.ino:46: undefined reference to `SMSGSM::SendSMS(char*, char*)'
C:\Users\user\AppData\Local\Temp\ccEiHlnU.ltrans1.ltrans.o: In function `loop':
C:\Users\user\Desktop\Ardruino\sms_again/sms_again.ino:57: undefined reference to `gsm'
C:\Users\user\Desktop\Ardruino\sms_again/sms_again.ino:57: undefined reference to `gsm'
C:\Users\user\Desktop\Ardruino\sms_again/sms_again.ino:57: undefined reference to `SIMCOM900::readSMS(char*, int, char*, int)'
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "GSM.h"
Used: C:\Program Files\Arduino\libraries\GSM
Not used: C:\Users\user\Documents\Arduino\libraries\ITEADLIB_Arduino_SIMCom-master
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
6 years ago
can we replace PIR sensor by Ultrasonic sensor
7 years ago on Introduction
why is the sensor reading being taken in the setup() when it ( as far as I know) runs only once.
what all is happening inside loop()?
why is the baud rate 2400?
Reply 7 years ago
Gsm module used works best on baud rate 2400 for purpose (refer datasheet)
Sensor reading is in setup so that i can avoid multiple sending of SMSs (obivously i dont want to go broke :p) by changing the code a little you can get what you want (probably i was very lazy to do so)
And for inside loop, we can also read the messages received on sim on serial monitor.this is for that :)
Hope that helps
Sorry for late reply ....
8 years ago on Introduction
This is a great idea. Thanks!
Reply 8 years ago on Introduction
thanks !!