How to Make Call, Send and Receive Message using GSM Module
AT Commands:
Make a Voice call:
ATD+91XXXXXXXXXX;
Send Message:
AT+CMGF=1
AT+CMGS=\"+91XXXXXXXXXX\"\r
Message goes here
(char)26
Receive Message:
AT+CNMI=2,2,0,0,0
AT+CMGF=1
Redial call:
ATDL
------------------------------------------------------------------------------------------------------
Arduino Code to make a Voice Call:
void setup()
{
Serial.begin(9600);
Serial.println("ATD+91XXXXXXXXXX;");
delay(1000);
}
void loop()
{
}
------------------------------------------------------------------------------------------------------
Arduino Code to send a Message:
void setup()
{
Serial.begin(9600);
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS=\"+91XXXXXXXXXX\"\r");
delay(1000);
Serial.println("Hello");
delay(1000);
Serial.println("Himanshu");
delay(1000);
Serial.println((char)26);
}
void loop()
{
}
------------------------------------------------------------------------------------------------------
Arduino Code to receive a Message:
char str[15];
int i = 0;
//Message Example: #Hello World*
void setup()
{
Serial.begin(9600);
Serial.println("AT+CNMI=2,2,0,0,0");
delay(2000);
Serial.println("AT+CMGF=1");
delay(1000);
}
void loop()
{
i = 0;
delay(1000);
}
void serialEvent()
{
while(Serial.available())
{
if(Serial.find("#"))
{
delay(1000);
while (Serial.available())
{
char inChar=Serial.read();
str[i++]=inChar;
if(inChar=='*')
{
Serial.println((String)str);
return;
}
}
}
}
}
------------------------------------------------------------------------------------------------------
Arduino Code to Redial:
void setup()
{
Serial.begin(9600);
Serial.println("ATDL");
}
void loop()
{
}
Msg receiving code doesn't work
ReplyDeleteSUPER BRO
Deletemessage receiving is not working
ReplyDeleteCurly brackets in void loop pls check
DeleteAT+CMGS=\"+91XXXXXXXXXX\"\r
ReplyDeleteafter this command it shows error
Bhiya can I get your contact number
ReplyDeleteI need your help
Plz
how do i understand if my gsm module is working or not? My module is A7670C 4G LTE module.
ReplyDelete