GSM Shield getting Error when sending SMS

Post Reply
gurufarmer
Posts: 1
Joined: Sun Nov 29, 2015 12:54 am

GSM Shield getting Error when sending SMS

Post by gurufarmer »

Hi, I purchased a Geeetech GSM shield for my Arduino Uno and have been able to make calls with it and also able to send SMS messages with it for a couple weeks now. Now all of a sudden when i send an SMS using any variant of the code that I have been using even the demo code from the Geeetech wiki page returns an error in the serial monitor. The card is still able to make phone calls and it receives sms's and calls and they are displayed in the serial monitor. Below is the latest test code stripped down to just send sms and dial a phone number. I replaced the last 4 of the phone number with xxxx.

Here is what is displayed on the serial monitor.
AT+CMGF=1

OK
AT + CMGS = "+1512202xxxx"

> How are you ?

ERROR
ATD + +1512202xxxx;

OK


and here is the code I am using

Code: Select all

#include <SoftwareSerial.h>
#include <String.h>

SoftwareSerial mySerial(7, 8);

void setup()
{
  mySerial.begin(19200);               // the GPRS baud rate
  Serial.begin(19200);    // the GPRS baud rate
  delay(500);
}

void loop()
{
  //after start up the program, you can using terminal to connect the serial of gprs shield,
  //if you input 't' in the terminal, the program will execute SendTextMessage(), it will show how to send a sms message,
  //if input 'd' in the terminal, it will execute DialVoiceCall(), etc.

  if (Serial.available())
    switch (Serial.read())
    {
      case 't':
        SendTextMessage();
        break;
      case 'd':
        DialVoiceCall();
        break;

    }
  if (mySerial.available())
    Serial.write(mySerial.read());
}

///SendTextMessage()
///this function is to send a sms message
void SendTextMessage()
{
  mySerial.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
  delay(100);
  mySerial.println("AT + CMGS = \"+1512202xxxx\"");//send sms message, be careful need to add a country code before the cellphone number
  delay(100);
  mySerial.println("How are you ?");//the content of the message
  delay(100);
  mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
  delay(100);
  mySerial.println();
}

///DialVoiceCall
///this function is to dial a voice call
void DialVoiceCall()
{
  mySerial.println("ATD + +1512202xxxx;");//dial the number
  delay(100);
  mySerial.println();
}

void ShowSerialData()
{
  while (mySerial.available() != 0)
    Serial.write(mySerial.read());
}
Wilbur1225
Posts: 3
Joined: Fri Oct 14, 2016 12:29 pm

Re: GSM Shield getting Error when sending SMS

Post by Wilbur1225 »

The Arduino GSM shield allows an Arduino board to connect to the internet, send and receive SMS, and make voice calls using the GSM library.
The shield will work with the Arduino Uno out of the box. The shield will work with the Mega, Mega ADK, Yun, and Leonardo boards with a minor modification. The Due is not supported at this timw.
Post Reply