GSM AT COMMANDS

Photo of author

By Jackson Taylor

ARDUINO EXAMPLE FOR MESSAGING
void setup()
{
message();
}
void loop()
{
}
void message(void)
{
Serial.print(“AT+CMGF=1;”);//TEXT MODE
Serial.write(0xd);//ENTER
delay(1000);
Serial.print(“AT+CMGS=”);
Serial.write(0X22);//”
Serial.print(“9895241319″);//NUMBER
Serial.write(0X22);//”
Serial.write(0xd);//ENTER
delay(1000);
Serial.print(“www.EMERGINGTECHS.ORG”);
Serial.write(0x1a);//CTRL+Z
}
ARDUINO EXAMPLE FOR MESSAGING GPS LOCATION AND OTHER DATA
void setup()
{
message();
}
void loop()
{
}
void message(void)
{
Serial.print(“AT+CMGF=1;”);//TEXT MODE
Serial.write(0xd);//ENTER
delay(1000);
Serial.print(“AT+CMGS=”);
Serial.write(0X22);
Serial.print(“9895241319”);//NUMBER
Serial.write(0X22);
Serial.write(0xd);//ENTER
delay(1000);
Serial.print(“ACCIDENT AT “);
for(int v=0;v<100;v++){Serial.write(Serial.read());}
Serial.write(0x1a);
}
MESSAGE READING
//LED ON THE PIN 13 WILL TURN ON WHEN THE MESSAGE CONTAINING THE LETTER JJ(CASE SENSITIVE)
char a;
void setup()
{
  Serial.begin(9600);
  pinMode(13,OUTPUT);
 messagereadinit(); 
}
void loop()

messageread();

void messageread(void)
{
 if(Serial.available()>0)
{
 a=Serial.read();
 if(a==’J’){
   while(!(Serial.available()>0));
   a=Serial.read();
   if(a==’J’)digitalWrite(13,HIGH);   
 }
}
}
void messagereadinit(void)
{
Serial.print(“AT+CMGF=1”);//TEXT MODE
Serial.write(0xd);//ENTER
delay(1000);
Serial.print(“AT+CNMI=1,2,0,0,0”);// //VIEW INCOMING THE MESSAGE DIRECTLY  WITHOUT READING
Serial.write(0xd);
}
GSM AT COMMANDS
AT ==> TO CHECK THE MODEM WORKING
ATD9895241319; DIAL A NUMBER
MESSAGE
AT+CMGF=1
AT+CMGS=”9895241319″ (==ENTER==”-0X22,ENTER-0XD,=)
> EMERGING TECHNOLOGIES  (===TYPE MESSAGE THEN CTRL Z (0X1A) ===)
MESSAGE READING
AT+CMGR=1;  //READ  THE MESSAGE AT THE LOCATION  1
AT+CMGR=2;  //READ  THE MESSAGE AT THE LOCATION  2
MESSAGE DELETING
AT+CMGD=2   //DELETE  THE MESSAGE AT THE LOCATION  2
LOCATION OF TOWER
AT+CNMI=2,0,2,0,0 //DATA FROM CARRIER SETTING TO UART. NEED TO SET    //ONCE
AT+CSCB=1   //TO GET THE LOCATION OF TOWER
AT+CSCB=0,”50″,”” //ADDITIONAL COMMAND IF ABOVE  //COMMAND DOES NOT WORK
//SETS THE INCOMING CHANNEL FOR RECEIVE LOCATION
AT+CNMI=1,2,0,0,0 AND ENTER KEY // //VIEW INCOMING THE MESSAGE 
DIRECTLY  WITHOUT READING