SIM300 GPRS commands

Before you start accessing internet on SIM300 you need to make sure that,

  • Internet service is active on your SIM card.
  • The APN, username, password for accessing internet, It depends on your network operator, for vodafone and airtel the APN is “www” and username and password are blank. ( not sure about other networks)
  • You have an internet pack active or have some currency 

Attaching to GPRS service: 
First step is to enable the internet connection by issuing the command,

AT+CGATT=1” followed byrn“.

And similarly the command “AT+CGATT?”  will return the status of the internet connection  


Selecting the APN and the GPRS connection mode: 

Second step is to tell the SIM300 modem the APN or gateway which you will be using to connect to the mobile network by sending the command,

AT+CIPCSGP=1,”your APN name”,”username”,”password” followed by “rn”

ex: AT+CIPCSGP=1,”www” followed by “rn” for Vodafone network. 


Start the Task:

Start the task and activate the APN given in the previous command by issuing the command,

“AT+CSTT” followed by “rn”

And similarly the command “AT+CSTT?”  followed by “rn” should give you the APN name selected. 


Turn on the GPRS connection: 

Now you need to turn on the internet connection by issuing the command,

AT+CIICR followed by rn”  

This command if succesfully executed, changes the IPstatus to IP GPRSACT state 


Check if the IP address is allotted to the SIM300 modem: 

SIM300 will reply you with the IP address allotted to it by issuing the command,

AT+CIFSR” followed by rn

The modem will reply with some IP address like 10.132.36.243


Inform SIM300 how you will address the internet:

To communicate with any system we either need its IP address or the domain name. So issue the command,

AT+CDNSORIP=1”  followed by rn” for domain name addressing or

AT+CDNSORIP=0”  followed by rn”  for direct IP addressing


Select the prompt and enable status: 

Tell the modem to show a ‘>’ symbol when it is ready to read data and enable the status replies like DATA SENT, etc by issuing the command,

AT+CIPSPRT=1” followed by rn”  


Enable the header information: 

For reading data from the modem using microcontroller we need the data length and some indication of beginning of data, So tell the modem to add the header and data length before the start of the data by issuing the command,

AT+CIPHEAD=1  followed by rn”  


Now since you know all the commands, let us access a page located on my website at http://raviyp.in/test/test.php

Make sure the “test.php” file permission is set to 755 (executable by the world). 


Establish communication with website or server:

To access a website we need to establish communication with its server, Do it with the following command,

AT+CIPSTART=”tcp”,”raviyp.in”,”80″   followed by rn”  

After the above command is issued the SIM300 will reply “CONNECT OK”.  if connection was succesfull


Send data to server and tell it what you want to read from it:

Now after receiving “CONNECT OK”, we can access the page on the server using the following command,

AT+CIPSEND  followed by rn”   

Now you will receive a command prompt symbol ‘>’ type the GET command 

GET /test/test.php HTTP/1.1  followed by rn”   

host:raviyp.in followed by rnrn”  And type Ctrl ^Z  or send the ascii code 0x1A(1Ah)  to send the command

…<Here the server will reply with the data>… 


Summarizing everything, here is the sequence, 

RDY

+CFUN: 1
+CPIN: READY
Call Ready
 
AT+CMGF=1
OK
 
AT+CGATT=1
OK
 
AT+CIPCSGP=1,”WWW”
OK
 
AT+CSTT
OK
 
AT+CREG? +CREG: 0,1
OK
 
AT+CIICR
OK
 
AT+CIPSTATUS
OK
STATE: IP GPRSACT
 
AT+CIFSR 10.65.242.196
 
AT+CDNSORIP=1
OK
 
AT+CIPSPRT=1
OK
 
AT+CIPHEAD=1

AT+CIPSTART=”TCP”,”RAVIYP.IN”,”80″
OK
CONNECT OK
 
AT+CIPSEND
> GET /test/test.php HTTP/1.1
host:raviyp.in
SEND OK
 
+IPD331:HTTP/1.1 200 OK
Date: Wed, 11 Dec 2013 12:16:38 GMT
Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8m DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Vary: Accept-Encoding,User-Agent
Content-Type: text/html
Transfer-Encoding: chunked
 
34
You have successfully accesed the page – RAVI PUJAR.
+IPD5:0 


Turn off the GPRS connection and close connection to server:

After the communication you can turn off the connection to server by sending, 

AT+CIPCLOSE followed by rn

the GPRS communication by sending,

AT+CIPSHUT followed by rn


 Also see: 

 

Leave a Comment