SIM900 GPRS/GSM Shield - Working SMS and Calls, but no internet

I have this shield which I am using my EE SIM card in. I have successfully got texts and calls working fine, but the end goal is to submit HTTP requests. For some reason though, I cannot get the method (which is pulled from the wiki linked) to print out anything.

The code below shows the method to submit a HTTP request. At each stage it attempts to show the serial data, which is using a method at the bottom of the block of code. I can't see any issues with this as to why no data would be printed out. I have changed the APN to 'everywhere' as I believe that is what it should be for the UK EE network. (As a side note, I am using an Arduino Mega, and 'mySerial' in the example below is SoftwareSerial)

Anyone had any similar issues or see something that I am overlooking?

///SubmitHttpRequest()
///this function is submit a http request
///attention:the time of delay is very important, it must be set enough 
void SubmitHttpRequest()
{
  mySerial.println("AT+CSQ");
  delay(100);

  ShowSerialData();// this code is to show the data from gprs shield, in order to easily see the process of how the gprs shield submit a http request, and the following is for this purpose too.

  mySerial.println("AT+CGATT?");
  delay(100);

  ShowSerialData();

  mySerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs
  delay(1000);

  ShowSerialData();

  mySerial.println("AT+SAPBR=3,1,\"APN\",\"everywhere\"");//setting the APN, the second need you fill in your local apn server
  delay(4000);

  ShowSerialData();

  mySerial.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to the AT command mamual
  delay(2000);

  ShowSerialData();

  mySerial.println("AT+HTTPINIT"); //init the HTTP request

  delay(2000); 
  ShowSerialData();

  mySerial.println("AT+HTTPPARA=\"URL\",\"www.google.com.hk\"");// setting the httppara, the second parameter is the website you want to access
  delay(1000);

  ShowSerialData();

  mySerial.println("AT+HTTPACTION=0");//submit the request 
  delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer.
  //while(!mySerial.available());

  ShowSerialData();

  mySerial.println("AT+HTTPREAD");// read the data from the website you access
  delay(300);

  ShowSerialData();

  mySerial.println("");
  delay(100);
}

void ShowSerialData()
{
  while(mySerial.available()!=0)
    Serial.write(mySerial.read());
}

If you put that SIM card in a phone, do you get data?

If you have a mega why not use a hardware serial... They are more reliable. What baud speed did you set?

Yes there is data, it's the SIM directly from my phone.
I will use hardware serial eventually, I just wanted to get it going using the example sketch to start with.

Baud speed is setup as 19200 (which is used in the example sketch), and then the same baud in the serial monitor. Looks like this:

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

The serial monitor does work for SMS and calling, as in I have:

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;
     case 'h':
       SubmitHttpRequest();
       break;
   } 
  if (mySerial.available())
    Serial.write(mySerial.read());
}

So if type 't' an SMS is correctly sent. If I type 'd' a voice call is correctly made. The only issue is when using 'h' for a HTTP request. I have no idea if it could potentially be doing something, as nothing shows in the serial monitor, it's always blank.

how are you powering your shield?

can you try adding at the beginning of SubmitHttpRequest()

  mySerial.println("AT+CSQ=?");
  delay(100);
  ShowSerialData();

and see if you get something out?

I am powering the shield just through Arduiono USB, is this not sufficient?

I will attempt adding the extra bit of code in the next hour and get back to you with the results.

Thanks :slight_smile:

So I am now using hardware serial instead of software serial and I have output.
But my output now shows an error when attempting to attach to the GPRS service.

My output:
hAT+CSQ

+CSQ: 26,0

OK
AT+CGATT?

ERROR
AT+SAPBR=3,1,"CONTYPE","GPRS"

ERROR
AT+SAPBR=3,1,"APN","everywhere"

ERROR
AT+SAPBR=1,1

ERROR
AT+HTTPINIT

ERROR
AT+HTTPPARA="URL","www.google.com.hk"

ERROR

Have you tried "AT+CSQ=?"