GSM Test GPRS sketch problem

I can't seem to get past "Connecting GSM network..." when I run the sketch. Anyone have any suggestions? It is the first time that I am trying to integrate a GPRS shield into my Arduino life. Just purchased it today. Thanks.

Hi,
We can't comment until you post the sketch you are talking about.

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

What arduino controller are you using?

Tom.... :slight_smile:

Do you mean the File->Examples->GSM->Tools->TestGPRS sketch?

Do you have a SIM card with a data plan installed?

Did you add your PIN number to the sketch?

How long did you wait for an error message? (Try waiting longer. The error message might tell you why it is failing.)

Sorry, this is the code. I should probably check to see if there is still a plan associated with the SIM that I am using. If not, would I be getting what I mentioned??
Thanks.

/*

 This test asks your APN data and try to connect
 to arduino.cc site by GPRS.

 Circuit:
 * GSM shield attached

 Created 18 Jun 2012
 by David del Peral
 */

// libraries
#include <GSM.h>

// PIN Number
#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;        // GSM access: include a 'true' parameter for debug enabled
GPRS gprsAccess;  // GPRS access
GSMClient client;  // Client service for TCP connection

// messages for serial monitor response
String oktext = "OK";
String errortext = "ERROR";

// URL and path (for example: arduino.cc)
char url[] = "arduino.cc";
char urlproxy[] = "http://arduino.cc";
char path[] = "/";

// variable for save response obtained
String response = "";

// use a proxy
boolean use_proxy = false;

void setup()
{
    // initialize serial communications
  Serial.begin(9600);
}

void loop()
{
  use_proxy = false;

  // start GSM shield
  // if your SIM has PIN, pass it as a parameter of begin() in quotes
  Serial.print("Connecting GSM network...");
  if(gsmAccess.begin(PINNUMBER)!=GSM_READY)
  {
    Serial.println(errortext);
    while(true);
  }
  Serial.println(oktext);

  // read APN introduced by user
  char apn[50];
  Serial.print("Enter your APN: ");
  readSerial(apn);
  Serial.println(apn);

  // Read APN login introduced by user
  char login[50];
  Serial.print("Now, enter your login: ");
  readSerial(login);
  Serial.println(login);

  // read APN password introduced by user
  char password[20];
  Serial.print("Finally, enter your password: ");
  readSerial(password);

  // attach GPRS
  Serial.println("Attaching to GPRS with your APN...");
  if(gprsAccess.attachGPRS(apn, login, password)!=GPRS_READY)
  {
    Serial.println(errortext);
  }
  else{

    Serial.println(oktext);

    // read proxy introduced by user
    char proxy[100];
    Serial.print("If your carrier uses a proxy, enter it, if not press enter: ");
    readSerial(proxy);
    Serial.println(proxy);

    // if user introduced a proxy, asks him for proxy port
    int pport;
    if(proxy[0] != '\0'){
      // read proxy port introduced by user
      char proxyport[10];
      Serial.print("Enter the proxy port: ");
      readSerial(proxyport);
      // cast proxy port introduced to integer
      pport = (int) proxyport;
      use_proxy = true;
      Serial.println(proxyport);
    }

    // connection with arduino.cc and realize HTTP request
    Serial.print("Connecting and sending GET request to arduino.cc...");
    int res_connect;

    // if use a proxy, connect with it
    if(use_proxy)
      res_connect = client.connect(proxy, pport);
    else
      res_connect = client.connect(url, 80);

    if (res_connect)
    {
      // make a HTTP 1.0 GET request (client sends the request)
      client.print("GET ");

      // if use a proxy, the path is arduino.cc URL
      if(use_proxy)
        client.print(urlproxy);
      else
        client.print(path);

      client.println(" HTTP/1.0");
      client.println();
      Serial.println(oktext);
    } 
    else
    {
      // if you didn't get a connection to the server
      Serial.println(errortext);
    }
    Serial.print("Receiving response...");

    boolean test = true;
    while(test)
    {
      // if there are incoming bytes available 
      // from the server, read and check them
      if (client.available())
      {
        char c = client.read();
        response += c;

        // cast response obtained from string to char array
        char responsechar[response.length()+1];
        response.toCharArray(responsechar, response.length()+1);

        // if response includes a "200 OK" substring
        if(strstr(responsechar, "200 OK") != NULL){
          Serial.println(oktext);
          Serial.println("TEST COMPLETE!");
          test = false;
        }
      }

      // if the server's disconnected, stop the client:
      if (!client.connected())
      {
        Serial.println();
        Serial.println("disconnecting.");
        client.stop();
        test = false;
      }
    }
  }
}

/*
  Read input serial
 */
int readSerial(char result[])
{
  int i = 0;
  while(1)
  {
    while (Serial.available() > 0)
    {
      char inChar = Serial.read();
      if (inChar == '\n')
      {
        result[i] = '\0';
        return 0;
      }
      if(inChar!='\r')
      {
        result[i] = inChar;
        i++;
      }
    }
  }
}

Did you add your PIN number to the sketch?

How long did you wait for an error message? (Try waiting longer. The error message might tell you why it is failing.)

I waited several minutes, then tried it again with a PIN if there ever was one (but never added one for the SIM card), but still nothing past "Connecting GSM network...".

Which shield?

Running a GPRS Seeed shield, V2.1, on a UNO board.

The examples provided with the IDE are for the official Arduino shield based on the Quectel M10 chip, not the SIM900. They may use codes that are exclusive to the M10.

You were right! I went here (http://tronixstuff.com/2014/01/08/tutorial-arduino-and-sim900-gsm-modules/) and all worked well. Thanks