Problem with GSM Library and AT&T GoPhone SIM

(this post originally posted earlier in the wrong category)

I have a new official Arduino GSM Shield and am attempting to use it with the GSM library to post data to a web server and receive SMS messages. However, I have encountered a problem using the GSM library with my AT&T prepaid SIM. I can run the GSMWebClient example just fine once, but it fails to post a second time and instead hangs the program. I added the debug parameter “GSM gsmAccess = true;” which prints out the communications between the Arduino and the GSM. It appears that AT&T is sending message after every transaction letting you know how much it cost and this message must be confusing the GSM Library. I can use the Bluevia SIM that came with the shield and everything works fine. However, Bluevia will not accept SMS messages from out of their network.

The serial data I am getting back looks like this for the first post which completes:

Starting Arduino web client.
.0 9>AT%13%%13%%10%OK%13%%10%
.9 40>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
.40 71>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%
.71 88>AT+IFC=1,1%13%%13%%10%OK%13%%10%
.88 106>%19%%17%AT+CMGF=1%13%%13%%10%OK%13%%10%
.106 122>AT+CLIP=1%13%%13%%10%OK%13%%10%
.122 5>ATE0%13%%13%%10%OK%13%%10%
.5 11>%13%%10%OK%13%%10%
.11 17>%13%%10%OK%13%%10%
.17 23>%13%%10%OK%13%%10%
.23 29>%13%%10%OK%13%%10%
.29 35>%13%%10%OK%13%%10%
.35 41>%13%%10%OK%13%%10%
.41 47>%13%%10%OK%13%%10%
.47 53>%13%%10%OK%13%%10%
.53 59>%13%%10%OK%13%%10%
.59 65>%13%%10%OK%13%%10%
.65 71>%13%%10%OK%13%%10%
.65 82>%13%%10%OK%13%%10%%13%%10%CONNECT%13%%10%
.GET / HTTP/1.1%13%%10%Host: close%13%%10%%13%%10%

The out put from the second post looks like this:

.78 87>AT%13%%13%%10%OK%13%%10%
.87 118>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
.118 21>AT+CGREG?%13%%13%%10%+CGREG: 0,2%13%%10%%13%%10%OK%13%%10%
.21 52>AT+CGREG?%13%%13%%10%+CGREG: 0,1%13%%10%%13%%10%OK%13%%10%
.52 69>AT+IFC=1,1%13%%13%%10%OK%13%%10%
.69 65>%19%%17%AT+CMGF=1%13%%13%%10%OK%13%%10%%13%%10%+CMT: “78108858”,“2014/01/28 08:52:44-20”%13%%10%The last transaction cost %2% 0.04. Your account balance is %2%

At this point, the program stops.

The code is the Web Client example which has been modified to repeat the post every twenty seconds.


  Web client
 This sketch connects to a website through a GSM shield. Specifically,
 this example downloads the URL "" and 
 prints it to the Serial monitor.
 * GSM shield attached to an Arduino
 * SIM card with a data plan
 created 8 Mar 2012
 by Tom Igoe

// libraries
#include <GSM.h>

// PIN Number
#define PINNUMBER ""

// APN data
#define GPRS_APN       "wap.cingular" // replace your GPRS APN
//#define GPRS_APN       "" // replace your GPRS APN

#define GPRS_LOGIN     ""    // replace with your GPRS login
#define GPRS_PASSWORD  "" // replace with your GPRS password

// initialize the library instance
GSMClient client;
GPRS gprs;
GSM gsmAccess = true; 
GSM_SMS sms;

// URL, path & port (for example:
char server[] = "";
char path[] = "/";
int port = 80; // port 80 is the default for HTTP
// Array to hold the number a SMS is retreived from
char senderNumber[20];  

void setup()
  // initialize serial communications and wait for port to open:

  Serial.println("Starting Arduino web client.");
  // connection state

void loop()
  char c;
  boolean notConnected = true;

  // After starting the modem with GSM.begin()
  // attach the shield to the GPRS network with the APN, login and password
    if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
      notConnected = false;
      Serial.println("Not connected");


  // if you get a connection, report back via serial:
  if (client.connect(server, port))
    // Make a HTTP request:
    client.print("GET ");
    client.println(" HTTP/1.1");
    client.print("Host: ");
    client.println("Connection: close");
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  // if there are incoming bytes available 
  // from the server, read them and print them:
  if (client.available())
    char c =;

  // if the server's disconnected, stop the client:
  if (!client.available() && !client.connected())

I'm also using a prepaid AT&T SIM with the Arduino GSM Shield. In the web-based account management for AT&T GoPhone service (, there is a option for End of Call Notification: Off.

I set this and disabled the automated messages you're describing. Hope that helps a bit.