Go Down

Topic: SIM900 from seedstudio / no internet conection (Read 2573 times) previous topic - next topic

limace

I have the Shield GPRS from seedstudio:
http://www.seeedstudio.com/depot/GPRS-Shield-V20-p-1379.html
And One Arduino UNO

The simple call, sms run well but I have some problems with the internet conection

Code: [Select]


#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);
  SIM900power();
 
}

void loop()
{

  if (Serial.available())
    switch(Serial.read())
   {
     case 'h':
       SubmitHttpRequest();
       break;

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


void SubmitHttpRequest()
{
  String humidity = "1031";
  mySerial.println("AT+CSQ");
  delay(100);
  ShowSerialData();
  mySerial.println("AT+CGATT?");
  delay(100);
  ShowSerialData();
  mySerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
  delay(1000);
  ShowSerialData();
  mySerial.println("AT+SAPBR=3,1,\"APN\",\"internet\"");
  delay(4000);
  ShowSerialData();
  mySerial.println("AT+SAPBR=1,1");
  delay(2000);
  ShowSerialData();
  mySerial.println("AT+HTTPINIT");
  delay(2000);
  ShowSerialData();
  mySerial.println("AT+HTTPPARA=\"URL\",\"www.xxx.com/ab/tx.php?h=" + humidity + "\"");
  delay(1000);
  ShowSerialData();
  mySerial.println("AT+HTTPACTION=0");
  delay(10000);
  ShowSerialData();
  mySerial.println("AT+HTTPREAD");
  delay(300);
  ShowSerialData();
  mySerial.println("");
  delay(100);
}



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

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}


Reponse:
Code: [Select]
+CSQ: 10,0

OK
AT+CGATT?

+CGATT: 0

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

OK
AT+SAPBR=3,1,"APN","internet"

OK
AT+SAPBR=1,1

ERROR
AT+HTTPINIT

OK
AT+HTTPPARA="URL","www.XXXX.com/ab/tx.php?h=1031"

OK
AT+HTTPACTION=0

OK

+HTTPACTION:0,601,0
AT+HTTPREAD

OK


I have make a lot of search but no response
Thanks for your help

dannable

Is the APN parameter the real one you use or have you inserted dummy data?
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

limace

#2
Aug 08, 2014, 11:14 am Last Edit: Aug 08, 2014, 11:21 am by limace Reason: 1
I stupidly copied the parameters of code that I found  :smiley-red: . It depends on my access provider I guess? What needs to be changed and how?

In my provider I find this :
APN Internet
Nom : Free
APN : free
MCC : 208
MNC : 15

By typing the code I figured that the error come from this line ...
mySerial.println("AT+SAPBR=3,1,\"APN\",\"internet\"");
=>
mySerial.println("AT+SAPBR=3,1,\"APN\",\"free\"");

I'll test now ... :D

dannable

I would expect your parameters to be something like this, depending on your service provider:

Code: [Select]
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","internet.myprovider.com"
AT+SAPBR=3,1,"USER","web"
AT+SAPBR=3,1,"PWD","web"
AT+SAPBR=1,1
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

limace

I have only put this and it seems to work   :smiley-mr-green:

Code: [Select]
  mySerial.println("AT+CGATT?");
  delay(100);
  ShowSerialData();
  mySerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
  delay(1000);
  ShowSerialData();
  mySerial.println("AT+SAPBR=3,1,\"APN\",\"free\"");
  delay(4000);
  ShowSerialData();
  mySerial.println("AT+SAPBR=1,1");


Thanks  a lot

Go Up