SlideShare a Scribd company logo
1 of 26
Call and Message using Arduino and GSM Module
By Saddam 15 Comments
Make/answer call and Read/send SMS using Arduino
Sometimes people find it difficult to use the GSM Module for its basic functions like
calling, texting etc., specifically with the Microcontrollers. So here we are going to build
a Simple Mobile Phone using Arduino, in which GSM Module is used to Make the
Call, answer the Call, send SMS, and read SMS, and also this Arduino phone has Mic
and Speaker to talk over this Phone. This project will also serve as a
proper interfacing of GSM Module with Arduino, with all the Code needed to operate
any Phone’s basic functions.
Components Required:
 Arduino Uno
 GSM Module SIM900
 16x2 LCD
 4x4 Keypad
 Breadboard or PCB
 Connecting jumper wire
 Power supply
 Speaker
 MIC
 SIM Card
Working Explanation:
In this Arduino Mobile Phone Project, we have used Arduino Uno to control whole
system’s features and interfacing all the components in this system. A 4x4
Alphanumeric Keypad is used for taking all kind of inputs like: Enter mobile number,
type messages, make a call, receive a call, send SMS, read SMS etc. GSM Module is
used to communicate with the network for calling and messaging purpose. We have
also interfaced a MIC and a Speaker for Voice Call and Ring sound and a 16x2 LCD is
used for showing messages, instructions and alerts.
Alphanumeric is a method to enter numbers and alphabets both by using same
keypad. In this method, we have interfaced 4x4 keypad with Arduino and written Code
for accepting alphabets too, check the Code in Code section below.
Working of this project is easy. All the features will be performed by Using Alphanumeric
Keypad. Check the Full code and a Demo Video below to properly understand the
process. Here we are going to explain all the four features of the projects below.
Explaining Four Features of Arduino Mobile Phone:
1. Make a Call:
To make a call by using our Arduino based Phone, we have to press ‘C’ and then need
to enter the Mobile Number on which we want to make a call. Number will be entered
by using alphanumeric keypad. After entering the number we again need to press ‘C’.
Now Arduino will process for connecting the call to the entered number by using AT
command:
ATDxxxxxxxxxx; <Enter> where xxxxxxxxx is entered Mobile Number.
2. Receive a Call:
Receiving a call is very easy. When someone is calling to your system SIM number,
which is there in GSM Module, then your system will show ‘Incoming…’ message over
the LCD with incoming number of caller. Now we just need to Press ‘A’ to attend this
call. When we press ‘A’, Arduino will send given command to GSM Module:
ATA <enter>
3. Send SMS:
When we want to send a SMS using our Arduino based Mobile Phone, then we need to
Press ‘B’. Now System will ask for Recipient Number, means ‘to whom’ we want to send
SMS. After entering the number we need to press ‘D’ and now LCD asks for message.
Now we need to type the message, like we enter in normal mobile, by using keypad and
then after entering the message we need to press ‘D’ to send SMS. To Send SMS
Arduino sends given command:
AT+CMGF=1 <enter>
AT+CMGS=”xxxxxxxxxx” <enter> where: xxxxxxxxxx is entered mobile number
And send 26 to GSM to send SMS.
4. Receive and Read SMS:
This feature is also simple. In this, GSM will receive SMS and stores it in SIM card. And
Arduino continuously monitors the received SMS indication over UART. We just need
to Press ‘D’, to read the SMS, when we see the New Message symbol (like a envelope:
See the Video at the end) on the LCD. Below is the SMS Received indication
displayed on the Serial port is:
+CMTI: “SM” <SMS stored location>
+CMTI: “SM”,6 Where 6 is message location where it stored in SIM card.
When Arduino gets this ‘SMS received’ indication then it extracts SMS storing location
and sends command to GSM to read the received SMS. And show a ‘New Message
Symbol’ over the LCD.
AT+CMGR=<SMS stored location><enter>
AT+CMGR=6
Now GSM sends stored message to Arduino and then Arduino extract main SMS and
display it over the LCD and then after reading this SMS Arduino Clear the ‘New SMS
symbol’ from the LCD.
Note: There is no coding for MIC and Speaker.
Check the Full code and a Demo Video below to properly understand the process.
Circuit Diagram and Explanation:
Circuit Diagram of this for interfacing GSM SIM900 and Arduino is given above. 16x2
LCD pins RS, EN, D4, D5, D6 and D7 are connected with pin number 14, 15, 16, 17, 18
and 19 of Arduino respectively. GSM Module’s Rx and Tx pins are directly connected
with Arduino’s pin D3 and D2 respectively (Ground of Arduino and GSM must be
connected with each other). 4x4 keypad Row pins R1, R2, R3, R4 are directly linked to
pin number 11,10, 9, 8 of Arduino and Colum pins of keypad C1, C2, C3 are linked with
pin number 7, 6, 5, 4 of Arduino. MIC is directly connected at mic+ and mic- of GSM
Module and Speaker is directly connected at SP+ and SP- pins for GSM Module.
Programming Explanation:
Programming part of this project is little complex for beginners. In this code we have
used keypad library #include <Keypad.h> for interfacing simple keypad for entering
numbers. And for entering alphabets with the same keypad, we have created
function void alfakey(). Means we have made every key multi functioning and we can
enter any character or integer by using only 10 keys.
Like if we press key 2 (abc2), it will show ‘a’ and if we presses it again then it will replace
‘a’ to ‘b’ and if again we press three times then it will show ‘c’ at same place in LCD. If
we wait for some time after pressing key, cursor will automatic move to next position in
LCD. Now we can enter next char or number. The same procedure is applied for other
keys.
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char hexaKeys[ROWS][COLS] =
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void alfakey()
{
int x=0,y=0;
int num=0;
while(1)
{
lcd.cursor();
char key=customKeypad.getKey();
if(key)
{
if(key=='1')
{
num=0;
lcd.setCursor(x,y);
.... .....
........ ....
Apart from operating keypad, we have created many other functions like void call() for
calling feature of Phone, void sms() for messaging feature, void lcd_status() for display
LCD status void gsm_init()for initializing the GSM Module etc. Check below all other
function related to make & receive Call and send & read SMS using GSM Module
and Arduino. All the functions are self-explanatory and understandable.
Code:
#include <SoftwareSerial.h>
SoftwareSerial Serial1(2, 3); // RX, TX
#include<LiquidCrystal.h>
LiquidCrystal lcd(14,15,16,17,18,19);
byte back[8] =
{
0b00000,
0b00000,
0b11111,
0b10101,
0b11011,
0b11111,
0b00000,
0b00000
};
String number="";
String msg="";
String instr="";
String str_sms="";
String str1="";
int ring=0;
int i=0,temp=0;
int sms_flag=0;
char sms_num[3];
int rec_read=0;
int temp1=0;
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char hexaKeys[ROWS][COLS] =
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
String ch="1,.?!@abc2def3ghi4jkl5mno6pqrs7tuv8wxyz90 ";
void setup()
{
Serial1.begin(9600);
lcd.begin(16,2);
lcd.createChar(1, back);
lcd.print("Simple Mobile ");
lcd.setCursor(0,1);
lcd.print("System Ready..");
delay(1000);
gsm_init();
lcd.clear();
lcd.print("System Ready");
delay(2000);
}
void loop()
{
serialEvent();
if(sms_flag==1)
{
lcd.clear();
lcd.print("New Message");
int ind=instr.indexOf("+CMTI: "SM",");
ind+=12;
int k=0;
lcd.setCursor(0,1);
lcd.print(ind);
while(1)
{
while(instr[ind]!= 0x0D)
{
sms_num[k++]=instr[ind++];
}
break;
}
ind=0;
sms_flag=0;
lcd.setCursor(0,1);
lcd.print("Read SMS --> D");
delay(4000);
instr="";
rec_read=1;
temp1=1;
i=0;
}
if(ring == 1)
{
number="";
int loc=instr.indexOf("+CLIP: "");
if(loc > 0)
{
number+=instr.substring(loc+8,loc+13+8);
}
lcd.setCursor(0,0);
lcd.print("Incomming... ");
lcd.setCursor(0,1);
lcd.print(number);
instr="";
i=0;
}
else
{
serialEvent();
lcd.setCursor(0,0);
lcd.print("Call --> C ");
lcd.setCursor(0,1);
lcd.print("SMS --> B ");
if(rec_read==1)
{
lcd.write(1);
lcd.print(" ");
}
else
lcd.print(" ");
}
char key=customKeypad.getKey();
if(key)
{
if(key== 'A')
{
if(ring==1)
{
Serial1.println("ATA");
delay(5000);
}
}
else if(key=='C')
{
call();
}
else if(key=='B')
{
sms();
}
else if(key == 'D' && temp1==1)
{
rec_read=0;
lcd.clear();
lcd.print("Please wait...");
Serial1.print("AT+CMGR=");
Serial1.println(sms_num);
int sms_read_flag=1;
str_sms="";
while(sms_read_flag)
{
while(Serial1.available()>0)
{
char ch=Serial1.read();
str_sms+=ch;
if(str_sms.indexOf("OK")>0)
{
sms_read_flag=0;
//break;
}
}
}
int l1=str_sms.indexOf(""rn");
int l2=str_sms.indexOf("OK");
String sms=str_sms.substring(l1+3,l2-4);
lcd.clear();
lcd.print(sms);
delay(5000);
}
delay(1000);
}
}
void call()
{
number="";
lcd.clear();
lcd.print("After Enter No.");
lcd.setCursor(0,1);
lcd.print("Press C to Call");
delay(2000);
lcd.clear();
lcd.print("Enter Number:");
lcd.setCursor(0,1);
while(1)
{
serialEvent();
char key=customKeypad.getKey();
if(key)
{
if(key=='C')
{
lcd.clear();
lcd.print("Calling........");
lcd.setCursor(0,1);
lcd.print(number);
Serial1.print("ATD");
Serial1.print(number);
Serial1.println(";");
long stime=millis()+5000;
int ans=1;
while(ans==1)
{
while(Serial1.available()>0)
{
if(Serial1.find("OK"))
{
lcd.clear();
lcd.print("Ringing....");
int l=0;
str1="";
while(ans==1)
{
while(Serial1.available()>0)
{
char ch=Serial1.read();
str1+=ch;
if(str1.indexOf("NO CARRIER")>0)
{
lcd.clear();
lcd.print("Call End");
delay(2000);
ans=0;
return;
}
}
char key=customKeypad.getKey();
if(key == 'D')
{
lcd.clear();
lcd.print("Call End");
delay(2000);
ans=0;
return;
}
if(ans==0)
break;
}
}
}
}
}
else
{
number+=key;
lcd.print(key);
}
}
}
}
void sms()
{
lcd.clear();
lcd.print("Initilising SMS");
Serial1.println("AT+CMGF=1");
delay(400);
lcd.clear();
lcd.print("After Enter No.");
lcd.setCursor(0,1);
lcd.print("Press D ");
delay(2000);
lcd.clear();
lcd.print("Enter Rcpt No.:");
lcd.setCursor(0,1);
Serial1.print("AT+CMGS="");
while(1)
{
serialEvent();
char key=customKeypad.getKey();
if(key)
{
if(key=='D')
{
//number+='"';
Serial1.println(""");
break;
}
else
{
//number+=key;
Serial1.print(key);
lcd.print(key);
}
}
}
lcd.clear();
lcd.print("After Enter MSG ");
lcd.setCursor(0,1);
lcd.print("Press D to Send ");
delay(2000);
lcd.clear();
lcd.print("Enter Your Msg");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
alfakey();
}
void alfakey()
{
int x=0,y=0;
int num=0;
while(1)
{
lcd.cursor();
char key=customKeypad.getKey();
if(key)
{
if(key=='1')
{
num=0;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='1')
{
num++;
if(num>5)
num=0;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='2')
{
num=6;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='2')
{
num++;
if(num>9)
num=6;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='3')
{
num=10;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='3')
{
num++;
if(num>13)
num=10;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='4')
{
num=14;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='4')
{
num++;
if(num>17)
num=14;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='5')
{
num=18;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='5')
{
num++;
if(num>21)
num=18;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='6')
{
num=22;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='6')
{
num++;
if(num>25)
num=22;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='7')
{
num=26;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='7')
{
num++;
if(num>30)
num=26;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='8')
{
num=31;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='8')
{
num++;
if(num>34)
num=31;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='9')
{
num=35;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='9')
{
num++;
if(num>39)
num=35;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='0')
{
num=40;
lcd.setCursor(x,y);
lcd.print(ch[num]);
for(int i=0;i<3000;i++)
{
lcd.noCursor();
char key=customKeypad.getKey();
if(key=='0')
{
num++;
if(num>41)
num=40;
lcd.setCursor(x,y);
lcd.print(ch[num]);
i=0;
delay(200);
}
}
x++;
if(x>15)
{
x=0;
y++;
y%=2;
}
msg+=ch[num];
}
else if(key=='D')
{
lcd.clear();
lcd.print("Sending SMS....");
// Serial1.print("AT+CMGS=");
// Serial1.print(number);
// delay(2000);
Serial1.print(msg);
Serial1.write(26);
delay(5000);
lcd.clear();
lcd.print("SMS Sent to");
lcd.setCursor(0,1);
lcd.print(number);
delay(2000);
number="";
break;
}
}
}
}
void send_data(String message)
{
Serial1.println(message);
delay(200);
}
void send_sms()
{
Serial1.write(26);
}
void lcd_status()
{
lcd.setCursor(2,1);
lcd.print("Message Sent");
delay(2000);
//lcd.setCursor()
//lcd.print("")
//return;
}
void back_button()
{
//lcd.setCursor(0,15);
}
void ok_button()
{
lcd.setCursor(0,4);
lcd.print("OK");
}
void call_button()
{
lcd.setCursor(0,4);
lcd.print("CALL");
}
void sms_button()
{
lcd.setCursor(0,13);
lcd.print("SMS");
}
void gsm_init()
{
lcd.clear();
lcd.print("Finding Module..");
boolean at_flag=1;
while(at_flag)
{
Serial1.println("AT");
while(Serial1.available()>0)
{
if(Serial1.find("OK"))
at_flag=0;
}
delay(1000);
}
lcd.clear();
lcd.print("Module Connected..");
delay(1000);
lcd.clear();
lcd.print("Disabling ECHO");
boolean echo_flag=1;
while(echo_flag)
{
Serial1.println("ATE1");
while(Serial1.available()>0)
{
if(Serial1.find("OK"))
echo_flag=0;
}
delay(1000);
}
lcd.clear();
lcd.print("Echo OFF");
delay(1000);
lcd.clear();
lcd.print("Finding Network..");
boolean net_flag=1;
while(net_flag)
{
Serial1.println("AT+CPIN?");
while(Serial1.available()>0)
{
if(Serial1.find("+CPIN: READY"))
net_flag=0;
}
delay(1000);
}
lcd.clear();
lcd.print("Network Found..");
delay(1000);
lcd.clear();
}
void serialEvent()
{
while(Serial1.available())
{
char ch=Serial1.read();
instr+=ch;
i++;
if(instr[i-4] == 'R' && instr[i-3] == 'I' && instr[i-2] == 'N' && instr[i-1] == 'G' )
{
ring=1;
}
if(instr.indexOf("NO CARRIER")>=0)
{
ring=0;
i=0;
}
if(instr.indexOf("+CMTI: "SM"")>=0)
{
sms_flag=1;
}
}
}
Video:
JLCPCB - Prototype PCBs for $2 + Free Shipping on First
Order
China's Largest PCB Prototype Manufacturer, 290,000+ Customers & 8,000+ Online
Orders Per Day
10 PCBs Price: $2 for 2-layer, $15 for 4-layer, $74 for 6-layer
 Add new comment
Comments (15)
teja
o reply
Arduino: 1.6.4 (Windows 8.1), Board: "Arduino Duemilanove or Diecimila, ATmega328"
mobilefull2.ino: In function 'void setup()':
mobilefull2:51: error: 'gsm_init' was not declared in this scope
mobilefull2.ino: In function 'void loop()':
mobilefull2:58: error: 'serialEvent' was not declared in this scope
mobilefull2:135: error: 'sms' was not declared in this scope
mobilefull2.ino: In function 'void call()':
mobilefull2:183: error: 'serialEvent' was not declared in this scope
'gsm_init' was not declared in this scope
mobilefull2.ino: In function 'void setup()':
mobilefull2:51: error: 'gsm_init' was not declared in this scope
mobilefull2.ino: In function 'void loop()':
mobilefull2:58: error: 'serialEvent' was not declared in this scope
mobilefull2:135: error: 'sms' was not declared in this scope
mobilefull2.ino: In function 'void call()':
mobilefull2:183: error: 'serialEvent' was not declared in this scope
'gsm_init' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Sep 05, 2016
gunjan vyas
o reply
after initializing the display shows only one message "finding module" and there is no further
process being done by the circuit. please give proper solution.
Oct 06, 2016
harish kumar
o reply
when i compiling the code it show,
error compiling for arduino uno board
what i do sir
Nov 10, 2016
harish kumar
o reply
what type of speaker u used sir ?
Nov 12, 2016
Mark
o reply
Looks good.
Feb 07, 2017
Karlos
o reply
after initializing the display shows only one message "finding module.." and there is no further
process being done by the circuit. please give proper solution.
what's next? please
Feb 18, 2017
sachit kumaar
o reply
Tell me the command code for displaying messages through LCD via gsm900A...pls rply sir as
soon as possible
Feb 27, 2017
Sonadarshan
o reply
Actually I made this project all worked properly after wards means after working for a day It
stopped working in the sense the LCD is giving garbage value after call -c n message display
Apr 04, 2017
mufaddal
o reply
dear i need your help as admin is not replying i made this project but unfortunatly it leaves me
with finding module kindly help
Apr 28, 2017
ABDUL
o reply
when i compile it it shows error compiling
Apr 19, 2017
john
o reply
Hi sir when i compiling the code it show,
error compiling for arduino uno board
what i do sir
Jul 26, 2017
shahid
o reply
all the functions are working except the sms , i am not recieving the sms frm my mobile to lcd,
void serialEvent()
{
while(Serial1.available())
{
char ch=Serial1.read();
instr+=ch;
i++;
if(instr[i-4] == 'R' && instr[i-3] == 'I' && instr[i-2] == 'N' && instr[i-1] == 'G' )
{
ring=1;
}
if(instr.indexOf("NO CARRIER")>=0)
{
ring=0;
i=0;
}
if(instr.indexOf("+CMTI: "SM"")>=0)
{
sms_flag=1;
}
}
}
my serial monitor is not recieving this indication from serial,
please help as soon as possible
Dec 21, 2017
Prom
o reply
My code is showing errors:
'gsm_init() was not declared in this scope'
I need help
Jan 13, 2018
k
o reply
hey guys please help me ... My project GSM based intilay GMS modem send me msg but when i
send comond to refil my LIquid tank it will not work..
Jan 15, 2018
Kanwar
o reply
When Gsm send me msg then i send a msg to again gsm it will not accept my msg request
String inputString="";
String num;
int trigPin=52;
int echoPin=53;
long duration,distance;
int motor=8;
int a;
int maxiumRange=50;
String destinationNumber="+923312775616";
void setup() { // void Setup Start
Serial.begin(9600);
pinMode(motor,OUTPUT);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
LCD.begin(16,2);
LCD.setCursor(0,0);
LCD.print("WELCOME");
gsm.begin(9600);
gsm.println("AT+CMGF=1"); //FOR TEXT MODE
gsm.println("AT+CNMI=2,2,0,0,0"); //DIRECT MODE NO NEED TO SAVE INCOMING
MESSAGES
delay(2000);
Serial.print("Hello Iam Conneted With Arduino"); //GSM conneted to arduino
delay(2000);
LCD.clear();
LCD.setCursor(0,0);
LCD.print("Liquid Level:");
} //void Setup Close
void loop() { //LOOP start 1
digitalWrite(trigPin,LOW);
delayMicroseconds (2000);
digitalWrite(trigPin,HIGH);
delayMicroseconds (15);
digitalWrite(trigPin,LOW);
delayMicroseconds(10);
duration= pulseIn(echoPin,HIGH);
distance= duration*0.034/2;
LCD.setCursor(0,1);
LCD.print(" ");
LCD.setCursor(0,1);
LCD.print(distance);
LCD.println("=CM");
delay(500);
if (distance >=10){ // if condtion start 1
gsm.print("AT+CMGF=1r"); // AT command to send SMS message to subsriber
delay(1000);
gsm.println("AT+CMGS= ""+destinationNumber+"""); //Serial.println("AT + CMGS =
"+923041806419""); // recipient's mobile number, in international format
delay(1000);
gsm.println("your Tank is Empty Do you Want To refill "); // message to send
delay(1000);
gsm.println((char)26); // End AT command with a ^Z, ASCII code 26
delay(1000);
gsm.println();
delay(10000);
if(gsm.available()){ //Coming MSG from DestionNumber Owner if2
char inChar = gsm.read();
if (inChar =='+') { // if3
num=gsm.readStringUntil(':');
if(num=="CMT"){ //if4
gsm.readStringUntil(',');
gsm.readStringUntil('"');
gsm.readStringUntil('#');
inputString=gsm.readStringUntil('$');
Serial.println(inputString);
if(inputString=="motoron"){ // Motor On code if5
digitalWrite(motor,HIGH);
delay(100);
}
Jan 15, 2018

More Related Content

What's hot

Global Wireless E-Voting Documentation
Global Wireless E-Voting DocumentationGlobal Wireless E-Voting Documentation
Global Wireless E-Voting DocumentationCharan Reddy Mutyala
 
Sensor networks
Sensor networksSensor networks
Sensor networksMarc Pous
 
Global wireless e voting
Global wireless  e votingGlobal wireless  e voting
Global wireless e votingvitam,berhampur
 
IRJET- IoT Air Pollution Monitoring System using Arduino
IRJET- IoT Air Pollution Monitoring System using ArduinoIRJET- IoT Air Pollution Monitoring System using Arduino
IRJET- IoT Air Pollution Monitoring System using ArduinoIRJET Journal
 
GSM Based SMS fire alert system
GSM Based SMS fire alert systemGSM Based SMS fire alert system
GSM Based SMS fire alert systemSoumyadeep Kal
 
Electronic Voting Machine
Electronic Voting MachineElectronic Voting Machine
Electronic Voting MachineChanda Thakur
 
DHT11 & DHT22.pptx
DHT11 & DHT22.pptxDHT11 & DHT22.pptx
DHT11 & DHT22.pptxBinuKG1
 
Cordless telephone
Cordless telephoneCordless telephone
Cordless telephoneharigopala
 
Generations of Mobile Communications
Generations of Mobile CommunicationsGenerations of Mobile Communications
Generations of Mobile Communicationssivakumar m
 
Electronic voting machine
Electronic voting    machineElectronic voting    machine
Electronic voting machinemani akuthota
 
Distance Measurement Using Ultrasonic Sensor and Nodemcu
Distance Measurement Using Ultrasonic Sensor and NodemcuDistance Measurement Using Ultrasonic Sensor and Nodemcu
Distance Measurement Using Ultrasonic Sensor and NodemcuIRJET Journal
 
Security system using Arduino
Security system using ArduinoSecurity system using Arduino
Security system using ArduinoApoorv Anand
 
Sixth sense technology
Sixth sense technologySixth sense technology
Sixth sense technologyJISMI JACOB
 
Electronic voting machine
Electronic voting machineElectronic voting machine
Electronic voting machineShusomm
 
History of wireless communication
History of wireless communicationHistory of wireless communication
History of wireless communicationAJAL A J
 
Mobile communication
Mobile communicationMobile communication
Mobile communicationsourabh kant
 
Embedded based home security system
Embedded based home security systemEmbedded based home security system
Embedded based home security systemNIT srinagar
 
Project ideas ece students
Project ideas ece studentsProject ideas ece students
Project ideas ece studentsVatsal N Shah
 

What's hot (20)

Global Wireless E-Voting Documentation
Global Wireless E-Voting DocumentationGlobal Wireless E-Voting Documentation
Global Wireless E-Voting Documentation
 
Sensor networks
Sensor networksSensor networks
Sensor networks
 
Global wireless e voting
Global wireless  e votingGlobal wireless  e voting
Global wireless e voting
 
IRJET- IoT Air Pollution Monitoring System using Arduino
IRJET- IoT Air Pollution Monitoring System using ArduinoIRJET- IoT Air Pollution Monitoring System using Arduino
IRJET- IoT Air Pollution Monitoring System using Arduino
 
GSM Based SMS fire alert system
GSM Based SMS fire alert systemGSM Based SMS fire alert system
GSM Based SMS fire alert system
 
Electronic Voting Machine
Electronic Voting MachineElectronic Voting Machine
Electronic Voting Machine
 
DHT11 & DHT22.pptx
DHT11 & DHT22.pptxDHT11 & DHT22.pptx
DHT11 & DHT22.pptx
 
Cordless telephone
Cordless telephoneCordless telephone
Cordless telephone
 
Generations of Mobile Communications
Generations of Mobile CommunicationsGenerations of Mobile Communications
Generations of Mobile Communications
 
Electronic voting machine
Electronic voting    machineElectronic voting    machine
Electronic voting machine
 
Distance Measurement Using Ultrasonic Sensor and Nodemcu
Distance Measurement Using Ultrasonic Sensor and NodemcuDistance Measurement Using Ultrasonic Sensor and Nodemcu
Distance Measurement Using Ultrasonic Sensor and Nodemcu
 
Seminar report Of Touchless Touchscreen
Seminar report Of Touchless TouchscreenSeminar report Of Touchless Touchscreen
Seminar report Of Touchless Touchscreen
 
Security system using Arduino
Security system using ArduinoSecurity system using Arduino
Security system using Arduino
 
Sixth sense technology
Sixth sense technologySixth sense technology
Sixth sense technology
 
Electronic voting machine
Electronic voting machineElectronic voting machine
Electronic voting machine
 
History of wireless communication
History of wireless communicationHistory of wireless communication
History of wireless communication
 
Mobile communication
Mobile communicationMobile communication
Mobile communication
 
Hiperlan
HiperlanHiperlan
Hiperlan
 
Embedded based home security system
Embedded based home security systemEmbedded based home security system
Embedded based home security system
 
Project ideas ece students
Project ideas ece studentsProject ideas ece students
Project ideas ece students
 

Similar to Call and message using arduino and gsm module

GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLERGSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLERMd. Moktarul Islam
 
Please correct my code for me i am lost Thanks i submitted.pdf
Please correct my code for me i am lost Thanks i submitted.pdfPlease correct my code for me i am lost Thanks i submitted.pdf
Please correct my code for me i am lost Thanks i submitted.pdfkitty811
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2srknec
 
Cell phone based dtmf
Cell phone based dtmfCell phone based dtmf
Cell phone based dtmfslmnsvn
 
Using the cisco console in linux
Using the cisco console in linux Using the cisco console in linux
Using the cisco console in linux IT Tech
 
Cell phone based dtmf controlled
Cell phone based dtmf controlledCell phone based dtmf controlled
Cell phone based dtmf controlledslmnsvn
 
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdfDEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdfWlamir Molinari
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino MajdyShamasneh
 
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, NepalArduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepalbishal bhattarai
 
Camden 120W-V2 Instruction Manual
Camden 120W-V2 Instruction ManualCamden 120W-V2 Instruction Manual
Camden 120W-V2 Instruction ManualJMAC Supply
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docxAjay578679
 
Interface gsm module with pic
Interface gsm module with picInterface gsm module with pic
Interface gsm module with picRavindra Saini
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbookFelipe Belarmino
 
Cellphones beyond calls and phones.
Cellphones beyond calls and phones.Cellphones beyond calls and phones.
Cellphones beyond calls and phones.koustuba
 

Similar to Call and message using arduino and gsm module (20)

GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLERGSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
 
F0463842
F0463842F0463842
F0463842
 
Please correct my code for me i am lost Thanks i submitted.pdf
Please correct my code for me i am lost Thanks i submitted.pdfPlease correct my code for me i am lost Thanks i submitted.pdf
Please correct my code for me i am lost Thanks i submitted.pdf
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
 
Arduino based Applications-part 6
Arduino based Applications-part 6Arduino based Applications-part 6
Arduino based Applications-part 6
 
Cell phone based dtmf
Cell phone based dtmfCell phone based dtmf
Cell phone based dtmf
 
GSM Based Security System
GSM Based Security SystemGSM Based Security System
GSM Based Security System
 
Using the cisco console in linux
Using the cisco console in linux Using the cisco console in linux
Using the cisco console in linux
 
arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
 
Cell phone based dtmf controlled
Cell phone based dtmf controlledCell phone based dtmf controlled
Cell phone based dtmf controlled
 
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdfDEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
 
Basic standard calculator
Basic standard calculatorBasic standard calculator
Basic standard calculator
 
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, NepalArduino by bishal bhattarai  IOE, Pashchimanchal Campus Pokhara, Nepal
Arduino by bishal bhattarai IOE, Pashchimanchal Campus Pokhara, Nepal
 
Camden 120W-V2 Instruction Manual
Camden 120W-V2 Instruction ManualCamden 120W-V2 Instruction Manual
Camden 120W-V2 Instruction Manual
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
 
Interface gsm module with pic
Interface gsm module with picInterface gsm module with pic
Interface gsm module with pic
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbook
 
Cellphones beyond calls and phones.
Cellphones beyond calls and phones.Cellphones beyond calls and phones.
Cellphones beyond calls and phones.
 

More from josnihmurni2907

Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22josnihmurni2907
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21josnihmurni2907
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2josnihmurni2907
 
Simple timer code for arduino
Simple timer code for arduinoSimple timer code for arduino
Simple timer code for arduinojosnihmurni2907
 
How to write timings and delays
How to write timings and delaysHow to write timings and delays
How to write timings and delaysjosnihmurni2907
 
140813560 nota-kimia-tingkatan-4
140813560 nota-kimia-tingkatan-4140813560 nota-kimia-tingkatan-4
140813560 nota-kimia-tingkatan-4josnihmurni2907
 
132944997 rancangan-tahunan-mm-t5-2013
132944997 rancangan-tahunan-mm-t5-2013132944997 rancangan-tahunan-mm-t5-2013
132944997 rancangan-tahunan-mm-t5-2013josnihmurni2907
 
Agihan kertas 1 dan kertas 2
Agihan kertas 1 dan kertas 2Agihan kertas 1 dan kertas 2
Agihan kertas 1 dan kertas 2josnihmurni2907
 
Cara menghilangkan rasa ngantuk di kelas
Cara menghilangkan rasa ngantuk di kelasCara menghilangkan rasa ngantuk di kelas
Cara menghilangkan rasa ngantuk di kelasjosnihmurni2907
 
Bercakap mengenai nikmat allah s
Bercakap mengenai nikmat allah sBercakap mengenai nikmat allah s
Bercakap mengenai nikmat allah sjosnihmurni2907
 
Bandar purba dalam tasik di china
Bandar purba dalam tasik di chinaBandar purba dalam tasik di china
Bandar purba dalam tasik di chinajosnihmurni2907
 
12 kaum yang telah allah swt binasakan
12 kaum yang telah allah swt binasakan12 kaum yang telah allah swt binasakan
12 kaum yang telah allah swt binasakanjosnihmurni2907
 

More from josnihmurni2907 (20)

Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
Twin wheeler modified for arduino simplified serial protocol to sabertooth v21
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
 
Simple timer code for arduino
Simple timer code for arduinoSimple timer code for arduino
Simple timer code for arduino
 
Michael kontopoulos
Michael kontopoulosMichael kontopoulos
Michael kontopoulos
 
Michael kontopoulo1s
Michael kontopoulo1sMichael kontopoulo1s
Michael kontopoulo1s
 
How to write timings and delays
How to write timings and delaysHow to write timings and delays
How to write timings and delays
 
Define ba1
Define ba1Define ba1
Define ba1
 
Define ba
Define baDefine ba
Define ba
 
Arduino
ArduinoArduino
Arduino
 
Arduino 101
Arduino 101Arduino 101
Arduino 101
 
140813560 nota-kimia-tingkatan-4
140813560 nota-kimia-tingkatan-4140813560 nota-kimia-tingkatan-4
140813560 nota-kimia-tingkatan-4
 
1.funtions (1)
1.funtions (1)1.funtions (1)
1.funtions (1)
 
132944997 rancangan-tahunan-mm-t5-2013
132944997 rancangan-tahunan-mm-t5-2013132944997 rancangan-tahunan-mm-t5-2013
132944997 rancangan-tahunan-mm-t5-2013
 
Agihan kertas 1 dan kertas 2
Agihan kertas 1 dan kertas 2Agihan kertas 1 dan kertas 2
Agihan kertas 1 dan kertas 2
 
Ciri pemimpin
Ciri pemimpinCiri pemimpin
Ciri pemimpin
 
Cara menghilangkan rasa ngantuk di kelas
Cara menghilangkan rasa ngantuk di kelasCara menghilangkan rasa ngantuk di kelas
Cara menghilangkan rasa ngantuk di kelas
 
Bercakap mengenai nikmat allah s
Bercakap mengenai nikmat allah sBercakap mengenai nikmat allah s
Bercakap mengenai nikmat allah s
 
Bandar purba dalam tasik di china
Bandar purba dalam tasik di chinaBandar purba dalam tasik di china
Bandar purba dalam tasik di china
 
12 kaum yang telah allah swt binasakan
12 kaum yang telah allah swt binasakan12 kaum yang telah allah swt binasakan
12 kaum yang telah allah swt binasakan
 

Recently uploaded

Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 

Recently uploaded (20)

Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 

Call and message using arduino and gsm module

  • 1. Call and Message using Arduino and GSM Module By Saddam 15 Comments Make/answer call and Read/send SMS using Arduino Sometimes people find it difficult to use the GSM Module for its basic functions like calling, texting etc., specifically with the Microcontrollers. So here we are going to build a Simple Mobile Phone using Arduino, in which GSM Module is used to Make the Call, answer the Call, send SMS, and read SMS, and also this Arduino phone has Mic and Speaker to talk over this Phone. This project will also serve as a proper interfacing of GSM Module with Arduino, with all the Code needed to operate any Phone’s basic functions. Components Required:  Arduino Uno  GSM Module SIM900  16x2 LCD  4x4 Keypad  Breadboard or PCB  Connecting jumper wire  Power supply  Speaker  MIC  SIM Card
  • 2. Working Explanation: In this Arduino Mobile Phone Project, we have used Arduino Uno to control whole system’s features and interfacing all the components in this system. A 4x4 Alphanumeric Keypad is used for taking all kind of inputs like: Enter mobile number, type messages, make a call, receive a call, send SMS, read SMS etc. GSM Module is used to communicate with the network for calling and messaging purpose. We have also interfaced a MIC and a Speaker for Voice Call and Ring sound and a 16x2 LCD is used for showing messages, instructions and alerts. Alphanumeric is a method to enter numbers and alphabets both by using same keypad. In this method, we have interfaced 4x4 keypad with Arduino and written Code for accepting alphabets too, check the Code in Code section below. Working of this project is easy. All the features will be performed by Using Alphanumeric Keypad. Check the Full code and a Demo Video below to properly understand the process. Here we are going to explain all the four features of the projects below. Explaining Four Features of Arduino Mobile Phone: 1. Make a Call: To make a call by using our Arduino based Phone, we have to press ‘C’ and then need to enter the Mobile Number on which we want to make a call. Number will be entered by using alphanumeric keypad. After entering the number we again need to press ‘C’. Now Arduino will process for connecting the call to the entered number by using AT command: ATDxxxxxxxxxx; <Enter> where xxxxxxxxx is entered Mobile Number. 2. Receive a Call: Receiving a call is very easy. When someone is calling to your system SIM number, which is there in GSM Module, then your system will show ‘Incoming…’ message over the LCD with incoming number of caller. Now we just need to Press ‘A’ to attend this call. When we press ‘A’, Arduino will send given command to GSM Module:
  • 3. ATA <enter> 3. Send SMS: When we want to send a SMS using our Arduino based Mobile Phone, then we need to Press ‘B’. Now System will ask for Recipient Number, means ‘to whom’ we want to send SMS. After entering the number we need to press ‘D’ and now LCD asks for message. Now we need to type the message, like we enter in normal mobile, by using keypad and then after entering the message we need to press ‘D’ to send SMS. To Send SMS Arduino sends given command: AT+CMGF=1 <enter> AT+CMGS=”xxxxxxxxxx” <enter> where: xxxxxxxxxx is entered mobile number And send 26 to GSM to send SMS. 4. Receive and Read SMS: This feature is also simple. In this, GSM will receive SMS and stores it in SIM card. And Arduino continuously monitors the received SMS indication over UART. We just need to Press ‘D’, to read the SMS, when we see the New Message symbol (like a envelope: See the Video at the end) on the LCD. Below is the SMS Received indication displayed on the Serial port is: +CMTI: “SM” <SMS stored location> +CMTI: “SM”,6 Where 6 is message location where it stored in SIM card. When Arduino gets this ‘SMS received’ indication then it extracts SMS storing location and sends command to GSM to read the received SMS. And show a ‘New Message Symbol’ over the LCD. AT+CMGR=<SMS stored location><enter> AT+CMGR=6 Now GSM sends stored message to Arduino and then Arduino extract main SMS and display it over the LCD and then after reading this SMS Arduino Clear the ‘New SMS symbol’ from the LCD. Note: There is no coding for MIC and Speaker. Check the Full code and a Demo Video below to properly understand the process. Circuit Diagram and Explanation:
  • 4. Circuit Diagram of this for interfacing GSM SIM900 and Arduino is given above. 16x2 LCD pins RS, EN, D4, D5, D6 and D7 are connected with pin number 14, 15, 16, 17, 18 and 19 of Arduino respectively. GSM Module’s Rx and Tx pins are directly connected with Arduino’s pin D3 and D2 respectively (Ground of Arduino and GSM must be connected with each other). 4x4 keypad Row pins R1, R2, R3, R4 are directly linked to pin number 11,10, 9, 8 of Arduino and Colum pins of keypad C1, C2, C3 are linked with pin number 7, 6, 5, 4 of Arduino. MIC is directly connected at mic+ and mic- of GSM Module and Speaker is directly connected at SP+ and SP- pins for GSM Module. Programming Explanation: Programming part of this project is little complex for beginners. In this code we have used keypad library #include <Keypad.h> for interfacing simple keypad for entering numbers. And for entering alphabets with the same keypad, we have created function void alfakey(). Means we have made every key multi functioning and we can enter any character or integer by using only 10 keys.
  • 5. Like if we press key 2 (abc2), it will show ‘a’ and if we presses it again then it will replace ‘a’ to ‘b’ and if again we press three times then it will show ‘c’ at same place in LCD. If we wait for some time after pressing key, cursor will automatic move to next position in LCD. Now we can enter next char or number. The same procedure is applied for other keys. #include <Keypad.h> const byte ROWS = 4; //four rows const byte COLS = 4; //four columns char hexaKeys[ROWS][COLS] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} }; byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad //initialize an instance of class NewKeypad Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); void alfakey() { int x=0,y=0; int num=0; while(1) { lcd.cursor(); char key=customKeypad.getKey(); if(key) { if(key=='1') { num=0; lcd.setCursor(x,y);
  • 6. .... ..... ........ .... Apart from operating keypad, we have created many other functions like void call() for calling feature of Phone, void sms() for messaging feature, void lcd_status() for display LCD status void gsm_init()for initializing the GSM Module etc. Check below all other function related to make & receive Call and send & read SMS using GSM Module and Arduino. All the functions are self-explanatory and understandable. Code: #include <SoftwareSerial.h> SoftwareSerial Serial1(2, 3); // RX, TX #include<LiquidCrystal.h> LiquidCrystal lcd(14,15,16,17,18,19); byte back[8] = { 0b00000, 0b00000, 0b11111, 0b10101, 0b11011, 0b11111, 0b00000, 0b00000 }; String number=""; String msg=""; String instr=""; String str_sms=""; String str1=""; int ring=0; int i=0,temp=0; int sms_flag=0; char sms_num[3]; int rec_read=0; int temp1=0; #include <Keypad.h> const byte ROWS = 4; //four rows const byte COLS = 4; //four columns char hexaKeys[ROWS][COLS] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'} }; byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad //initialize an instance of class NewKeypad Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); String ch="1,.?!@abc2def3ghi4jkl5mno6pqrs7tuv8wxyz90 ";
  • 7. void setup() { Serial1.begin(9600); lcd.begin(16,2); lcd.createChar(1, back); lcd.print("Simple Mobile "); lcd.setCursor(0,1); lcd.print("System Ready.."); delay(1000); gsm_init(); lcd.clear(); lcd.print("System Ready"); delay(2000); } void loop() { serialEvent(); if(sms_flag==1) { lcd.clear(); lcd.print("New Message"); int ind=instr.indexOf("+CMTI: "SM","); ind+=12; int k=0; lcd.setCursor(0,1); lcd.print(ind); while(1) { while(instr[ind]!= 0x0D) { sms_num[k++]=instr[ind++]; } break; } ind=0; sms_flag=0; lcd.setCursor(0,1); lcd.print("Read SMS --> D"); delay(4000); instr=""; rec_read=1; temp1=1; i=0; } if(ring == 1) { number=""; int loc=instr.indexOf("+CLIP: ""); if(loc > 0) { number+=instr.substring(loc+8,loc+13+8); } lcd.setCursor(0,0); lcd.print("Incomming... "); lcd.setCursor(0,1); lcd.print(number); instr="";
  • 8. i=0; } else { serialEvent(); lcd.setCursor(0,0); lcd.print("Call --> C "); lcd.setCursor(0,1); lcd.print("SMS --> B "); if(rec_read==1) { lcd.write(1); lcd.print(" "); } else lcd.print(" "); } char key=customKeypad.getKey(); if(key) { if(key== 'A') { if(ring==1) { Serial1.println("ATA"); delay(5000); } } else if(key=='C') { call(); } else if(key=='B') { sms(); } else if(key == 'D' && temp1==1) { rec_read=0; lcd.clear(); lcd.print("Please wait..."); Serial1.print("AT+CMGR="); Serial1.println(sms_num); int sms_read_flag=1; str_sms=""; while(sms_read_flag) { while(Serial1.available()>0) { char ch=Serial1.read(); str_sms+=ch; if(str_sms.indexOf("OK")>0) { sms_read_flag=0; //break; } } }
  • 9. int l1=str_sms.indexOf(""rn"); int l2=str_sms.indexOf("OK"); String sms=str_sms.substring(l1+3,l2-4); lcd.clear(); lcd.print(sms); delay(5000); } delay(1000); } } void call() { number=""; lcd.clear(); lcd.print("After Enter No."); lcd.setCursor(0,1); lcd.print("Press C to Call"); delay(2000); lcd.clear(); lcd.print("Enter Number:"); lcd.setCursor(0,1); while(1) { serialEvent(); char key=customKeypad.getKey(); if(key) { if(key=='C') { lcd.clear(); lcd.print("Calling........"); lcd.setCursor(0,1); lcd.print(number); Serial1.print("ATD"); Serial1.print(number); Serial1.println(";"); long stime=millis()+5000; int ans=1; while(ans==1) { while(Serial1.available()>0) { if(Serial1.find("OK")) { lcd.clear(); lcd.print("Ringing...."); int l=0; str1=""; while(ans==1) { while(Serial1.available()>0) { char ch=Serial1.read(); str1+=ch; if(str1.indexOf("NO CARRIER")>0) { lcd.clear(); lcd.print("Call End");
  • 10. delay(2000); ans=0; return; } } char key=customKeypad.getKey(); if(key == 'D') { lcd.clear(); lcd.print("Call End"); delay(2000); ans=0; return; } if(ans==0) break; } } } } } else { number+=key; lcd.print(key); } } } } void sms() { lcd.clear(); lcd.print("Initilising SMS"); Serial1.println("AT+CMGF=1"); delay(400); lcd.clear(); lcd.print("After Enter No."); lcd.setCursor(0,1); lcd.print("Press D "); delay(2000); lcd.clear(); lcd.print("Enter Rcpt No.:"); lcd.setCursor(0,1); Serial1.print("AT+CMGS=""); while(1) { serialEvent(); char key=customKeypad.getKey(); if(key) { if(key=='D') { //number+='"'; Serial1.println("""); break; } else { //number+=key; Serial1.print(key);
  • 11. lcd.print(key); } } } lcd.clear(); lcd.print("After Enter MSG "); lcd.setCursor(0,1); lcd.print("Press D to Send "); delay(2000); lcd.clear(); lcd.print("Enter Your Msg"); delay(1000); lcd.clear(); lcd.setCursor(0,0); alfakey(); } void alfakey() { int x=0,y=0; int num=0; while(1) { lcd.cursor(); char key=customKeypad.getKey(); if(key) { if(key=='1') { num=0; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++) { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='1') { num++; if(num>5) num=0; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='2') { num=6; lcd.setCursor(x,y);
  • 12. lcd.print(ch[num]); for(int i=0;i<3000;i++) { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='2') { num++; if(num>9) num=6; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='3') { num=10; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++) { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='3') { num++; if(num>13) num=10; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='4') { num=14; lcd.setCursor(x,y); lcd.print(ch[num]);
  • 13. for(int i=0;i<3000;i++) { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='4') { num++; if(num>17) num=14; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='5') { num=18; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++) { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='5') { num++; if(num>21) num=18; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='6') { num=22; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++)
  • 14. { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='6') { num++; if(num>25) num=22; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='7') { num=26; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++) { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='7') { num++; if(num>30) num=26; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='8') { num=31; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++) {
  • 15. lcd.noCursor(); char key=customKeypad.getKey(); if(key=='8') { num++; if(num>34) num=31; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='9') { num=35; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++) { lcd.noCursor(); char key=customKeypad.getKey(); if(key=='9') { num++; if(num>39) num=35; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='0') { num=40; lcd.setCursor(x,y); lcd.print(ch[num]); for(int i=0;i<3000;i++) { lcd.noCursor();
  • 16. char key=customKeypad.getKey(); if(key=='0') { num++; if(num>41) num=40; lcd.setCursor(x,y); lcd.print(ch[num]); i=0; delay(200); } } x++; if(x>15) { x=0; y++; y%=2; } msg+=ch[num]; } else if(key=='D') { lcd.clear(); lcd.print("Sending SMS...."); // Serial1.print("AT+CMGS="); // Serial1.print(number); // delay(2000); Serial1.print(msg); Serial1.write(26); delay(5000); lcd.clear(); lcd.print("SMS Sent to"); lcd.setCursor(0,1); lcd.print(number); delay(2000); number=""; break; } } } } void send_data(String message) { Serial1.println(message); delay(200); } void send_sms() { Serial1.write(26); } void lcd_status() { lcd.setCursor(2,1); lcd.print("Message Sent"); delay(2000); //lcd.setCursor() //lcd.print("")
  • 17. //return; } void back_button() { //lcd.setCursor(0,15); } void ok_button() { lcd.setCursor(0,4); lcd.print("OK"); } void call_button() { lcd.setCursor(0,4); lcd.print("CALL"); } void sms_button() { lcd.setCursor(0,13); lcd.print("SMS"); } void gsm_init() { lcd.clear(); lcd.print("Finding Module.."); boolean at_flag=1; while(at_flag) { Serial1.println("AT"); while(Serial1.available()>0) { if(Serial1.find("OK")) at_flag=0; } delay(1000); } lcd.clear(); lcd.print("Module Connected.."); delay(1000); lcd.clear(); lcd.print("Disabling ECHO"); boolean echo_flag=1; while(echo_flag) { Serial1.println("ATE1"); while(Serial1.available()>0) { if(Serial1.find("OK")) echo_flag=0; } delay(1000); } lcd.clear(); lcd.print("Echo OFF"); delay(1000); lcd.clear();
  • 18. lcd.print("Finding Network.."); boolean net_flag=1; while(net_flag) { Serial1.println("AT+CPIN?"); while(Serial1.available()>0) { if(Serial1.find("+CPIN: READY")) net_flag=0; } delay(1000); } lcd.clear(); lcd.print("Network Found.."); delay(1000); lcd.clear(); } void serialEvent() { while(Serial1.available()) { char ch=Serial1.read(); instr+=ch; i++; if(instr[i-4] == 'R' && instr[i-3] == 'I' && instr[i-2] == 'N' && instr[i-1] == 'G' ) { ring=1; } if(instr.indexOf("NO CARRIER")>=0) { ring=0; i=0; } if(instr.indexOf("+CMTI: "SM"")>=0) { sms_flag=1; } } } Video: JLCPCB - Prototype PCBs for $2 + Free Shipping on First Order China's Largest PCB Prototype Manufacturer, 290,000+ Customers & 8,000+ Online Orders Per Day 10 PCBs Price: $2 for 2-layer, $15 for 4-layer, $74 for 6-layer  Add new comment Comments (15)
  • 19. teja o reply Arduino: 1.6.4 (Windows 8.1), Board: "Arduino Duemilanove or Diecimila, ATmega328" mobilefull2.ino: In function 'void setup()': mobilefull2:51: error: 'gsm_init' was not declared in this scope mobilefull2.ino: In function 'void loop()': mobilefull2:58: error: 'serialEvent' was not declared in this scope mobilefull2:135: error: 'sms' was not declared in this scope mobilefull2.ino: In function 'void call()': mobilefull2:183: error: 'serialEvent' was not declared in this scope 'gsm_init' was not declared in this scope mobilefull2.ino: In function 'void setup()': mobilefull2:51: error: 'gsm_init' was not declared in this scope mobilefull2.ino: In function 'void loop()': mobilefull2:58: error: 'serialEvent' was not declared in this scope mobilefull2:135: error: 'sms' was not declared in this scope mobilefull2.ino: In function 'void call()': mobilefull2:183: error: 'serialEvent' was not declared in this scope 'gsm_init' was not declared in this scope This report would have more information with "Show verbose output during compilation" enabled in File > Preferences. Sep 05, 2016 gunjan vyas o reply
  • 20. after initializing the display shows only one message "finding module" and there is no further process being done by the circuit. please give proper solution. Oct 06, 2016 harish kumar o reply when i compiling the code it show, error compiling for arduino uno board what i do sir Nov 10, 2016 harish kumar o reply what type of speaker u used sir ? Nov 12, 2016 Mark o reply Looks good. Feb 07, 2017
  • 21. Karlos o reply after initializing the display shows only one message "finding module.." and there is no further process being done by the circuit. please give proper solution. what's next? please Feb 18, 2017 sachit kumaar o reply Tell me the command code for displaying messages through LCD via gsm900A...pls rply sir as soon as possible Feb 27, 2017 Sonadarshan o reply Actually I made this project all worked properly after wards means after working for a day It stopped working in the sense the LCD is giving garbage value after call -c n message display Apr 04, 2017
  • 22. mufaddal o reply dear i need your help as admin is not replying i made this project but unfortunatly it leaves me with finding module kindly help Apr 28, 2017 ABDUL o reply when i compile it it shows error compiling Apr 19, 2017 john o reply Hi sir when i compiling the code it show, error compiling for arduino uno board what i do sir Jul 26, 2017
  • 23. shahid o reply all the functions are working except the sms , i am not recieving the sms frm my mobile to lcd, void serialEvent() { while(Serial1.available()) { char ch=Serial1.read(); instr+=ch; i++; if(instr[i-4] == 'R' && instr[i-3] == 'I' && instr[i-2] == 'N' && instr[i-1] == 'G' ) { ring=1; } if(instr.indexOf("NO CARRIER")>=0) { ring=0; i=0; } if(instr.indexOf("+CMTI: "SM"")>=0) { sms_flag=1; } } } my serial monitor is not recieving this indication from serial, please help as soon as possible Dec 21, 2017 Prom o reply
  • 24. My code is showing errors: 'gsm_init() was not declared in this scope' I need help Jan 13, 2018 k o reply hey guys please help me ... My project GSM based intilay GMS modem send me msg but when i send comond to refil my LIquid tank it will not work.. Jan 15, 2018 Kanwar o reply When Gsm send me msg then i send a msg to again gsm it will not accept my msg request String inputString=""; String num; int trigPin=52; int echoPin=53; long duration,distance; int motor=8; int a; int maxiumRange=50; String destinationNumber="+923312775616"; void setup() { // void Setup Start Serial.begin(9600); pinMode(motor,OUTPUT);
  • 25. pinMode(trigPin,OUTPUT); pinMode(echoPin,INPUT); LCD.begin(16,2); LCD.setCursor(0,0); LCD.print("WELCOME"); gsm.begin(9600); gsm.println("AT+CMGF=1"); //FOR TEXT MODE gsm.println("AT+CNMI=2,2,0,0,0"); //DIRECT MODE NO NEED TO SAVE INCOMING MESSAGES delay(2000); Serial.print("Hello Iam Conneted With Arduino"); //GSM conneted to arduino delay(2000); LCD.clear(); LCD.setCursor(0,0); LCD.print("Liquid Level:"); } //void Setup Close void loop() { //LOOP start 1 digitalWrite(trigPin,LOW); delayMicroseconds (2000); digitalWrite(trigPin,HIGH); delayMicroseconds (15); digitalWrite(trigPin,LOW); delayMicroseconds(10); duration= pulseIn(echoPin,HIGH); distance= duration*0.034/2; LCD.setCursor(0,1); LCD.print(" "); LCD.setCursor(0,1); LCD.print(distance); LCD.println("=CM"); delay(500); if (distance >=10){ // if condtion start 1 gsm.print("AT+CMGF=1r"); // AT command to send SMS message to subsriber delay(1000); gsm.println("AT+CMGS= ""+destinationNumber+"""); //Serial.println("AT + CMGS = "+923041806419""); // recipient's mobile number, in international format delay(1000); gsm.println("your Tank is Empty Do you Want To refill "); // message to send
  • 26. delay(1000); gsm.println((char)26); // End AT command with a ^Z, ASCII code 26 delay(1000); gsm.println(); delay(10000); if(gsm.available()){ //Coming MSG from DestionNumber Owner if2 char inChar = gsm.read(); if (inChar =='+') { // if3 num=gsm.readStringUntil(':'); if(num=="CMT"){ //if4 gsm.readStringUntil(','); gsm.readStringUntil('"'); gsm.readStringUntil('#'); inputString=gsm.readStringUntil('$'); Serial.println(inputString); if(inputString=="motoron"){ // Motor On code if5 digitalWrite(motor,HIGH); delay(100); } Jan 15, 2018